openpond 0.0.68 → 0.0.69

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.
Files changed (128) hide show
  1. package/dist/chunks/{actions-command-DLOKFA34.js → actions-command-6N5XWMR6.js} +4 -4
  2. package/dist/chunks/{app-layer-K7NAOLDL.js → app-layer-EXXOWJ5H.js} +7 -7
  3. package/dist/chunks/{app-server-runtime-OFZZIWAB.js → app-server-runtime-7FBQBE3C.js} +10 -10
  4. package/dist/chunks/{apps-5VSVJLM7.js → apps-RZSDOFAG.js} +7 -7
  5. package/dist/chunks/{chunk-N6FKRVAT.js → chunk-47EIAYI7.js} +2 -2
  6. package/dist/chunks/{chunk-7FW2CVYN.js → chunk-4L3ZJS2T.js} +426 -1
  7. package/dist/chunks/{chunk-OOJP442J.js → chunk-5TKZBMQM.js} +1 -1
  8. package/dist/chunks/{chunk-WEB37YVJ.js → chunk-7C4OIFOC.js} +1 -1
  9. package/dist/chunks/{chunk-MUS7KPXK.js → chunk-BLFIIAWZ.js} +1931 -19
  10. package/dist/chunks/{chunk-3KLQ52B2.js → chunk-BVY5JYM6.js} +4 -9
  11. package/dist/chunks/{chunk-DBHSOTYZ.js → chunk-D7BO5Y5J.js} +3 -24
  12. package/dist/chunks/chunk-DLQQIWN2.js +648 -0
  13. package/dist/chunks/{chunk-T55IL3GI.js → chunk-DNXBJZAU.js} +1 -1
  14. package/dist/chunks/{chunk-KLD7NT5J.js → chunk-F36ZVO6U.js} +3 -3
  15. package/dist/chunks/{chunk-TSDVA7QP.js → chunk-FEOLMLYU.js} +8 -12
  16. package/dist/chunks/{chunk-QETF6ILG.js → chunk-FQS2QL5F.js} +359 -841
  17. package/dist/chunks/{chunk-J2REM7LE.js → chunk-HFPUR4CQ.js} +5 -116
  18. package/dist/chunks/{chunk-JIEUB6OS.js → chunk-J3YDKJFD.js} +1 -1
  19. package/dist/chunks/{chunk-JGOP4GCK.js → chunk-JTHL5XJ2.js} +5 -25
  20. package/dist/chunks/{chunk-OQLYO7TA.js → chunk-MMRJNSWY.js} +34 -81
  21. package/dist/chunks/{chunk-HFQHD35D.js → chunk-NPNIL6SQ.js} +1 -1
  22. package/dist/chunks/{chunk-IG72OKNB.js → chunk-OOM2PHBE.js} +2080 -16400
  23. package/dist/chunks/{chunk-PSGEH4FC.js → chunk-QTN6HXOR.js} +3 -3
  24. package/dist/chunks/{chunk-HNY7OSDY.js → chunk-SFMNGWNO.js} +1 -1
  25. package/dist/chunks/{chunk-TBEBLKCQ.js → chunk-WBAZFKC7.js} +3 -3
  26. package/dist/chunks/{chunk-NA4L2HQM.js → chunk-Y57RTLVV.js} +33 -33
  27. package/dist/chunks/{chunk-Z2ZWHU7O.js → chunk-YVCYVDNP.js} +1 -1
  28. package/dist/chunks/{cli-6WFY2ULA.js → cli-HIXVXM72.js} +8 -8
  29. package/dist/chunks/{core-commands-HQ3HL34W.js → core-commands-34SVH6ZQ.js} +8 -8
  30. package/dist/chunks/{desktop-test-RU6SRARQ.js → desktop-test-66DPBNJX.js} +7 -7
  31. package/dist/chunks/{extension-4KFKWMC4.js → extension-ZMRHCDO3.js} +36 -87
  32. package/dist/chunks/{help-ZUCPOR22.js → help-COHCZEP2.js} +1 -1
  33. package/dist/chunks/{opchat-AZX7SYM7.js → opchat-2PGW2GNN.js} +10 -18
  34. package/dist/chunks/{organizations-GV6Z7G4J.js → organizations-NZ4OY56V.js} +9 -9
  35. package/dist/chunks/{profile-TSLGZPUI.js → profile-GEMTRPUG.js} +11 -11
  36. package/dist/chunks/{project-agent-SHIQZWPY.js → project-agent-NX6YBGWC.js} +10 -10
  37. package/dist/chunks/{sandbox-command-TRS66NUT.js → sandbox-command-UEY53OJO.js} +8 -8
  38. package/dist/chunks/{sandbox-template-RVWXD5O3.js → sandbox-template-YKYRB645.js} +10 -10
  39. package/dist/chunks/{src-VUJ6EBOU.js → src-IXYDKOBI.js} +799 -965
  40. package/dist/chunks/{src-Q3BOITLJ.js → src-LKJBD5AM.js} +5 -5
  41. package/dist/chunks/{teams-bot-CLCMGBW5.js → teams-bot-K6KZHZJV.js} +7 -7
  42. package/dist/chunks/{workspaces-IIPITOCV.js → workspaces-WXM72UZF.js} +2 -2
  43. package/dist/cli.js +13 -13
  44. package/dist/index.js +15 -56
  45. package/dist/web/assets/App-BF9L0JUv.js +171 -0
  46. package/dist/web/assets/{AppDialog-sLTPiFGX.js → AppDialog-DX-xs3KA.js} +1 -1
  47. package/dist/web/assets/{AppTerminalPanel-B0NCyY4L.js → AppTerminalPanel-CYVj_ITT.js} +2 -2
  48. package/dist/web/assets/{AppsView-DyDyktK2.js → AppsView-ByjyGog7.js} +1 -1
  49. package/dist/web/assets/{BrowserSidebar-C-PQxmQa.js → BrowserSidebar-BDwtMAZl.js} +1 -1
  50. package/dist/web/assets/{CartesianChart-CnerMhTr.js → CartesianChart-Dv6jJfPR.js} +1 -1
  51. package/dist/web/assets/{CollaborationTabs-DJEp6dux.js → CollaborationTabs-CC5AIhMh.js} +1 -1
  52. package/dist/web/assets/{CommandMenu-B5lGz8rG.js → CommandMenu-Ct0Sx7yP.js} +1 -1
  53. package/dist/web/assets/{CommunityView-DQJaHBa5.js → CommunityView-C_zVE0jg.js} +1 -1
  54. package/dist/web/assets/{ComposerCreateImproveStrip-7hBR2bdV.js → ComposerCreateImproveStrip-CNn4OywM.js} +1 -1
  55. package/dist/web/assets/{GetStartedView-l1Cz1e7g.js → GetStartedView-DRFpHDLd.js} +1 -1
  56. package/dist/web/assets/LabModelVersionDetailPage-BzF-IVXQ.js +1 -0
  57. package/dist/web/assets/{LabSkillSidebar-jlX5I_D5.js → LabSkillSidebar-B9jY4AgE.js} +1 -1
  58. package/dist/web/assets/{LabsRoute-D3w6nPSa.css → LabsRoute-CS_orT9s.css} +1 -1
  59. package/dist/web/assets/LabsRoute-Di1Zs4gZ.js +2 -0
  60. package/dist/web/assets/{MainChatThread-B1nXTMAf.js → MainChatThread-8VzlD8Hi.js} +2 -2
  61. package/dist/web/assets/{MainPane-DxVcMBFo.js → MainPane-StAOFINE.js} +3 -3
  62. package/dist/web/assets/{MarkdownText-B3njGyZS.js → MarkdownText-B8D_ftSJ.js} +1 -1
  63. package/dist/web/assets/{Messages-yBS4UHWl.js → Messages-TY62tiDp.js} +1 -1
  64. package/dist/web/assets/{NativeSkillSidebar-DaD52aW1.js → NativeSkillSidebar-DjebFRoi.js} +1 -1
  65. package/dist/web/assets/{NewExperienceSwitcher-C7X_K5Xl.js → NewExperienceSwitcher-C-bJxHxY.js} +1 -1
  66. package/dist/web/assets/{NewProjectDialog-NuPVF2Y7.js → NewProjectDialog-Cx8QcZm7.js} +1 -1
  67. package/dist/web/assets/{OutputsPage-Bmof4Tdv.js → OutputsPage-Y9HM-SHX.js} +1 -1
  68. package/dist/web/assets/{ProjectsPage-D7opg6ff.js → ProjectsPage-BBr58yKT.js} +1 -1
  69. package/dist/web/assets/{RightChatPanelStack-BzsNeSwx.js → RightChatPanelStack-DzUbDKwp.js} +1 -1
  70. package/dist/web/assets/{RightSidebarHomePanel-D8dAMHcp.js → RightSidebarHomePanel-Dx-1elSI.js} +1 -1
  71. package/dist/web/assets/{ScheduledWorkPage-Dkjhof6t.js → ScheduledWorkPage-BuXw_W8b.js} +1 -1
  72. package/dist/web/assets/SettingsView-DB_zPHYY.js +6 -0
  73. package/dist/web/assets/{TeamChatView-DIxvrgai.js → TeamChatView-Bkyhu40R.js} +1 -1
  74. package/dist/web/assets/{TerminalOverlay-Cd0Sp9LD.js → TerminalOverlay-CaCkZDzO.js} +1 -1
  75. package/dist/web/assets/{TrainingCreationPanel-DACYaOny.js → TrainingCreationPanel-Vvi41WNT.js} +1 -1
  76. package/dist/web/assets/{TrainingDraftPanel-DBWJW8ZD.js → TrainingDraftPanel-C2C3hffI.js} +1 -1
  77. package/dist/web/assets/{UsageSettingsSection-B3sbqaUV.js → UsageSettingsSection-DpPBd-ra.js} +1 -1
  78. package/dist/web/assets/{WorkSidebarPanel-D4yXQ64j.js → WorkSidebarPanel-CeWGboTh.js} +1 -1
  79. package/dist/web/assets/{WorkspaceDiffPanel-CBgPVF1P.js → WorkspaceDiffPanel-D_zKOW4K.js} +3 -3
  80. package/dist/web/assets/{WorkspaceEnvironmentMenu-Bp-9V7Jq.js → WorkspaceEnvironmentMenu-BTz9FISP.js} +3 -3
  81. package/dist/web/assets/{WorkspaceGitDialogs-BxU5Uhpz.js → WorkspaceGitDialogs-BnBRUYpS.js} +1 -1
  82. package/dist/web/assets/{WorkspaceMonacoEditor-Db_sWYFt.js → WorkspaceMonacoEditor--GOVrHFp.js} +3 -3
  83. package/dist/web/assets/{activity-BzKyRXbd.js → activity-DA5DNQwD.js} +1 -1
  84. package/dist/web/assets/{arrow-up-right-DaIxkG4K.js → arrow-up-right-BRZWXpqJ.js} +1 -1
  85. package/dist/web/assets/{chat-file-links-wORSEipQ.js → chat-file-links-CgFHK89C.js} +1 -1
  86. package/dist/web/assets/chevron-up-DSv2auz_.js +1 -0
  87. package/dist/web/assets/{clipboard-BTRsPPaK.js → clipboard-dPd_3lpG.js} +1 -1
  88. package/dist/web/assets/{cloud-upload-BYXHJoKd.js → cloud-upload-DOwvN4hp.js} +1 -1
  89. package/dist/web/assets/{cssMode-Be446Wgi.js → cssMode-BM4j9M0D.js} +1 -1
  90. package/dist/web/assets/{folder-open-KtKTXn4w.js → folder-open-DavjPCw4.js} +1 -1
  91. package/dist/web/assets/{folder-plus-9-Xcli22.js → folder-plus-Dyqast6G.js} +1 -1
  92. package/dist/web/assets/{git-branch-CLGxzDjJ.js → git-branch-zKnZdQiX.js} +1 -1
  93. package/dist/web/assets/{git-commit-horizontal-CmVYsUnh.js → git-commit-horizontal-s3X0cQlz.js} +1 -1
  94. package/dist/web/assets/{htmlMode-DTjTyBB_.js → htmlMode-Nlx7ckXa.js} +1 -1
  95. package/dist/web/assets/{index-DqWw2ymf.js → index-5-B6FIuE.js} +1 -1
  96. package/dist/web/assets/index-CQ3CPVHZ.css +1 -0
  97. package/dist/web/assets/index-CuoGlf-W.js +1 -0
  98. package/dist/web/assets/{info-BLmP4K0e.js → info-CVvrNOHr.js} +1 -1
  99. package/dist/web/assets/{jsonMode-Z-2iim-u.js → jsonMode-B7monA6g.js} +1 -1
  100. package/dist/web/assets/{lspLanguageFeatures-Cr2iCfG2.js → lspLanguageFeatures-CcJ9GDtK.js} +1 -1
  101. package/dist/web/assets/{minimize-2-CWA6iO3r.js → minimize-2-O1DnznGK.js} +1 -1
  102. package/dist/web/assets/{monaco.contribution-YhqlKmCp.js → monaco.contribution-2PozfA9g.js} +2 -2
  103. package/dist/web/assets/{monaco.contribution-BtMcDmCM.js → monaco.contribution-BMAF2bmO.js} +2 -2
  104. package/dist/web/assets/{monaco.contribution-Cac9eBUk.js → monaco.contribution-BSJ2jQTi.js} +2 -2
  105. package/dist/web/assets/{monaco.contribution-NtjNqMdv.js → monaco.contribution-QOOCizYq.js} +2 -2
  106. package/dist/web/assets/{play-DYSQH2rx.js → play-BpCc5ZbR.js} +1 -1
  107. package/dist/web/assets/{python-CNqOWXNv.js → python-BK41iew-.js} +1 -1
  108. package/dist/web/assets/{refresh-cw-DMysDKOA.js → refresh-cw-Csoy1ev1.js} +1 -1
  109. package/dist/web/assets/{save-HPZ4ZiDi.js → save-Dbztj0W7.js} +1 -1
  110. package/dist/web/assets/{square-D-mpY1a-.js → square-ju7fWa0W.js} +1 -1
  111. package/dist/web/assets/{toggleHighContrast-Bccdn3Qi.js → toggleHighContrast-DrmwDpyz.js} +1 -1
  112. package/dist/web/assets/{tsMode-BhcKJxhG.js → tsMode-CFgCMr7d.js} +1 -1
  113. package/dist/web/assets/{upload-DE7xaWVj.js → upload-C5nhiSMq.js} +1 -1
  114. package/dist/web/assets/{useLocalAgentSchedules-C0J--_MD.js → useLocalAgentSchedules-LAsobERb.js} +1 -1
  115. package/dist/web/assets/{wifi-off-CrCfhll9.js → wifi-off-BHxh2UbA.js} +1 -1
  116. package/dist/web/assets/{workers-DCaGzukk.js → workers-FKb-NyBI.js} +1 -1
  117. package/dist/web/assets/{yaml-CCfH63KB.js → yaml-C5DbF9S6.js} +1 -1
  118. package/dist/web/index.html +2 -2
  119. package/package.json +1 -1
  120. package/dist/api/vercel-protection.d.ts +0 -1
  121. package/dist/chunks/chunk-MLWNI3WG.js +0 -15395
  122. package/dist/web/assets/App-D7vhbyMO.js +0 -171
  123. package/dist/web/assets/LabModelVersionDetailPage-D2PfI3-r.js +0 -1
  124. package/dist/web/assets/LabsRoute-VOgPrf94.js +0 -2
  125. package/dist/web/assets/SettingsView-CWTAUy2b.js +0 -6
  126. package/dist/web/assets/chevron-up-C8-qSzck.js +0 -1
  127. package/dist/web/assets/index-AzqEDIEY.css +0 -1
  128. package/dist/web/assets/index-C5uP_Gug.js +0 -1
@@ -1,6 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./UsageSettingsSection-B3sbqaUV.js","./index-DqWw2ymf.js","./index-AzqEDIEY.css","./App-D7vhbyMO.js","./arrow-up-right-DaIxkG4K.js","./activity-BzKyRXbd.js","./CartesianChart-CnerMhTr.js","./index-C5uP_Gug.js","./UsageSettingsSection-Csg3diiE.css"])))=>i.map(i=>d[i]);
2
- import{j as e,r,_ as mn}from"./index-DqWw2ymf.js";import{c as he,am as is,X as oe,an as rs,ao as Bs,ap as pn,aq as gn,ar as xn,as as fn,at as jn,o as M,au as bn,av as Hs,aw as vn,ax as Qe,ay as _s,az as yn,aA as Nn,aB as wn,J as Fs,s as Ue,aC as Sn,t as Cn,K as Te,d as os,aD as Ze,aE as Fe,a4 as kn,C as Pn,aF as Ie,G as Xe,aG as Rn,i as Le,aH as le,aI as An,aJ as es,aK as ss,aL as Gs,A as Dn,aj as qs,aM as $n,af as ms,B as En,a as Vs,aN as In,aO as Mn,p as On,H as ns,W as Ge,aP as ye,a7 as Tn,aQ as Ln,aR as zn,aS as Un,aT as Bn,aU as Hn}from"./App-D7vhbyMO.js";import{P as fe,D as De,T as Se,a as Ws,B as Be,W as _n,A as Fn,C as Gn}from"./chat-file-links-wORSEipQ.js";import{R as ie}from"./refresh-cw-DMysDKOA.js";/* empty css */import{S as cs}from"./save-HPZ4ZiDi.js";import{F as Ks}from"./folder-open-KtKTXn4w.js";import{C as qn}from"./chevron-up-C8-qSzck.js";import{P as Js}from"./play-DYSQH2rx.js";import{B as Vn,a as Ys,W as Wn,S as Kn}from"./wifi-off-CrCfhll9.js";import{R as He,u as Jn}from"./useLocalAgentSchedules-C0J--_MD.js";import{C as je}from"./cloud-upload-BYXHJoKd.js";import{G as ze}from"./git-commit-horizontal-CmVYsUnh.js";import{r as Yn}from"./index-C5uP_Gug.js";import{F as Qn}from"./folder-plus-9-Xcli22.js";import{A as Zn}from"./AppDialog-sLTPiFGX.js";import{C as Qs,W as Xn}from"./WorkspaceDiffPanel-CBgPVF1P.js";import"./MarkdownText-B3njGyZS.js";import"./desktop-files-BQj1J-ob.js";import"./training-model-data-CKOkpBBL.js";import"./info-BLmP4K0e.js";import"./minimize-2-CWA6iO3r.js";import"./clipboard-BTRsPPaK.js";const et=[["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"}]],st=he("clipboard-copy",et);const nt=[["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"}]],tt=he("eye",nt);const at=[["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"}]],lt=he("hard-drive",at);const it=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ge=he("key-round",it);const rt=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],ot=he("power",rt);const ct=[["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"}]],Zs=he("radio-tower",ct);const dt=[["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"}]],ut=he("rotate-cw",dt);const ht=[["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"}]],mt=he("sliders-horizontal",ht);const pt=[["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"}]],ps=he("circle-user",pt);function gs({handle:s,image:n}){const a=s?.trim().slice(0,1).toUpperCase()||"+";return e.jsx("div",{className:"account-avatar",children:n?e.jsx("img",{src:n,alt:""}):e.jsx("span",{children:a})})}function qe({state:s,label:n}){return e.jsx("span",{className:`account-state ${s}`,children:n??s.replace("_"," ")})}const ts="https://openpond.ai",as="https://api.openpond.ai";function gt(s,n){return s==="connect"?{handle:void 0,currentBaseUrl:null}:{handle:n?.handle,currentBaseUrl:n?.baseUrl??null}}function xs(s,n){const a=n.trim().replace(/\/+$/,"");if(!a)throw new Error(`${s} is required.`);try{const t=new URL(a);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("unsupported protocol")}catch{throw new Error(`${s} must be an absolute http or https URL.`)}return a}function fs({account:s,busy:n,initialApiKey:a="",mode:t="update",onClose:l,onSave:i}){const d=r.useId(),c=t==="connect",[u,g]=r.useState(a),[o,h]=r.useState(!1),[m,x]=r.useState(s?.baseUrl??ts),[f,v]=r.useState(s?.apiBaseUrl??as),[S,C]=r.useState(null),[k,P]=r.useState(null);is(k),r.useEffect(()=>{g(a),h(!1),x(s?.baseUrl??ts),v(s?.apiBaseUrl??as),C(null),P(null)},[s?.apiBaseUrl,s?.baseUrl,s?.handle,a]);async function R(y){y.preventDefault(),C(null),P(null);const A=u.trim();if(c&&!A){C("API key is required.");return}let O,$;try{O=xs("Base URL",m),$=xs("API base URL",f)}catch(p){C(p instanceof Error?p.message:String(p));return}try{const p=gt(t,s);await i({...p,baseUrl:O,apiBaseUrl:$,apiKey:c?A:void 0,environment:xt(O,$)})}catch(p){P(p instanceof Error?p.message:String(p))}}return e.jsx("div",{className:"git-dialog-backdrop account-endpoint-dialog-backdrop",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&!n&&l()},children:e.jsxs("form",{className:"git-dialog account-endpoint-dialog",role:"dialog","aria-modal":"true","aria-labelledby":d,onSubmit:y=>{R(y)},children:[e.jsx("button",{className:"git-dialog-close",disabled:n,type:"button",title:"Close","aria-label":"Close",onClick:l,children:e.jsx(oe,{size:16})}),e.jsx("div",{className:"git-dialog-icon",children:c?e.jsx(ge,{size:18}):e.jsx(rs,{size:18})}),e.jsx("h2",{id:d,children:c?"Add account":"Account environment"}),c?e.jsx("p",{children:"Enter your OpenPond API key to connect another account."}):e.jsx("p",{children:"Update the web and API endpoints used by this account."}),c?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"API key"}),e.jsx("input",{autoFocus:!0,disabled:n,placeholder:"opk_...",type:"password",value:u,onChange:y=>g(y.target.value)})]}):null,c?e.jsxs("label",{className:"git-dialog-toggle account-dialog-advanced-toggle",children:[e.jsx("input",{checked:o,disabled:n,type:"checkbox",onChange:y=>h(y.target.checked)}),e.jsx("span",{}),"Advanced"]}):null,!c||o?e.jsxs("div",{className:"account-dialog-advanced-fields",children:[e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Base URL"}),e.jsx("input",{autoFocus:!c,disabled:n,inputMode:"url",value:m,onChange:y=>x(y.target.value)})]}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"API base URL"}),e.jsx("input",{disabled:n,inputMode:"url",value:f,onChange:y=>v(y.target.value)})]})]}):null,S?e.jsx("div",{className:"profile-dialog-warning",children:S}):null,e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:n,type:"button",onClick:l,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:n,type:"submit",children:[e.jsx(cs,{size:14}),e.jsx("span",{children:n?"Saving":c?"Connect account":"Update account"})]})]})]})})}function xt(s,n){return s===ts&&n===as?"production":"custom"}const ft="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 jt({payload:s,connection:n,saving:a,refreshingAccounts:t,saveAccount:l,refreshAccounts:i,switchAccount:d,removeAccount:c,onPayload:u,onPreferences:g,onError:o,onToast:h}){const m=s?.account,x=m?.state??"loading",f=x==="signed_in",v=x==="signed_out",S=x==="auth_error",C=m?.email?.trim()||null,k=m?.accounts??[],[P,R]=r.useState([]),[,y]=r.useState(!1),[A,O]=r.useState(null),[$,p]=r.useState(null),[N,b]=r.useState(null),[j,T]=r.useState(null),[H,F]=r.useState(!1),[V,Z]=r.useState(null),{confirmAction:E,confirmDialog:U,resolveConfirmDialog:J}=Bs(),Y=k.find(I=>I.isActive)??k[0]??null,W=s?.preferences.defaultTeamId?.trim()||null,re=N??W,G=pn(m),_=s?.accountMeta.asOf??"",se=Ae(m?.environment,Y?.environment),ae=f?Ae(Y?.displayLabel,Y?.handle,m?.label,m?.activeProfile?.handle,"Signed in"):S?"Account needs attention":v?"No account connected":"Loading account",ue=f?C??js(se):S?"Not connected":v?"Cloud projects, hosted agents, and team defaults are disabled until you sign in.":"Checking account status.",ce=k.length>0,X=S?bt(m?.error):null,Q=r.useMemo(()=>P.filter(I=>I.status==="active"),[P]),L=(r.useMemo(()=>re?Q.find(I=>I.teamId===re)??null:null,[Q,re])??gn(Q))?.teamId??"",w=r.useMemo(()=>Q.map(I=>({value:I.teamId,label:Ae(I.displayName,I.name,I.slug,"Team"),description:xn(I.role)})),[Q]),D=L||w[0]?.value||"",z=w.length>0,B=!n||!!$||!!A||Q.length===0,te=j?Ve(j):null,K=!!(te&&V===te),Re=f||S;r.useEffect(()=>{if(!n||!G){R([]),O(null),y(!1);return}let I=!1;const ee=fn(G);return ee?(R(ee),y(!1)):(R([]),y(!0)),O(null),jn({accountKey:G,force:!!_,fetchOrganizations:async()=>(await M.organizations(n)).organizations.map(bn).filter(ne=>!!ne).filter(ne=>ne.status==="active")}).then(q=>{I||R(q)}).catch(q=>{I||(ee||R([]),O(q instanceof Error?q.message:String(q)))}).finally(()=>{I||y(!1)}),()=>{I=!0}},[_,n,G]),r.useEffect(()=>{N&&W===N&&b(null)},[W,N]);async function on(I,ee={notify:!0}){const q=Q.find(ne=>ne.teamId===I)??null;if(!(!n||!q||$||(N??W)===q.teamId)){b(q.teamId),p(q.teamId),o(null),vn({teamId:q.teamId,accountKey:G,force:!0,fetchAgents:async ne=>(await M.listSandboxAgents(n,{teamId:ne})).agents}).catch(()=>{});try{g(await M.savePreferences(n,{defaultTeamId:q.teamId})),ee.notify&&h?.("Default team updated","success")}catch(ne){b(null),o(ne instanceof Error?ne.message:String(ne))}finally{p(null)}}}async function _e(I="Continue"){return Re?E({title:"Change active OpenPond account?",body:ft,confirmLabel:I,cancelLabel:"Cancel"}):!0}async function cn(I){await _e("Save account")&&(await l({apiKey:I.apiKey??"",handle:I.handle,baseUrl:I.baseUrl,apiBaseUrl:I.apiBaseUrl,environment:I.environment}),F(!1))}async function dn(I){if(!n||!j)throw new Error("OpenPond server connection is not ready.");if(j.isActive&&!await _e("Save endpoints"))return;const ee=Ve(j);Z(ee),o(null);try{const q=await M.updateOpenPondAccountConfig(n,{handle:I.handle??j.handle,currentBaseUrl:I.currentBaseUrl,baseUrl:I.baseUrl,apiBaseUrl:I.apiBaseUrl,chatApiBaseUrl:null,environment:vt(I.environment),setActive:j.isActive});u(q),h?.("Account endpoints updated","success"),T(null)}catch(q){throw o(q instanceof Error?q.message:String(q)),q}finally{Z(null)}}async function un(I){const ee=I.handle?.trim()||"";ee&&await _e("Switch account")&&await d(ee,I.baseUrl)}async function hn(I){const ee=I.handle?.trim()||"";if(!ee||I.isActive)return;const q=Ae(I.displayLabel,I.email,I.handle,"this account");await E({title:"Remove saved account?",body:`Remove ${q} 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 c(ee,I.baseUrl)&&h?.("Account removed","success")}return e.jsxs("section",{className:"account-settings",children:[e.jsxs("div",{className:"account-settings-title",children:[e.jsx("h1",{children:"Account"}),e.jsxs("div",{className:"account-settings-title-actions",children:[e.jsxs("button",{className:"settings-secondary compact account-add-action",disabled:!n||a,type:"button",onClick:()=>F(!0),children:[e.jsx(fe,{size:14}),e.jsx("span",{children:"Add account"})]}),e.jsx("button",{className:"settings-icon-button ghost",disabled:!n||a||t,title:"Refresh accounts and team data","aria-label":"Refresh accounts and team data",type:"button",onClick:()=>{i()},children:e.jsx(ie,{size:15,className:t?"settings-spin":void 0})})]})]}),e.jsxs("div",{className:"account-summary",children:[e.jsxs("div",{className:"account-summary-main",children:[e.jsx(gs,{handle:ae,image:f?m?.avatarUrl??Y?.avatarUrl??null:null}),e.jsxs("div",{children:[e.jsx("span",{children:"Active account"}),e.jsx("strong",{children:ae}),e.jsxs("div",{className:"account-summary-meta",children:[e.jsx("small",{className:f&&C?"private-account-email":f?void 0:"account-summary-copy",tabIndex:f&&C?0:void 0,children:ue}),f&&z?e.jsx(De,{className:"account-team-dropdown",compact:!0,disabled:B,label:"Default team",options:w,value:D,onChange:I=>{on(I)}}):null]})]})]}),e.jsx("div",{className:"account-summary-actions",children:e.jsx(qe,{state:x,label:v?"not signed in":void 0})})]}),ce?e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"OpenPond accounts"}),e.jsxs("small",{children:[k.length," account",k.length===1?"":"s"]})]}),e.jsx("p",{className:"account-list-note",children:"Switch to another account before removing the active account."}),k.map(I=>{const ee=I.handle?.trim()||"",q=Ae(I.displayLabel,I.handle,"Unknown account"),ne=I.email?.trim()||null,hs=Ve(I);return e.jsxs("div",{className:"account-row",children:[e.jsx(gs,{handle:q,image:I.avatarUrl??null}),e.jsxs("div",{className:"account-details",children:[e.jsx("strong",{children:q}),ne?e.jsx("span",{className:"private-account-email",tabIndex:0,children:ne}):null,e.jsx("span",{children:js(I.environment??"production")})]}),e.jsxs("div",{className:"account-row-actions",children:[e.jsx(qe,{state:I.authHealth}),I.isActive?e.jsx("span",{className:"active-pill",children:"Active"}):null,e.jsx("button",{className:"settings-icon-button ghost account-endpoint-action",disabled:!n||a||!!V||!ee,type:"button","aria-label":`Configure ${q} environment`,title:"Configure account environment",onClick:()=>T(I),children:e.jsx(rs,{size:15})}),I.isActive?null:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"inline-action",disabled:a||!ee,type:"button",onClick:()=>{un(I)},children:"Use"}),e.jsx("button",{className:"inline-action danger account-remove-action",disabled:a||!ee,type:"button","aria-label":`Remove ${q}`,title:`Remove ${q}`,onClick:()=>{hn(I)},children:e.jsx(Se,{size:13})})]})]})]},hs)})]}):null,m?.products&&m.products.length>0&&e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Products"}),e.jsxs("small",{children:[m.products.length," active"]})]}),m.products.map(I=>e.jsxs("div",{className:"product-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:I.name}),e.jsx("span",{children:I.type})]}),e.jsx(qe,{state:I.status})]},I.id))]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:s?.server.runtimeVersion??"Runtime loading"}),e.jsx("strong",{children:n?.serverUrl??"loading"})]}),X?e.jsxs("div",{className:"settings-footnote warning account-error-footnote",children:[e.jsx("span",{children:"Account error"}),e.jsx("strong",{children:X})]}):null,j?e.jsx(fs,{account:j,busy:K,onClose:()=>{K||T(null)},onSave:dn}):null,H?e.jsx(fs,{busy:a,mode:"connect",onClose:()=>{a||F(!1)},onSave:cn}):null,e.jsx(Hs,{state:U,onResolve:J})]})}function Ve(s){return`${s.handle.trim().toLowerCase()}|${s.baseUrl??"default"}`}function Ae(...s){for(const n of s){const a=n?.trim();if(a)return a}return""}function bt(s){const n=s?.trim();if(!n)return null;const a=n.toLowerCase();return a.includes("protected deployment")||a.includes("vercel_auth_enabled")?"Staging is protected by Vercel. Restart OpenPond after signing in to Vercel, then try again.":a.includes("unexpected token '<'")||a.includes("<!doctype")||a.includes("vercel.com/sso-api")?"OpenPond received a web login page instead of account data. Restart after signing in to Vercel, then try again.":a.includes("401")||a.includes("unauthorized")||a.includes("could not authenticate")?"The API key could not authenticate. Check the key and account environment, then try again.":n.length>220?`${n.slice(0,217)}...`:n}function js(s){const n=s.trim().toLowerCase();return!n||n==="production"?"Production":"Environment"}function vt(s){const n=s?.trim();return!n||n.toLowerCase()==="production"?"custom":n}function yt({advancedWorkspaceControls:s,defaultBranchPrefix:n,defaultNewProjectDirectory:a,preferences:t,saving:l,chooseDefaultProjectDirectory:i,saveDefaults:d,setAdvancedWorkspaceControls:c,setDefaultBranchPrefix:u,setDefaultNewProjectDirectory:g}){const o=Qe(n)===t.defaultBranchPrefix&&a.trim()===t.defaultNewProjectDirectory&&s===t.advancedWorkspaceControls;return e.jsxs("section",{className:"account-settings",children:[e.jsx("h1",{children:"Defaults"}),e.jsxs("form",{className:"provider-settings-form",onSubmit:h=>{d(h)},children:[e.jsxs("label",{className:"settings-check-row",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:l,onChange:h=>c(h.target.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:"Show advanced Git controls"}),e.jsx("small",{children:"Show branch, commit, and push controls for local project workflows."})]})]}),e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Git branches"}),e.jsx("small",{children:"Used for advanced and non-managed branch creation"})]}),e.jsx("div",{className:"provider-settings-grid single",children:e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Branch prefix"}),e.jsx("input",{value:n,disabled:l,placeholder:"feat/",onChange:h=>u(h.target.value)})]})}),e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Projects"}),e.jsx("small",{children:"Used when starting a new local project from scratch"})]}),e.jsxs("div",{className:"settings-path-row",children:[e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"New project directory"}),e.jsx("input",{value:a,disabled:l,placeholder:"~/Documents/OpenPond Projects",onChange:h=>g(h.target.value)})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:l,onClick:()=>{i()},children:[e.jsx(Ks,{size:14}),e.jsx("span",{children:"Browse"})]})]}),e.jsx("button",{className:"settings-primary",disabled:l||o,children:e.jsx("span",{children:l?"Saving":"Save defaults"})})]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:"Initial branch name"}),e.jsxs("strong",{children:[Qe(n),"example-project"]})]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:"New projects"}),e.jsx("strong",{children:a||t.defaultNewProjectDirectory})]})]})}function Nt({diagnostics:s,diagnosticsAvailable:n,diagnosticsBusy:a,diagnosticsStatus:t,logDir:l,logLineLimit:i,logLines:d,logViewBusy:c,logViewSummary:u,logViewportRef:g,tailLogs:o,copyRecentLogs:h,exportDiagnosticsBundle:m,loadOlderLogs:x,openLogsFolder:f,refreshLogView:v,toggleTailLogs:S}){const C=s.filter(P=>P.name==="diagnostic"&&P.status==="failed").slice().reverse().map(wt),k=typeof window>"u"?void 0:window.openpond;return e.jsxs("section",{className:"account-settings",children:[e.jsx("h1",{children:"Diagnostics"}),e.jsxs("div",{className:"diagnostics-log-panel",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Recent errors"}),e.jsxs("small",{children:[C.length," saved"]})]}),e.jsx("div",{className:"diagnostics-error-list",role:"list",children:C.length===0?e.jsx("div",{className:"diagnostics-error-empty",children:"No saved errors"}):C.map(P=>e.jsxs("article",{className:"diagnostics-error-entry",role:"listitem",children:[e.jsx(_s,{size:15}),e.jsxs("div",{className:"diagnostics-error-body",children:[e.jsxs("div",{className:"diagnostics-error-title",children:[e.jsx("strong",{children:P.message}),e.jsx("time",{dateTime:P.timestamp,children:P.timeLabel})]}),e.jsxs("div",{className:"diagnostics-error-meta",children:[e.jsx("span",{children:P.surface}),P.status?e.jsx("span",{children:P.status}):null,P.sequence?e.jsxs("span",{children:["#",P.sequence]}):null]}),P.detail?e.jsxs("details",{className:"diagnostics-error-detail",children:[e.jsx("summary",{children:"Details"}),e.jsx("pre",{children:P.detail})]}):null]})]},P.id))})]}),e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Logs"}),e.jsx("small",{children:n?"Desktop":"Unavailable"})]}),e.jsxs("div",{className:"product-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Logs folder"}),e.jsx("span",{children:"Desktop and server logs"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:a!==null||!k?.openLogsFolder,onClick:()=>{f()},children:[e.jsx(Ks,{size:15}),e.jsx("span",{children:a==="logs"?"Opening":"Open"})]})]}),e.jsxs("div",{className:"product-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Diagnostics export"}),e.jsx("span",{children:"Support folder with diagnostics.txt"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:a!==null||!k?.exportDiagnostics,onClick:()=>{m()},children:[e.jsx(yn,{size:15}),e.jsx("span",{children:a==="export"?"Exporting":"Export"})]})]}),e.jsxs("div",{className:"product-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Recent logs"}),e.jsx("span",{children:"Last 1000 lines to clipboard"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:a!==null||!k?.copyRecentLogs,onClick:()=>{h()},children:[e.jsx(st,{size:15}),e.jsx("span",{children:a==="copy"?"Copying":"Copy"})]})]})]}),e.jsxs("div",{className:"diagnostics-log-panel",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Log view"}),e.jsxs("div",{className:"settings-heading-actions diagnostics-log-actions",children:[e.jsx("small",{children:u}),e.jsx("button",{type:"button",className:`settings-icon-button ${o?"active":""}`,title:o?"Pause tail":"Tail logs","aria-label":o?"Pause tail":"Tail logs",disabled:!k?.readRecentLogs,onClick:S,children:o?e.jsx(Ws,{size:15}):e.jsx(Js,{size:15})}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Refresh logs","aria-label":"Refresh logs",disabled:c!==null||!k?.readRecentLogs,onClick:()=>{v(i,"refresh")},children:e.jsx(ie,{size:15})}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:c!==null||!k?.readRecentLogs,onClick:x,children:[e.jsx(qn,{size:15}),e.jsx("span",{children:c==="older"?"Loading":"Older"})]})]})]}),e.jsx("div",{ref:g,className:"diagnostics-log-viewer",role:"log","aria-live":o?"polite":"off",children:d.length===0?e.jsx("div",{className:"diagnostics-log-empty",children:c?"Loading logs":"No log lines"}):d.map((P,R)=>e.jsxs("div",{className:"diagnostics-log-entry",children:[e.jsx("span",{className:"diagnostics-log-source",children:P.file}),e.jsx("code",{children:P.line})]},`${P.file}:${P.timestamp}:${P.index}:${R}`))}),l&&e.jsxs("div",{className:"diagnostics-log-dir",children:[e.jsx("span",{children:"Source"}),e.jsx("strong",{children:l})]})]}),t&&e.jsxs("div",{className:`settings-footnote ${t.warning?"warning":""}`,children:[e.jsx("span",{children:t.label}),e.jsx("strong",{children:t.value})]})]})}function wt(s){const n=bs(s.data),a=bs(n.context),l=xe(n.stack)??xe(n.detail)??xe(a.detail)??null;return{id:s.id,timestamp:s.timestamp,timeLabel:Ct(s.timestamp),message:St(s,n),surface:xe(n.surface)??s.source??"diagnostic",status:s.status??null,sequence:s.sequence??null,detail:l}}function St(s,n){return xe(s.error)??xe(s.output)??xe(n.message)??xe(n.error)??"Diagnostic event"}function Ct(s){const n=new Date(s);return Number.isNaN(n.getTime())?s:n.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function bs(s){return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}function xe(s){return typeof s=="string"&&s.trim()?s.trim():null}const vs=[{id:"typescript",label:"TypeScript",placeholder:"typescript-language-server"},{id:"python",label:"Python",placeholder:"pyright-langserver"},{id:"rust",label:"Rust",placeholder:"rust-analyzer"}];function kt({editorPreferences:s,lspStatus:n,preferences:a,restarting:t,saving:l,statusLoading:i,refreshLspStatus:d,restartLanguageServers:c,saveEditorSettings:u,setEditorPreferences:g,setLanguageCustomCommand:o,setLanguageMode:h}){const m=JSON.stringify(s)!==JSON.stringify(a.editor),x=new Map(n?.languages.map(f=>[f.language,f])??[]);return e.jsxs("section",{className:"account-settings",children:[e.jsx("h1",{children:"Editor"}),e.jsxs("form",{className:"provider-settings-form editor-settings-form",onSubmit:f=>{u(f)},children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Language servers"}),e.jsx("small",{children:"Local tools"})]}),e.jsx("div",{className:"provider-settings-grid single",children:e.jsxs("div",{className:"settings-select-field",children:[e.jsx("span",{children:"Language servers"}),e.jsx(De,{value:s.languageServers,disabled:l,label:"Language servers",options:Nn,onChange:f=>g(v=>({...v,languageServers:f}))})]})}),e.jsxs("label",{className:"settings-check-row",children:[e.jsx("input",{type:"checkbox",checked:s.diagnosticsWhileEditing,disabled:l||s.languageServers==="off",onChange:f=>g(v=>({...v,diagnosticsWhileEditing:f.target.checked}))}),e.jsxs("span",{children:[e.jsx("strong",{children:"Diagnostics while editing"}),e.jsx("small",{children:"Update Monaco markers as the local buffer changes."})]})]}),e.jsxs("label",{className:"settings-check-row",children:[e.jsx("input",{type:"checkbox",checked:s.checkOnSave,disabled:l||s.languageServers==="off",onChange:f=>g(v=>({...v,checkOnSave:f.target.checked}))}),e.jsxs("span",{children:[e.jsx("strong",{children:"Check on save"}),e.jsx("small",{children:"Refresh diagnostics after writing a file."})]})]}),e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Languages"}),e.jsx("small",{children:"Auto, disabled, or custom executable"})]}),e.jsx("div",{className:"lsp-language-list",children:vs.map(f=>{const v=s.languages[f.id];return e.jsxs("div",{className:"lsp-language-row",children:[e.jsxs("div",{className:"lsp-language-label",children:[e.jsx("strong",{children:f.label}),e.jsx("span",{children:ys(x.get(f.id),i)})]}),e.jsxs("div",{className:"settings-select-field",children:[e.jsx("span",{children:"Mode"}),e.jsx(De,{value:v.mode,disabled:l||s.languageServers==="off",label:`${f.label} language server mode`,options:wn,onChange:S=>h(f.id,S)})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Custom executable"}),e.jsx("input",{value:v.customCommand,disabled:l||s.languageServers==="off"||v.mode!=="custom",placeholder:f.placeholder,onChange:S=>o(f.id,S.target.value)})]})]},f.id)})}),e.jsx("button",{className:"settings-primary",disabled:l||!m,children:e.jsx("span",{children:l?"Saving":"Save editor settings"})})]}),e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"LSP status"}),e.jsxs("div",{className:"settings-heading-actions",children:[e.jsx("small",{children:i?"Checking":n?"Current":"Not checked"}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Refresh LSP status","aria-label":"Refresh LSP status",disabled:i||t,onClick:()=>{d()},children:e.jsx(ie,{className:i?"settings-spin":void 0,size:15})}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:i||t,onClick:()=>{c()},children:[e.jsx(ut,{className:t?"settings-spin":void 0,size:15}),e.jsx("span",{children:t?"Restarting":"Restart"})]})]})]}),vs.map(f=>{const v=x.get(f.id);return e.jsxs("div",{className:"product-row lsp-status-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:f.label}),e.jsx("span",{title:v?.command??v?.message??void 0,children:v?.command??v?.message??"Not checked"})]}),e.jsx("span",{className:`lsp-status-pill ${v?.status??"missing"}`,children:ys(v,i)})]},f.id)})]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:"Project config"}),e.jsx("strong",{children:"Uses tsconfig, pyrightconfig, pyproject, and Cargo files when present"})]})]})}function ys(s,n){return n&&!s?"Checking":s?s.status==="found"?"Found":s.status==="disabled"?"Disabled":s.status==="error"?"Error":"Missing":"Not checked"}function Ns({contextCompactionAutoEnabled:s,embedded:n=!1,preferences:a,saving:t,saveDefaults:l,setContextCompactionAutoEnabled:i}){return e.jsxs("section",{className:`account-settings${n?" account-settings-embedded":""}`,children:[n?e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Context"}),e.jsx("small",{children:"Compaction defaults for long chats"})]}):e.jsx("h1",{children:"Context"}),e.jsxs("form",{className:"provider-settings-form",onSubmit:d=>{l(d)},children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Compaction"}),e.jsx("small",{children:"Controls automatic compaction for long OpenPond and BYOK chats"})]}),e.jsxs("label",{className:"settings-check-row",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:t,onChange:d=>i(d.target.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:"Auto compact long chats"}),e.jsx("small",{children:"Summarize older turns at 85% context before the selected model runs out. The transcript stays visible."})]})]}),e.jsx("button",{className:"settings-primary",disabled:t||s===a.contextCompaction.autoEnabled,children:e.jsx("span",{children:t?"Saving":"Save context"})})]})]})}function Pt({subagentsEnabled:s,subagentDelegationMode:n,subagentsUseDefaultModel:a,subagentsProvider:t,subagentsModel:l,subagentRoles:i,subagentsMaxConcurrentRuns:d,subagentsMaxConcurrentRunsPerProvider:c,subagentsMaxConcurrentRunsPerWorkspaceTarget:u,preferences:g,providers:o,saving:h,saveDefaults:m,changeSubagentsProvider:x,setSubagentsEnabled:f,setSubagentDelegationMode:v,setSubagentsUseDefaultModel:S,setSubagentsModel:C,setSubagentsMaxConcurrentRuns:k,setSubagentsMaxConcurrentRunsPerProvider:P,setSubagentsMaxConcurrentRunsPerWorkspaceTarget:R,setSubagentRoleEnabled:y,setSubagentRoleIsolationMode:A,setSubagentRoleMaxConcurrentRuns:O,setSubagentRoleModel:$,setSubagentRolePeerMessages:p,setSubagentRoleToolPolicy:N,changeSubagentRoleProvider:b}){const j=Fs(o,{enabledOnly:!0}),T=a?g.defaultChatProvider:t,H=a?g.defaultChatModel:l,F=Xs(Ue(T,o),H),V=a?null:{providerId:t,modelId:l.trim()},Z=Et({enabled:s,delegationMode:n,defaultModelRef:V,roles:i,maxConcurrentRuns:d,maxConcurrentRunsPerProvider:c,maxConcurrentRunsPerWorkspaceTarget:u},g);return e.jsx("section",{className:"account-settings subagents-settings",children:e.jsxs("form",{className:"subagent-settings-form",onSubmit:E=>{m(E)},children:[e.jsxs("div",{className:"subagent-settings-title-row",children:[e.jsx("h1",{children:"Agents"}),e.jsxs("div",{className:"subagent-settings-actions",children:[e.jsx("button",{className:`settings-primary subagent-save-button${Z?"":" dirty"}`,disabled:h||Z,children:e.jsx("span",{children:h?"Saving":"Save agents"})}),e.jsxs("label",{className:"provider-toggle subagent-card-toggle","aria-label":"Allow subagents",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:h,onChange:E=>f(E.target.checked)}),e.jsx("span",{})]})]})]}),e.jsxs("section",{className:"subagent-settings-section",children:[e.jsx("div",{className:"subagent-settings-card-header",children:e.jsxs("div",{children:[e.jsx("span",{children:"Default delegation"}),e.jsx("small",{children:"Used unless a task overrides it from the composer."})]})}),e.jsx("div",{className:"subagent-field-grid two",children:e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Subagent use"}),e.jsxs("select",{value:n,disabled:h||!s,onChange:E=>v(E.target.value),children:[e.jsx("option",{value:"manual",children:"Manual"}),e.jsx("option",{value:"balanced",children:"Balanced"}),e.jsx("option",{value:"proactive",children:"Proactive"})]})]})})]}),e.jsxs("section",{className:"subagent-settings-section",children:[e.jsx("div",{className:"subagent-settings-card-header",children:e.jsx("div",{children:e.jsx("span",{children:"Default model"})})}),e.jsxs("div",{className:"subagent-field-grid two",children:[e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Provider"}),e.jsx("select",{value:T,disabled:h||!s,onChange:E=>{S(!1),x(E.target.value)},children:j.map(E=>e.jsx("option",{value:E.value,children:E.label},E.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Model"}),e.jsx("select",{value:H,disabled:h||!s,onChange:E=>{S(!1),C(E.target.value)},children:F.map(E=>e.jsx("option",{value:E.value,children:E.label},E.value))})]})]})]}),e.jsx("div",{className:"subagent-role-list",children:i.map(E=>{const U=Sn.find(_=>_.id===E.id),J=E.modelRef?.providerId??T,Y=E.modelRef?.modelId||Cn(J,o)||H,W=$t(j,o,{providerId:J,modelId:Y}),re=Oe(J,Y),G=h||!s||!E.enabled;return e.jsxs("section",{className:`subagent-role-row${E.enabled?"":" disabled"}`,children:[e.jsxs("div",{className:"subagent-settings-card-header subagent-role-header",children:[e.jsxs("div",{className:"subagent-role-title",children:[e.jsx("span",{children:U?.label??E.id}),e.jsx("small",{children:U?.description??"Custom subagent role."})]}),e.jsxs("label",{className:"provider-toggle subagent-card-toggle","aria-label":`${U?.label??E.id} enabled`,children:[e.jsx("input",{type:"checkbox",checked:E.enabled,disabled:h||!s,onChange:_=>y(E.id,_.target.checked)}),e.jsx("span",{})]})]}),e.jsxs("div",{className:"subagent-role-controls",children:[e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Model"}),e.jsx("select",{value:re,disabled:G,onChange:_=>{const se=W.find(ae=>ae.value===_.target.value);se&&(b(E.id,se.providerId),$(E.id,se.modelId))},children:W.map(_=>e.jsx("option",{value:_.value,children:_.label},_.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Isolation"}),e.jsx("select",{value:E.isolationMode,disabled:G,onChange:_=>A(E.id,_.target.value),children:Rt.map(_=>e.jsx("option",{value:_.value,children:_.label},_.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Tools"}),e.jsx("select",{value:E.toolPolicy,disabled:G,onChange:_=>N(E.id,_.target.value),children:At.map(_=>e.jsx("option",{value:_.value,children:_.label},_.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Peer messages"}),e.jsx("select",{value:E.peerMessages,disabled:G,onChange:_=>p(E.id,_.target.value),children:Dt.map(_=>e.jsx("option",{value:_.value,children:_.label},_.value))})]})]}),e.jsx("div",{className:"subagent-role-budget-grid",children:e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Role concurrency"}),e.jsx("input",{type:"number",min:1,max:16,value:E.maxConcurrentRuns,disabled:G,onChange:_=>O(E.id,ws(_.target.value,1))})]})})]},E.id)})}),e.jsxs("section",{className:"subagent-settings-section",children:[e.jsx("div",{className:"subagent-settings-card-header",children:e.jsxs("div",{children:[e.jsx("span",{children:"Limits"}),e.jsx("small",{children:"Controls child worker concurrency."})]})}),e.jsxs("div",{className:"subagent-field-grid four",children:[e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Total concurrency"}),e.jsx("input",{type:"number",min:1,max:32,value:d,disabled:h||!s,onChange:E=>k(ws(E.target.value,1))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Per provider"}),e.jsx("input",{type:"number",min:1,max:32,value:c??"",placeholder:"No cap",disabled:h||!s,onChange:E=>P(ls(E.target.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Per workspace"}),e.jsx("input",{type:"number",min:1,max:32,value:u??"",placeholder:"No cap",disabled:h||!s,onChange:E=>R(ls(E.target.value))})]})]})]})]})})}const Rt=[{value:"none",label:"Direct workspace"},{value:"copy_on_write",label:"Copy-on-write"},{value:"worktree",label:"Worktree"}],At=[{value:"read_only",label:"Read only"},{value:"workspace_write",label:"Workspace write"},{value:"full_tools",label:"Full tools"}],Dt=[{value:"parent_scoped",label:"Parent-scoped handoffs"},{value:"disabled",label:"Disabled"}];function Xs(s,n){const a=n.trim();return!a||s.some(t=>t.value===a)?s:[{value:a,label:a},...s]}function Oe(s,n){return JSON.stringify([s,n])}function $t(s,n,a){const t=[];for(const l of s){const i=Xs(Ue(l.value,n),l.value===a.providerId?a.modelId:"");for(const d of i)t.push({value:Oe(l.value,d.value),label:`${l.label} / ${d.label}`,providerId:l.value,modelId:d.value})}return a.modelId&&!t.some(l=>l.value===Oe(a.providerId,a.modelId))&&t.unshift({value:Oe(a.providerId,a.modelId),label:`${Te(a.providerId,n)} / ${a.modelId}`,providerId:a.providerId,modelId:a.modelId}),t}function ls(s){const n=s.trim();if(!n)return null;const a=Number(n);return Number.isFinite(a)?a:null}function ws(s,n){return ls(s)??n}function Et(s,n){const a=n.subagents;return s.enabled===a.enabled&&s.delegationMode===a.delegationMode&&It(s.defaultModelRef,a.defaultModelRef)&&s.maxConcurrentRuns===a.maxConcurrentRuns&&s.maxConcurrentRunsPerProvider===a.maxConcurrentRunsPerProvider&&s.maxConcurrentRunsPerWorkspaceTarget===a.maxConcurrentRunsPerWorkspaceTarget&&JSON.stringify(s.roles)===JSON.stringify(a.roles)}function It(s,n){return(s?.providerId??null)===(n?.providerId??null)&&(s?.modelId??null)===(n?.modelId??null)}const Mt=[{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 Ot({currentUserId:s,enabled:n,mode:a,threads:t,onModeChange:l,onThreadMuteChange:i}){const[d,c]=r.useState(null),[u,g]=r.useState(null);is(u);const o=r.useMemo(()=>t.filter(x=>x.archivedAt===null).map(x=>({thread:x,label:Tt(x,s)})).sort((x,f)=>{const v=+!!f.thread.mutedAt-+!!x.thread.mutedAt;return v!==0?v:x.label.localeCompare(f.label)}),[s,t]),h=o.filter(({thread:x})=>!!x.mutedAt).length,m=r.useCallback(async x=>{c(x.id),g(null),await i(x.id,!x.mutedAt)||g("Could not update this conversation. Try again."),c(null)},[i]);return e.jsxs("section",{className:"account-settings notifications-settings",children:[e.jsx("h1",{children:"Notifications"}),e.jsxs("div",{className:"account-list notification-settings-card",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Team chat notifications"}),e.jsx("small",{children:"In-app alerts"})]}),e.jsx("div",{className:"notification-mode-list",role:"radiogroup","aria-label":"Notify me about",children:Mt.map(x=>e.jsxs("label",{className:`notification-mode-option${a===x.mode?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"team-chat-notification-mode",checked:a===x.mode,onChange:()=>l(x.mode)}),e.jsxs("span",{children:[e.jsx("strong",{children:x.label}),e.jsx("small",{children:x.detail})]})]},x.mode))})]}),e.jsxs("div",{className:"account-list notification-settings-card",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Conversation overrides"}),e.jsx("small",{children:h===1?"1 muted":`${h} muted`})]}),n?o.length===0?e.jsx("div",{className:"empty-account-list",children:e.jsx("span",{children:"Open a Team Chat conversation to manage it here."})}):o.map(({thread:x,label:f})=>{const v=!!x.mutedAt,S=d===x.id;return e.jsxs("div",{className:"notification-thread-row",children:[e.jsx("span",{className:`notification-thread-icon${v?" muted":""}`,children:v?e.jsx(Vn,{size:15}):e.jsx(Ys,{size:15})}),e.jsxs("span",{className:"notification-thread-copy",children:[e.jsx("strong",{children:f}),e.jsx("small",{children:v?"Muted":"Uses the team chat setting"})]}),e.jsx("button",{type:"button",className:"settings-secondary",disabled:d!==null,onClick:()=>{m(x)},children:S?"Saving":v?"Unmute":"Mute"})]},x.id)}):e.jsx("div",{className:"empty-account-list",children:e.jsx("span",{children:"Connect a team to manage conversation overrides."})})]}),e.jsx("div",{className:"settings-footnote",children:e.jsx("span",{children:"Muted conversations never show alerts. Unread counts remain available."})})]})}function Tt(s,n){return s.kind==="general"||s.kind==="channel"?`#${s.title?.trim()||"general"}`:s.kind==="dm"?s.participants.find(a=>a.userId!==n)?.name??s.title?.trim()??"Direct message":s.title?.trim()||s.participants.filter(a=>a.userId!==n).map(a=>a.name).join(", ")||"Group conversation"}function Lt({canSaveCurrentTemplate:s,personalizationTemplateId:n,personalizationTemplateOptions:a,saveAsNewOpen:t,saving:l,selectedPersonalizationTemplate:i,selectedTemplateIsCustom:d,soulDraft:c,templateNameDraft:u,changePersonalizationTemplate:g,changeSoulDraft:o,openSaveAsNew:h,resetPersonalizationDraft:m,savePersonalization:x,setSaveAsNewOpen:f,setTemplateNameDraft:v}){function S(C){C.preventDefault(),x(t)}return e.jsxs("section",{className:"account-settings",children:[e.jsx("h1",{children:"Personalization"}),e.jsxs("form",{className:"provider-settings-form personalization-form",onSubmit:S,children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Agent style"}),e.jsx("div",{className:"settings-heading-actions",children:t?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"settings-heading-input",value:u,onChange:C=>v(C.target.value),placeholder:"Name","aria-label":"Template name"}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Cancel","aria-label":"Cancel",disabled:l,onClick:()=>f(!1),children:e.jsx(oe,{size:15})}),e.jsx("button",{type:"button",className:"settings-icon-button primary",title:"Save new template","aria-label":"Save new template",disabled:l||!c.trim()||!u.trim(),onClick:()=>{x(!0)},children:e.jsx(os,{size:15})})]}):e.jsxs(e.Fragment,{children:[e.jsx("small",{children:d?"Custom template":"Built-in template"}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Save as new","aria-label":"Save as new",disabled:l||!i||!c.trim(),onClick:h,children:e.jsx(fe,{size:15})})]})})]}),e.jsx("div",{className:"provider-settings-grid single",children:e.jsxs("div",{className:"settings-select-field",children:[e.jsx("span",{children:"Template"}),e.jsx(De,{value:n,disabled:l||a.length===0,label:"Personalization template",options:a,onChange:C=>{g(C)}})]})}),e.jsxs("label",{className:"settings-select-field personalization-editor",children:[e.jsx("span",{children:"SOUL.md"}),e.jsx("textarea",{value:c,onChange:C=>o(C.target.value),spellCheck:!1})]}),e.jsxs("div",{className:"settings-button-row",children:[e.jsx("button",{type:"button",className:"settings-icon-button",title:"Reset to template","aria-label":"Reset to template",disabled:l||!i,onClick:m,children:e.jsx(He,{size:15})}),d&&e.jsx("button",{className:"settings-icon-button primary",title:"Save template","aria-label":"Save template",disabled:l||!s,children:e.jsx(cs,{size:15})})]})]})]})}function zt({connection:s,profile:n,selectedDefaultTeamId:a}){const t=Jn(s),l=Ht(t.schedules);return is(t.error,{prefix:"Local schedules"}),e.jsxs("div",{className:"account-list profile-agent-list","aria-label":"Profile agents",children:[e.jsx("div",{className:"account-list-heading profile-agent-list-heading",children:e.jsx("span",{children:"Agents"})}),e.jsx("div",{className:"profile-table-frame",children:e.jsxs("table",{className:"profile-data-table profile-agent-table","aria-label":"Profile agents table",children:[e.jsxs("colgroup",{children:[e.jsx("col",{className:"profile-agent-column"}),e.jsx("col",{className:"profile-action-column"}),e.jsx("col",{className:"profile-check-column"}),e.jsx("col",{className:"profile-sync-column"})]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Agent"}),e.jsx("th",{scope:"col",children:"Action"}),e.jsx("th",{scope:"col",children:"Check"}),e.jsx("th",{scope:"col",children:"Sync"})]})}),e.jsxs("tbody",{children:[l.active.map(i=>e.jsx(Ss,{pending:t.pendingScheduleIds.has(i.id),schedule:i,refreshing:t.loading,onRefresh:()=>{t.refresh()},onRun:()=>{t.run(i)},onToggle:()=>{t.toggle(i)}},i.id)),e.jsx(Ut,{}),n.agents.map(i=>e.jsx(Bt,{agent:i,defaultAction:n.summary.defaultAction,profile:n,selectedDefaultTeamId:a},i.id)),l.paused.map(i=>e.jsx(Ss,{pending:t.pendingScheduleIds.has(i.id),schedule:i,refreshing:t.loading,onRefresh:()=>{t.refresh()},onRun:()=>{t.run(i)},onToggle:()=>{t.toggle(i)}},i.id))]})]})})]})}function Ut(){return e.jsxs("tr",{className:"profile-agent-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(Be,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:"Dataset Builder"}),e.jsx("span",{children:"Built in · every Profile"})]})]})}),e.jsx("td",{children:e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{children:"Design · Materialize · Test"})})}),e.jsx("td",{children:e.jsx($e,{status:{state:"ready",label:"Ready"}})}),e.jsx("td",{children:e.jsx($e,{status:{state:"ready",label:"Built in"}})})]})}function Bt({agent:s,defaultAction:n,profile:a,selectedDefaultTeamId:t}){const l=Gt(a,s,t);return e.jsxs("tr",{className:"profile-agent-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(Be,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:s.name}),e.jsx("span",{title:s.path,children:s.path})]})]})}),e.jsx("td",{children:e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{children:n??"None"})})}),e.jsx("td",{children:e.jsx($e,{status:l.check})}),e.jsx("td",{children:e.jsx($e,{status:l.sync})})]})}function Ss({pending:s,refreshing:n,schedule:a,onRefresh:t,onRun:l,onToggle:i}){const d=_t(a),c=a.enabled?"Pause schedule":"Resume schedule";return e.jsxs("tr",{className:"profile-agent-row profile-schedule-agent-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(Be,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:a.localProjectName}),e.jsxs("span",{title:a.scheduleName,children:["schedule: ",a.scheduleName]})]})]})}),e.jsx("td",{children:e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{title:a.targetAction,children:a.targetAction})})}),e.jsx("td",{children:e.jsx($e,{status:d})}),e.jsx("td",{children:e.jsxs("div",{className:"profile-schedule-actions",children:[e.jsx("span",{className:"profile-schedule-expression",title:Ft(a),children:a.enabled?a.scheduleExpression:"Paused"}),e.jsxs("div",{className:"profile-schedule-controls","aria-label":`${a.scheduleName} schedule controls`,children:[e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:n,type:"button",title:"Refresh local schedules","aria-label":"Refresh local schedules",onClick:t,children:e.jsx(ie,{size:14,className:n?"settings-spin":void 0})}),e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:s,type:"button",title:"Run now","aria-label":`Run ${a.scheduleName} now`,onClick:l,children:e.jsx(He,{size:14})}),e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:s,type:"button",title:c,"aria-label":`${c}: ${a.scheduleName}`,onClick:i,children:a.enabled?e.jsx(Ws,{size:14}):e.jsx(Js,{size:14})})]})]})})]})}function $e({status:s}){return e.jsx("span",{className:`profile-status-text ${s.state}`,children:s.label})}function Ht(s){const n=[],a=[];for(const t of s)t.enabled?n.push(t):a.push(t);return n.sort((t,l)=>Cs(t)-Cs(l)),{active:n,paused:a}}function Cs(s){return s.lastRunStatus==="running"?0:s.lastRunStatus==="queued"?1:2}function _t(s){return s.enabled?s.lastError||s.lastRunStatus==="failed"?{state:"warning",label:"Failed"}:s.lastRunStatus==="running"?{state:"loading",label:"Running"}:s.lastRunStatus==="queued"?{state:"loading",label:"Queued"}:s.lastRunStatus==="skipped"?{state:"warning",label:"Skipped"}:s.lastRunStatus==="succeeded"?{state:"ready",label:"Succeeded"}:{state:"loading",label:"Scheduled"}:{state:"disabled",label:"Paused"}}function Ft(s){const n=[`${s.scheduleType}: ${s.scheduleExpression}`];return s.nextRunAt&&n.push(`next ${ks(s.nextRunAt)}`),s.lastRunAt&&n.push(`last ${ks(s.lastRunAt)}`),n.join(" - ")}function ks(s){const n=new Date(s);return Number.isFinite(n.getTime())?n.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):s}function Gt(s,n,a){if(!n.enabled)return{check:{state:"disabled",label:"Disabled"},sync:{state:"disabled",label:"Disabled"}};if(s.error)return{check:{state:"warning",label:"Error"},sync:{state:"warning",label:"Blocked"}};if(s.setupGate.blockingCount>0)return{check:{state:"warning",label:"Setup"},sync:{state:"warning",label:"Blocked"}};if(s.git?.dirty||Vt(s,n)>0)return{check:{state:"loading",label:"Pending"},sync:{state:"warning",label:"Changed"}};if(s.catalog.stale)return{check:{state:"loading",label:"Stale"},sync:{state:"loading",label:"Waiting"}};if(!s.lastCheck)return{check:{state:"loading",label:"Unchecked"},sync:{state:"loading",label:"Waiting"}};if(s.lastCheck.status==="failed")return{check:{state:"warning",label:"Failed"},sync:{state:"warning",label:"Blocked"}};if(!s.summary.checkFresh)return{check:{state:"loading",label:"Stale"},sync:{state:"loading",label:"Waiting"}};if(qt(s,a))return{check:{state:"ready",label:"Passed"},sync:{state:"warning",label:"Sync acct"}};const t=s.summary.localHead??s.git?.head??null,l=s.hosted?.lastPushedLocalHead??null;return!(s.summary.hostedHead??s.hosted?.sourceCommitSha??null)&&!l?{check:{state:"ready",label:"Passed"},sync:{state:"loading",label:"Not synced"}}:t&&l&&t!==l?{check:{state:"ready",label:"Passed"},sync:{state:"loading",label:"Needed"}}:{check:{state:"ready",label:"Passed"},sync:{state:"ready",label:"Synced"}}}function qt(s,n){const a=s.hosted?.teamId?.trim()??"";return!!(a&&n&&a!==n)}function Vt(s,n){let a=0;s.diff.changedAgents.includes(n.id)&&(a+=1),s.diff.newAgents.includes(n.id)&&(a+=1),s.diff.deletedAgents.includes(n.id)&&(a+=1);const t=n.path.replace(/^profiles\/[^/]+\//,"");for(const l of s.diff.files){const i=l.path.replace(/^profiles\/[^/]+\//,"");(i===t||i.startsWith(`${t}/`)||i.startsWith(`agents/${n.id}/`))&&(a+=1)}return a}function Wt({actions:s,busy:n,library:a,onSelect:t}){const l=a.profiles.find(d=>Ze(d.ref,a.lastUsed))??a.profiles[0]??null,i=l?Fe(l.ref):"";return e.jsxs("div",{className:"profile-selector-bar",children:[e.jsxs("label",{className:"profile-selector-control",children:[e.jsx("select",{"aria-label":"Active profile",disabled:n||a.profiles.length===0,value:i,onChange:d=>{const c=kn(a,d.currentTarget.value),u=a.profiles.find(g=>Ze(g.ref,c));u&&t(u)},children:a.profiles.length?a.profiles.map(d=>e.jsx("option",{value:Fe(d.ref),children:d.name},Fe(d.ref))):e.jsx("option",{value:"",children:"No profiles"})}),e.jsx(Pn,{"aria-hidden":"true",size:14})]}),s]})}function Kt({addDisabled:s,commitDisabled:n,commitLabel:a,refreshDisabled:t,repoDisabled:l,syncDisabled:i,syncLabel:d,syncStatus:c,onAdd:u,onCommit:g,onRefresh:o,onRepo:h,onSync:m}){const[x,f]=r.useState(!1),v=r.useRef(null);r.useEffect(()=>{if(!x)return;function C(P){v.current?.contains(P.target)||f(!1)}function k(P){P.key==="Escape"&&f(!1)}return document.addEventListener("pointerdown",C),document.addEventListener("keydown",k),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",k)}},[x]);function S(C){f(!1),C()}return e.jsx("div",{className:"profile-selector-actions",children:e.jsxs("div",{className:"profile-settings-menu-root",ref:v,children:[e.jsx("button",{"aria-expanded":x,"aria-haspopup":"menu","aria-label":"Profile settings",className:"settings-icon-button ghost profile-settings-menu-trigger",type:"button",onClick:()=>f(C=>!C),children:e.jsx(rs,{size:15})}),x?e.jsxs("div",{className:"profile-settings-menu",role:"menu",children:[e.jsxs("button",{disabled:n,role:"menuitem",type:"button",onClick:()=>S(g),children:[e.jsx(ze,{size:14}),e.jsx("span",{children:a})]}),e.jsxs("button",{disabled:i,role:"menuitem",type:"button",onClick:()=>S(m),children:[e.jsx(je,{size:14}),e.jsxs("span",{children:[e.jsx("strong",{children:d}),c?e.jsx("small",{children:c}):null]})]}),e.jsxs("button",{disabled:l,role:"menuitem",type:"button",onClick:()=>S(h),children:[e.jsx(Ie,{size:14}),e.jsx("span",{children:"Repository"})]}),e.jsx("div",{className:"profile-settings-menu-separator",role:"separator"}),e.jsxs("button",{disabled:t,role:"menuitem",type:"button",onClick:()=>S(o),children:[e.jsx(ie,{size:14}),e.jsx("span",{children:"Refresh profiles"})]}),e.jsxs("button",{disabled:s,role:"menuitem",type:"button",onClick:()=>S(u),children:[e.jsx(fe,{size:14}),e.jsx("span",{children:"Add profile"})]})]}):null]})})}const Jt=[{id:"actions",label:"Actions",detail:"Profile-level reusable actions"},{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 Yt({connection:s,entry:n,onClose:a,onPublished:t}){const[l,i]=r.useState("github"),[d,c]=r.useState(""),[u,g]=r.useState(`${n.name}-profile`),[o,h]=r.useState("public"),[m,x]=r.useState(()=>n.state.agents.filter(j=>j.enabled).map(j=>j.id)),[f,v]=r.useState(()=>n.state.skills.filter(j=>j.enabled).map(j=>j.name)),[S,C]=r.useState([]),[k,P]=r.useState(null),[R,y]=r.useState(null),[A,O]=r.useState(null),$=r.useMemo(()=>({ref:n.ref,selection:{agentIds:m,skillNames:f,optionalContent:S},target:{provider:l,owner:d.trim()||null,repository:u.trim(),visibility:l==="github"?"public":o}}),[m,n.ref,S,d,l,u,f,o]);function p(j,T,H){return H?[...new Set([...j,T])]:j.filter(F=>F!==T)}async function N(j){if(j.preventDefault(),!(!u.trim()||R)){y("preview"),O(null);try{P(await M.profilePublicationPreview(s,$))}catch(T){O(T instanceof Error?T.message:String(T))}finally{y(null)}}}async function b(){if(!(!k||k.blockedReasons.length>0||R)){y("publish"),O(null);try{const j=await M.profilePublicationPublish(s,{...$,expectedSourceHash:k.sourceHash,confirmed:!0});t(`Published ${n.name} to ${j.owner}/${j.repository}`),a()}catch(j){O(j instanceof Error?j.message:String(j))}finally{y(null)}}}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:a,children:e.jsxs("form",{className:"git-dialog profile-publication-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-publication-title",onMouseDown:j=>j.stopPropagation(),onSubmit:N,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!R,type:"button","aria-label":"Close",onClick:a,children:e.jsx(oe,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(je,{size:18})}),e.jsxs("h2",{id:"profile-publication-title",children:["Publish ",n.name]}),e.jsx("p",{children:"Choose the exact Agents, Skills, and optional files to share. OpenPond will show the complete file list before it pushes anything."}),k?e.jsx(Qt,{preview:k}):e.jsxs(e.Fragment,{children:[e.jsxs("fieldset",{className:"profile-publication-fieldset",children:[e.jsx("legend",{children:"Destination"}),e.jsxs("label",{className:"profile-publication-provider",children:[e.jsx("input",{type:"radio",checked:l==="github",onChange:()=>{i("github"),h("public")}}),e.jsx(Xe,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:"GitHub"}),e.jsx("small",{children:"Published publicly with your signed-in gh CLI"})]})]}),e.jsxs("label",{className:"profile-publication-provider",children:[e.jsx("input",{type:"radio",checked:l==="openpond_git",onChange:()=>{i("openpond_git"),h("private")}}),e.jsx(Rn,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:"OpenPond Git"}),e.jsx("small",{children:"Private by default; uses the same repository format"})]})]})]}),e.jsxs("div",{className:"profile-publication-target-fields",children:[l==="github"?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"GitHub owner (optional)"}),e.jsx("input",{value:d,placeholder:"Uses gh account",onChange:j=>c(j.currentTarget.value)})]}):null,e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Repository"}),e.jsx("input",{value:u,onChange:j=>g(j.currentTarget.value)})]}),l==="openpond_git"?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Visibility"}),e.jsxs("select",{value:o,onChange:j=>h(j.currentTarget.value),children:[e.jsx("option",{value:"private",children:"Private"}),e.jsx("option",{value:"public",children:"Public"})]})]}):null]}),e.jsx(We,{title:"Agents",empty:"No Agents in this Profile",children:n.state.agents.map(j=>e.jsx(Ke,{checked:m.includes(j.id),label:j.name,detail:j.path,onChange:T=>x(H=>p(H,j.id,T))},j.id))}),e.jsx(We,{title:"Skills",empty:"No Skills in this Profile",children:n.state.skills.map(j=>e.jsx(Ke,{checked:f.includes(j.name),label:j.name,detail:j.description||j.path,onChange:T=>v(H=>p(H,j.name,T))},j.name))}),e.jsx(We,{title:"Optional content",empty:"",children:Jt.map(j=>e.jsx(Ke,{checked:S.includes(j.id),label:j.label,detail:j.detail,onChange:T=>C(H=>p(H,j.id,T))},j.id))})]}),A?e.jsx("div",{className:"profile-dialog-warning",children:A}):null,e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:!!R,type:"button",onClick:k?()=>P(null):a,children:k?"Back":"Cancel"}),k?e.jsxs("button",{className:"git-dialog-primary",disabled:!!R||k.blockedReasons.length>0,type:"button",onClick:()=>{b()},children:[e.jsx(je,{size:14}),e.jsx("span",{children:R==="publish"?"Publishing":k.replacesExisting?"Confirm and replace":"Confirm and publish"})]}):e.jsx("button",{className:"git-dialog-primary",disabled:!!R||!u.trim(),type:"submit",children:R==="preview"?"Building preview":"Review exact files"})]})]})})}function We({title:s,empty:n,children:a}){const t=Array.isArray(a)?a.length:a?1:0;return e.jsxs("fieldset",{className:"profile-publication-fieldset",children:[e.jsx("legend",{children:s}),t?a:e.jsx("span",{className:"profile-publication-empty",children:n})]})}function Ke({checked:s,label:n,detail:a,onChange:t}){return e.jsxs("label",{className:"profile-publication-selection",children:[e.jsx("input",{type:"checkbox",checked:s,onChange:l=>t(l.currentTarget.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:n}),e.jsx("small",{children:a})]})]})}function Qt({preview:s}){const n=s.files.reduce((a,t)=>a+t.sizeBytes,0);return e.jsxs("div",{className:"profile-publication-preview",children:[e.jsxs("div",{className:"profile-dialog-summary",children:[e.jsxs("strong",{children:[s.files.length," files · ",Ps(n)]}),e.jsx("span",{children:s.sourceRevision?.slice(0,10)??"No source revision"})]}),s.blockedReasons.map(a=>e.jsx("div",{className:"profile-dialog-warning",children:a},a)),s.warnings.map(a=>e.jsx("div",{className:"profile-publication-warning",children:a},a)),e.jsx("div",{className:"profile-publication-file-list","aria-label":"Exact files to publish",children:s.files.map(a=>e.jsxs("div",{children:[e.jsx("span",{title:a.path,children:a.path}),e.jsxs("small",{children:[a.category," · ",Ps(a.sizeBytes)]})]},a.path))}),s.excludedFiles.length?e.jsxs("details",{children:[e.jsxs("summary",{children:[s.excludedFiles.length," excluded sensitive/runtime files"]}),s.excludedFiles.map(a=>e.jsx("code",{children:a},a))]}):null]})}function Ps(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Zt({section:s="all",catalogPresentation:n="list",payload:a,connection:t,onPayload:l,onError:i,onToast:d,onSkillCommand:c,overviewContent:u}){const[g,o]=r.useState(""),[h,m]=r.useState(null),[x,f]=r.useState(!1),[v,S]=r.useState(null),[C,k]=r.useState(null),P=a?.profile??null,R=a?.preferences.defaultTeamId?.trim()||"",y=s==="all"||s==="profile"||s==="controls",A=s==="all"||s==="profile",O=s==="all"||s==="agents",$=s==="all"||s==="profile";async function p(U){t&&(l(await M.bootstrap(t)),d?.(U,"success"))}async function N(U,J){if(!(!t||h)){m(U),i(null);try{await J()}catch(Y){i(Y instanceof Error?Y.message:String(Y))}finally{m(null)}}}function b(){N("init",async()=>{await M.profileInit(t,{}),await p("Profile initialized")})}function j(){N("commit",async()=>{await M.profileCommit(t,{message:g.trim()||null}),o(""),await p("Profile commit complete")})}function T(){N("push",async()=>{if(!R)throw new Error("Select a default team before syncing a hosted profile.");await M.profileCheck(t,{kind:"all"}),await M.profilePush(t,{teamId:R,ensureHosted:!0,message:null}),await p("Profile synced to hosted profile repo")})}function H(U){N(`select:${U.ref.profileId}`,async()=>{await M.profileSelect(t,U.ref),await p(`Using ${U.name}`)})}function F(U){N("add",async()=>{U.source==="blank"?await M.profileInit(t,{path:U.path,profile:U.profile,template:"blank-profile"}):U.source==="local"?await M.profileLoad(t,U):await M.profileInstall(t,U),f(!1),await p(U.source==="blank"?`${U.profile} created`:"Profile added")})}function V(U){N("update",async()=>{await M.profileUpdate(t,U.ref),await p(`${U.name} updated`)})}function Z(U){N("remove",async()=>{await M.profileRemove(t,U.ref),S(null),await p("Profile removed from this device")})}function E(){N("refresh",async()=>{await p("Profiles refreshed")})}return e.jsxs("section",{className:"account-settings profile-settings",children:[P?.mode==="local"?e.jsxs(e.Fragment,{children:[y?e.jsxs(e.Fragment,{children:[A&&n==="select"?e.jsx(Wt,{actions:e.jsx(Rs,{connection:t,onAdd:()=>f(!0),onRefresh:E,presentation:"menu",profile:P,profileBusy:h,profileCommitMessage:g,selectedDefaultTeamId:R,syncDisabledReason:As(P,R),setProfileCommitMessage:o,submitProfileCommit:j,submitProfilePush:T}),busy:!!h,library:a?.profileLibrary??{lastUsed:null,profiles:[]},onSelect:H}):e.jsxs(e.Fragment,{children:[A?e.jsx(Xt,{busy:!!h,library:a?.profileLibrary??{lastUsed:null,profiles:[]},onAdd:()=>f(!0),onRefresh:E,onRemove:S,onPublish:k,onUpdate:V,onSelect:H}):null,e.jsx(Rs,{connection:t,profile:P,profileBusy:h,profileCommitMessage:g,selectedDefaultTeamId:R,syncDisabledReason:As(P,R),setProfileCommitMessage:o,submitProfileCommit:j,submitProfilePush:T})]}),u]}):null,O?e.jsx(zt,{connection:t,profile:P,selectedDefaultTeamId:R}):null,$?e.jsx(la,{onSkillCommand:c,profile:P}):null]}):s==="agents"?e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Agents"}),e.jsx("small",{children:"Profile required"})]}),e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No local Profile loaded"}),e.jsx("span",{children:"Open Profile to create or load a Profile before managing agents."})]})]}):e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Summary"}),e.jsx("small",{children:"Not loaded"})]}),e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No local Profile loaded"}),e.jsx("span",{children:"Create an empty Profile, start with an Agent template, or add an existing repository."}),e.jsxs("button",{className:"settings-secondary",disabled:!t||!!h,type:"button",onClick:()=>f(!0),children:[e.jsx(fe,{size:14}),e.jsx("span",{children:"Create or add Profile"})]}),e.jsxs("button",{className:"settings-secondary",disabled:!t||!!h,type:"button",onClick:b,children:[e.jsx(fe,{size:14}),e.jsx("span",{children:h==="init"?"Creating":"Create starter Profile"})]})]})]}),x?e.jsx(ea,{busy:!!h,onClose:()=>f(!1),onSubmit:F}):null,v?e.jsx(sa,{busy:!!h,entry:v,onClose:()=>S(null),onConfirm:()=>Z(v)}):null,C&&t?e.jsx(Yt,{connection:t,entry:C,onClose:()=>k(null),onPublished:U=>d?.(U,"success")}):null]})}function Xt({busy:s,library:n,onAdd:a,onRefresh:t,onRemove:l,onPublish:i,onSelect:d,onUpdate:c}){return e.jsxs("div",{className:"account-list profile-catalog-list",children:[e.jsxs("div",{className:"account-list-heading profile-agent-list-heading",children:[e.jsx("span",{children:"Profiles"}),e.jsxs("div",{className:"profile-skill-heading-actions",children:[e.jsxs("small",{children:[n.profiles.length," installed"]}),e.jsxs("button",{className:"settings-secondary",disabled:s,type:"button",onClick:t,children:[e.jsx(ie,{size:14}),e.jsx("span",{children:"Refresh"})]}),e.jsxs("button",{className:"settings-secondary",disabled:s,type:"button",onClick:a,children:[e.jsx(fe,{size:14}),e.jsx("span",{children:"Add"})]})]})]}),n.profiles.map(u=>{const g=Ze(u.ref,n.lastUsed);return e.jsxs("div",{className:`product-row profile-catalog-row ${g?"selected":""}`,role:"button",tabIndex:s?-1:0,"aria-disabled":s,onClick:()=>{s||d(u)},onKeyDown:o=>{s||o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),d(u))},children:[e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(Ie,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:u.name}),e.jsx("span",{title:u.repoPath,children:u.repoPath})]})]}),e.jsx(en,{status:{state:u.state.error?"warning":"ready",label:u.state.error?"error":g?"current":"ready"}}),e.jsx("span",{className:"profile-catalog-source",children:u.ref.source.replace("_"," ")}),e.jsx("span",{className:"profile-catalog-summary",children:u.state.summary.message}),e.jsxs("span",{className:"profile-catalog-actions",children:[u.ref.source!=="local"?e.jsxs("span",{className:"settings-secondary compact",role:"button",tabIndex:0,onClick:o=>{o.stopPropagation(),c(u)},onKeyDown:o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),o.stopPropagation(),c(u))},children:[e.jsx(ie,{size:14}),e.jsx("span",{children:"Update"})]}):null,e.jsxs("span",{className:"settings-secondary compact",role:"button",tabIndex:0,onClick:o=>{o.stopPropagation(),i(u)},onKeyDown:o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),o.stopPropagation(),i(u))},children:[e.jsx(je,{size:14}),e.jsx("span",{children:"Publish"})]}),e.jsxs("span",{className:"settings-secondary compact profile-remove-button",role:"button",tabIndex:0,"aria-label":`Remove ${u.name}`,onClick:o=>{o.stopPropagation(),l(u)},onKeyDown:o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),o.stopPropagation(),l(u))},children:[e.jsx(Se,{size:14}),e.jsx("span",{children:"Remove"})]})]})]},`${u.ref.source}:${u.ref.repositoryId}:${u.ref.profileId}`)})]})}function ea({busy:s,onClose:n,onSubmit:a}){const[t,l]=r.useState("blank"),[i,d]=r.useState(""),[c,u]=r.useState(""),[g,o]=r.useState("");function h(m){if(m.preventDefault(),s)return;if(t==="blank"){const f=g.trim();if(!f)return;a({source:t,path:i.trim()||null,profile:f});return}if(t==="local"){const f=i.trim();if(!f)return;a({source:t,path:f,profile:g.trim()||null});return}const x=c.trim();x&&a({source:t,repositoryId:x,profile:g.trim()||null})}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:n,children:e.jsxs("form",{className:"git-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"add-profile-title",onMouseDown:m=>m.stopPropagation(),onSubmit:h,children:[e.jsx("button",{className:"git-dialog-close",disabled:s,type:"button","aria-label":"Close",onClick:n,children:e.jsx(oe,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(Ie,{size:18})}),e.jsx("h2",{id:"add-profile-title",children:"Add Profile"}),e.jsx("p",{children:"Create a blank Profile, add a local repository, or install a shareable Profile from Git."}),e.jsxs("div",{className:"profile-add-source-options",children:[e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t==="blank",onChange:()=>l("blank")}),"New blank"]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t==="local",onChange:()=>l("local")}),"Local"]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t==="github",onChange:()=>l("github")}),"GitHub"]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t==="openpond_git",onChange:()=>l("openpond_git")}),"OpenPond Git"]})]}),t==="blank"?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Repository path (optional)"}),e.jsx("input",{disabled:s,value:i,placeholder:"Uses the default local Profile repository",onChange:m=>d(m.currentTarget.value)})]}):t==="local"?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Repository path"}),e.jsx("input",{autoFocus:!0,disabled:s,value:i,placeholder:"/path/to/profile-repo",onChange:m=>d(m.currentTarget.value)})]}):e.jsxs("label",{className:"git-dialog-field",children:[e.jsxs("span",{children:[t==="github"?"GitHub":"OpenPond Git"," repository"]}),e.jsx("input",{autoFocus:!0,disabled:s,value:c,placeholder:"owner/repository",onChange:m=>u(m.currentTarget.value)})]}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:t==="blank"?"Profile name":"Profile name (optional)"}),e.jsx("input",{autoFocus:t==="blank",disabled:s,value:g,placeholder:t==="blank"?"research":"Uses repository default",onChange:m=>o(m.currentTarget.value)})]}),e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:s,type:"button",onClick:n,children:"Cancel"}),e.jsx("button",{className:"git-dialog-primary",disabled:s||!(t==="blank"?g:t==="local"?i:c).trim(),type:"submit",children:t==="blank"?"Create Profile":"Add Profile"})]})]})})}function sa({busy:s,entry:n,onClose:a,onConfirm:t}){return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:a,children:e.jsxs("div",{className:"git-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"remove-profile-title",onMouseDown:l=>l.stopPropagation(),children:[e.jsx("button",{className:"git-dialog-close",disabled:s,type:"button","aria-label":"Close",onClick:a,children:e.jsx(oe,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(Se,{size:18})}),e.jsxs("h2",{id:"remove-profile-title",children:["Remove ",n.name,"?"]}),e.jsx("p",{children:"This removes the Profile from OpenPond on this device. It does not delete the repository or any source files."}),e.jsxs("div",{className:"profile-dialog-summary",children:[e.jsx("strong",{children:n.name}),e.jsx("span",{children:n.repoPath})]}),e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:s,type:"button",onClick:a,children:"Cancel"}),e.jsx("button",{className:"git-dialog-primary danger",disabled:s,type:"button",onClick:t,children:"Remove"})]})]})})}function Rs({connection:s,onAdd:n,onRefresh:a,presentation:t="toolbar",profile:l,profileBusy:i,profileCommitMessage:d,selectedDefaultTeamId:c,syncDisabledReason:u,setProfileCommitMessage:g,submitProfileCommit:o,submitProfilePush:h}){const[m,x]=r.useState(!1),[f,v]=r.useState(!1),[S,C]=r.useState(!1),k=!s||!!i;return e.jsxs(e.Fragment,{children:[t==="menu"&&n&&a?e.jsx(Kt,{addDisabled:!!i,commitDisabled:k,commitLabel:i==="commit"?"Committing":"Commit",refreshDisabled:k,repoDisabled:!!i||!l,syncDisabled:k||!l,syncLabel:i==="push"?"Syncing":"Sync",syncStatus:l?Je(l,c):null,onAdd:n,onCommit:()=>v(!0),onRefresh:a,onRepo:()=>x(!0),onSync:()=>C(!0)}):e.jsx("div",{className:"profile-control-panel",children:e.jsxs("div",{className:"profile-control-toolbar",children:[e.jsxs("div",{className:"profile-control-actions",children:[e.jsxs("button",{className:"settings-secondary",disabled:k,type:"button",onClick:()=>v(!0),children:[e.jsx(ze,{size:14}),e.jsx("span",{children:i==="commit"?"Committing":"Commit"})]}),e.jsxs("button",{className:"settings-secondary",disabled:k||!l,type:"button",onClick:()=>C(!0),children:[e.jsx(je,{size:14}),e.jsx("span",{children:i==="push"?"Syncing":"Sync"})]}),e.jsxs("button",{className:"settings-secondary",disabled:!!i||!l,type:"button",onClick:()=>x(!0),children:[e.jsx(Ie,{size:14}),e.jsx("span",{children:"Repo"})]}),l?e.jsxs("span",{className:"profile-hosted-status",title:`Profile sync status: ${Je(l,c)}`,children:[e.jsx(je,{size:14}),e.jsx("span",{children:"Profile sync"}),e.jsx("strong",{children:Je(l,c)})]}):null]}),l?e.jsx("span",{className:`profile-local-status ${l.summary.state}`,title:l.summary.message,children:l.summary.message}):null]})}),m&&l?e.jsx(aa,{profile:l,profileBusy:i,onClose:()=>x(!1)}):null,f?e.jsx(na,{disabled:k,profileBusy:i,profileCommitMessage:d,setProfileCommitMessage:g,submitProfileCommit:o,onClose:()=>v(!1)}):null,S&&l?e.jsx(ta,{disabled:k,profile:l,profileBusy:i,selectedDefaultTeamId:c,syncDisabledReason:u,submitProfilePush:h,onClose:()=>C(!1)}):null]})}function na({disabled:s,profileBusy:n,profileCommitMessage:a,setProfileCommitMessage:t,submitProfileCommit:l,onClose:i}){function d(c){c.preventDefault(),!s&&(l(),i())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:i,children:e.jsxs("form",{className:"git-dialog profile-commit-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-commit-dialog-title",onMouseDown:c=>c.stopPropagation(),onSubmit:d,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!n,type:"button",title:"Close","aria-label":"Close",onClick:i,children:e.jsx(oe,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(ze,{size:18})}),e.jsx("h2",{id:"profile-commit-dialog-title",children:"Commit profile"}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Commit message"}),e.jsx("input",{autoFocus:!0,value:a,disabled:!!n,placeholder:"Update OpenPond profile",onChange:c=>t(c.target.value)})]}),e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:!!n,type:"button",onClick:i,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:s,type:"submit",children:[e.jsx(ze,{size:14}),e.jsx("span",{children:n==="commit"?"Committing":"Commit"})]})]})]})})}function ta({disabled:s,profile:n,profileBusy:a,selectedDefaultTeamId:t,syncDisabledReason:l,submitProfilePush:i,onClose:d}){const c=ra(n,t),u=c.reduce((h,m)=>h+m.count,0),g=!s&&!l;function o(h){h.preventDefault(),g&&(i(),d())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:d,children:e.jsxs("form",{className:"git-dialog profile-sync-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-sync-dialog-title",onMouseDown:h=>h.stopPropagation(),onSubmit:o,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!a,type:"button",title:"Close","aria-label":"Close",onClick:d,children:e.jsx(oe,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(je,{size:18})}),e.jsx("h2",{id:"profile-sync-dialog-title",children:"Sync profile"}),e.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."}),e.jsxs("div",{className:"profile-dialog-summary",children:[e.jsxs("strong",{children:[u," ",u===1?"item":"items"," out of sync"]}),e.jsxs("span",{children:["Local ",Ce(n.summary.localHead??n.git?.head)," - Last pushed"," ",Ce(n.hosted?.lastPushedLocalHead)]})]}),c.length?e.jsx("div",{className:"profile-dialog-diff-list","aria-label":"Profile sync differences",children:c.map(h=>e.jsxs("div",{className:`profile-dialog-diff-row ${h.tone??""}`,children:[e.jsx("strong",{children:h.label}),e.jsx("span",{children:h.detail})]},h.label))}):e.jsx("div",{className:"profile-dialog-diff-list","aria-label":"Profile sync differences",children:e.jsxs("div",{className:"profile-dialog-diff-row",children:[e.jsx("strong",{children:"Aligned"}),e.jsx("span",{children:"Current local profile source has already been pushed."})]})}),l?e.jsx("div",{className:"profile-dialog-warning",children:l}):null,e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:!!a,type:"button",onClick:d,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:!g,type:"submit",children:[e.jsx(je,{size:14}),e.jsx("span",{children:a==="push"?"Syncing":"Confirm sync"})]})]})]})})}function aa({profile:s,profileBusy:n,onClose:a}){return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:a,children:e.jsxs("div",{className:"git-dialog profile-path-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-path-dialog-title",onMouseDown:t=>t.stopPropagation(),children:[e.jsx("button",{className:"git-dialog-close",disabled:!!n,type:"button",title:"Close","aria-label":"Close",onClick:a,children:e.jsx(oe,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(Ie,{size:18})}),e.jsx("h2",{id:"profile-path-dialog-title",children:"Profile repo"}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Profile repo path"}),e.jsx("input",{"aria-label":"Profile repo path",readOnly:!0,value:s.repoPath??""})]}),e.jsxs("div",{className:"profile-dialog-summary",children:[e.jsx("strong",{children:s.git?.isRepo?"Git-backed":"Git setup required"}),e.jsxs("span",{children:[s.git?.branch??"No branch"," · ",Ce(s.git?.head)]})]}),e.jsx("div",{className:"git-dialog-footer",children:e.jsx("button",{className:"git-dialog-secondary",disabled:!!n,type:"button",onClick:a,children:"Close"})})]})})}function la({onSkillCommand:s,profile:n}){const a=n.skills.slice().sort((i,d)=>i.name.localeCompare(d.name)),t=!s;function l(i){s?.(i)}return e.jsxs("div",{className:"account-list profile-skill-list",children:[e.jsxs("div",{className:"account-list-heading profile-agent-list-heading",children:[e.jsx("span",{children:"Skills"}),e.jsx("div",{className:"profile-skill-heading-actions",children:e.jsxs("small",{children:[n.skillCatalog.skillCount," tracked"]})})]}),a.length?e.jsx("div",{className:"profile-table-frame",children:e.jsxs("table",{className:"profile-data-table profile-skill-table","aria-label":"Profile skills table",children:[e.jsxs("colgroup",{children:[e.jsx("col",{className:"profile-skill-name-column"}),e.jsx("col",{className:"profile-skill-trigger-column"}),e.jsx("col",{className:"profile-skill-status-column"}),e.jsx("col",{className:"profile-skill-source-column"}),e.jsx("col",{className:"profile-skill-actions-column"})]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Skill"}),e.jsx("th",{scope:"col",children:"Trigger"}),e.jsx("th",{scope:"col",children:"Status"}),e.jsx("th",{scope:"col",children:"Source"}),e.jsx("th",{scope:"col",children:"Actions"})]})}),e.jsx("tbody",{children:a.map(i=>e.jsx(ia,{commandDisabled:t,onSkillCommand:l,skill:i},i.name))})]})}):e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No profile skills found"}),e.jsx("span",{children:"Use /skill create to add reusable profile instructions."})]})]})}function ia({commandDisabled:s,onSkillCommand:n,skill:a}){const t=a.validationStatus==="valid"?{state:"ready",label:"valid"}:{state:"warning",label:a.validationStatus};return e.jsxs("tr",{className:"profile-skill-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(Le,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:a.name}),e.jsx("span",{title:a.path,children:a.path})]})]})}),e.jsx("td",{className:"profile-skill-description",title:a.description,children:a.description||"No description"}),e.jsx("td",{children:e.jsx(en,{status:t})}),e.jsx("td",{children:e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{className:"profile-skill-source",title:a.sourcePath,children:a.sourcePath})})}),e.jsx("td",{children:e.jsxs("div",{className:"profile-skill-actions",children:[e.jsx("button",{className:"settings-secondary compact",disabled:s||!a.enabled,type:"button",title:`Use ${a.name}`,onClick:()=>n(`$${a.name} `),children:e.jsx("span",{children:"Use"})}),e.jsx("button",{className:"settings-secondary compact",disabled:s,type:"button",title:`Edit ${a.name}`,onClick:()=>n(`/skill edit ${a.name} `),children:e.jsx("span",{children:"Edit"})})]})})]})}function en({status:s}){return e.jsx("span",{className:`profile-status-text ${s.state}`,children:s.label})}function Ce(s){return s?s.slice(0,10):"None"}function Je(s,n){return sn(s,n)?"Sync this account":s.hosted?.sourceCommitSha?`${s.hosted.promotionStatus??"uploaded"} ${Ce(s.hosted.sourceCommitSha)}`:"Not pushed"}function As(s,n){return n?s.git?.head?s.git.dirty?"Commit local profile changes before syncing.":null:"Commit the profile before syncing.":"Select a default team before syncing."}function ra(s,n){const a=[],t=s.summary.localHead??s.git?.head??null,l=s.hosted?.lastPushedLocalHead??null,i=s.summary.hostedHead??s.hosted?.sourceCommitSha??null;if(sn(s,n)&&a.push({label:"Account",detail:"Hosted profile metadata was synced under a different default team.",count:1,tone:"warning"}),!i&&!l?a.push({label:"Hosted source",detail:"No hosted profile commit has been recorded.",count:1}):t&&l&&t!==l&&a.push({label:"Commit",detail:`Local ${Ce(t)} has not been pushed since ${Ce(l)}.`,count:1}),s.git?.dirty){const c=(s.git.fileCount??s.git.files.length)||(s.diff.fileCount??s.diff.files.length)||1;a.push({label:"Uncommitted files",detail:`${c} local ${c===1?"file":"files"} changed.`,count:c,tone:"warning"})}const d=s.diff.changedAgents.length+s.diff.newAgents.length+s.diff.deletedAgents.length+s.diff.changedSkills.length+s.diff.changedActions.length+s.diff.changedExtensions.length+s.diff.setupChanges.length+s.diff.envRequirementChanges.length;return d>0&&a.push({label:"Profile changes",detail:oa(s),count:d,tone:s.git?.dirty?"warning":void 0}),s.catalog.stale&&a.push({label:"Catalog",detail:"Action catalog artifacts are stale or missing.",count:1,tone:"warning"}),s.setupGate.blockingCount>0&&a.push({label:"Setup",detail:`${s.setupGate.blockingCount} blocking setup ${s.setupGate.blockingCount===1?"requirement":"requirements"}.`,count:s.setupGate.blockingCount,tone:"warning"}),a}function oa(s){const n=[],a=s.diff.changedAgents.length+s.diff.newAgents.length+s.diff.deletedAgents.length;return a&&n.push(`${a} agent ${a===1?"change":"changes"}`),s.diff.changedActions.length&&n.push(`${s.diff.changedActions.length} action ${s.diff.changedActions.length===1?"change":"changes"}`),s.diff.changedSkills.length&&n.push(`${s.diff.changedSkills.length} skill ${s.diff.changedSkills.length===1?"change":"changes"}`),s.diff.changedExtensions.length&&n.push(`${s.diff.changedExtensions.length} extension ${s.diff.changedExtensions.length===1?"change":"changes"}`),s.diff.setupChanges.length&&n.push(`${s.diff.setupChanges.length} setup ${s.diff.setupChanges.length===1?"change":"changes"}`),s.diff.envRequirementChanges.length&&n.push(`${s.diff.envRequirementChanges.length} env ${s.diff.envRequirementChanges.length===1?"change":"changes"}`),n.join(", ")||"Profile source has local changes."}function sn(s,n){const a=s.hosted?.teamId?.trim()??"";return!!(a&&n&&a!==n)}const ca=[{value:"local_secret",label:"Saved key",description:"Encrypted on this machine"},{value:"env",label:"Environment variable",description:"Read by the local server"}],da=120,ua=new Set(["openai","xai","zai"]),ha=new Set(["chatgpt-subscription"]),ma="https://api.z.ai/api/coding/paas/v4";function Ds(s){return s.split(/[\n,]/).map(n=>n.trim()).filter(Boolean)}function nn(s){return s?s.available?"Ready":s.credential.connected?"Configured":s.credential.lastError||s.lastError?"Needs attention":s.id==="codex"?"Needs Codex login":s.routing.localByok?"Needs key":s.enabled?"Enabled":"Off":"Unknown"}function tn(s){return s?s.available?"ready":s.credential.connected?"configured":s.credential.lastError||s.lastError||s.id==="codex"?"warning":"muted":"unknown"}function $s(s){return s.credential.connected?s.credential.redacted?s.credential.redacted:s.credential.source==="chatgpt_subscription"?"ChatGPT subscription":s.credential.source:s.credential.lastError??"Not connected"}function pa(s){return s?.trim().replace(/\/+$/,"")??""}function an(s,n){return s.id==="zai"&&pa(n.providers.zai?.baseUrl)===ma}function ga(s,n){return!s.credential.connected||!s.routing.localByok?"":s.credential.source==="chatgpt_subscription"?"Subscription":an(s,n)?"Coding Plan key":"API key"}function xa(s,n){const a=n.modelCaches[s.id];if(s.routing.localByok&&s.enabled&&!s.credential.connected||!s.enabled&&s.id!=="openpond")return"";const t=Math.max(a?.models.length??0,s.modelIds.length),l=s.defaultModel?ss(s.defaultModel,n,s.id):"",i=t===1?"1 model":`${t} models`,d=ga(s,n);return[nn(s),d,a?i:"",l].filter(Boolean).join(" · ")}function fa(s){return s!=="openpond"&&es(s)}function ds(s){return s?ua.has(s.id)||s.credentialModes.some(n=>ha.has(n)):!1}function ja(s){return ds(s)?["api","subscription"]:["api"]}function Es(s,n){return!s||!n||!ds(s)?"api":s.credential.source==="chatgpt_subscription"||an(s,n)?"subscription":"api"}function Is(s,n){const a=An.filter(t=>!!s?.statuses[t]);return n?a.filter(t=>ds(s?.statuses[t])):a}function ba(s){if(!s)return"Never";const n=new Date(s);return Number.isNaN(n.getTime())?s:n.toLocaleString()}function va(s,n,a=da){const t=[],l=new Set,i=new Set(n.map(c=>c.trim()).filter(Boolean)),d=c=>{l.has(c.value)||t.length>=a||(l.add(c.value),t.push(c))};for(const c of s)i.has(c.value)&&d(c);for(const c of s)d(c);return t}function ya({account:s,codex:n,providers:a,providerBusy:t,validationMessage:l,deleteProviderCredential:i,loadProviderModels:d,refreshProviderModels:c,saveProviderConfig:u,saveProviderCredential:g,startOpenAiSubscriptionAuth:o,validateProvider:h}){const[m,x]=r.useState(null),[f,v]=r.useState(!1),S=r.useMemo(()=>Is(a,!1),[a]),C=r.useMemo(()=>Is(a,f),[a,f]),k=m?a?.statuses[m]??null:null;function P(R,y){x(R),y&&d(R)}return e.jsxs("section",{className:"account-settings",children:[e.jsx("h1",{children:"Providers"}),a?e.jsxs("div",{className:"provider-manager-panel",children:[e.jsxs("div",{className:"account-list-heading provider-manager-heading",children:[e.jsxs("div",{className:"provider-manager-title-row",children:[e.jsx("span",{children:"Model providers"}),e.jsxs("label",{className:"settings-check-row compact provider-subscription-filter",children:[e.jsx("input",{type:"checkbox",checked:f,onChange:R=>v(R.currentTarget.checked)}),e.jsx("span",{children:"Subscriptions"})]})]}),e.jsxs("small",{children:[C.length," of ",S.length," presets"]})]}),C.length>0?e.jsx("div",{className:"provider-manager-scroll",role:"list",children:C.map(R=>{const y=a.statuses[R],A=a.modelCaches[R],O=y.modelIds.length>0&&(A?.models.length??0)<y.modelIds.length,$=t?.startsWith(`${R}:`)??!1,p=fa(R),N=R==="openpond"||!!a.providers[R]?.enabled;return e.jsxs("div",{className:"provider-manager-row",role:"listitem",children:[e.jsxs("label",{className:"provider-toggle","aria-label":`Enable ${y.displayName}`,children:[e.jsx("input",{type:"checkbox",checked:N,disabled:!p||$,onChange:b=>{P(R,!1),u(R,{enabled:b.currentTarget.checked})}}),e.jsx("span",{})]}),e.jsx("div",{className:"provider-row-main",children:e.jsx("strong",{children:y.displayName})}),e.jsxs("div",{className:`provider-row-status ${tn(y)}`,children:[$?e.jsx(le,{size:13,className:"settings-spin"}):null,e.jsx("span",{children:xa(y,a)})]}),e.jsx("button",{type:"button",className:"settings-secondary provider-details-button",onClick:()=>{P(R,O)},children:"Details"})]},R)})}):e.jsxs("div",{className:"empty-account-list provider-manager-empty",children:[e.jsx("strong",{children:"No subscription providers"}),e.jsx("span",{children:"Turn off the filter to show API-key providers."})]})]}):null,l?e.jsxs("div",{className:"settings-footnote provider-validation-message",children:[e.jsx("span",{children:"Last validation"}),e.jsx("strong",{children:l})]}):null,m&&k&&a?e.jsx(Na,{account:s,codex:n,providerId:m,providerBusy:t,settings:a,status:k,onClose:()=>x(null),onDeleteCredential:i,onRefreshModels:c,onSaveConfig:u,onSaveCredential:g,onStartOpenAiSubscriptionAuth:o,onValidate:h}):null]})}function Na({account:s,codex:n,providerId:a,providerBusy:t,settings:l,status:i,onClose:d,onDeleteCredential:c,onRefreshModels:u,onSaveConfig:g,onSaveCredential:o,onStartOpenAiSubscriptionAuth:h,onValidate:m}){const x=l.providers[a],f=l.modelCaches[a],v=r.useId(),S=r.useRef(a),C=Math.max(f?.models.length??0,i.modelIds.length),k=i.routing.localByok&&es(a)&&a!=="codex",P=r.useMemo(()=>k?ja(i):[],[k,i]),R=P.includes("subscription"),[y,A]=r.useState(()=>Es(i,l)),O=k&&y==="subscription"&&R,$=N=>`${v}-${N}-panel`,p=a==="codex"?"Codex app server":x?.baseUrl??(a==="openpond"?s?.chatApiBaseUrl:null)??"Not set";return r.useEffect(()=>{if(S.current!==a){S.current=a,A(Es(i,l));return}k&&!P.includes(y)&&A("api")},[y,P,k,a,l,i]),e.jsx("div",{className:"git-dialog-backdrop provider-dialog-backdrop",role:"presentation",onMouseDown:d,children:e.jsxs("section",{className:"git-dialog provider-details-dialog",role:"dialog","aria-modal":"true","aria-label":`${i.displayName} provider details`,onMouseDown:N=>N.stopPropagation(),children:[e.jsx("button",{className:"git-dialog-close",type:"button",title:"Close","aria-label":"Close",onClick:d,children:e.jsx(oe,{size:16})}),e.jsxs("div",{className:"provider-dialog-header",children:[e.jsxs("div",{children:[e.jsx("h2",{children:i.displayName}),e.jsx("span",{children:Te(a,l)})]}),e.jsx("div",{className:`provider-state-pill ${tn(i)}`,children:nn(i)})]}),k?e.jsx("div",{className:"surface-tabs provider-mode-tabs",role:"tablist","aria-label":`${i.displayName} mode`,children:P.map(N=>e.jsx("button",{type:"button",role:"tab",id:`${v}-${N}`,className:y===N?"active":void 0,"aria-selected":y===N,"aria-controls":$(N),onClick:()=>A(N),children:N==="api"?"API":"Subscription"},N))}):null,e.jsxs("dl",{className:"provider-dialog-stats",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Credential"}),e.jsx("dd",{title:$s(i),children:$s(i)})]}),O?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Base URL"}),e.jsx("dd",{title:p,children:p})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Model"}),e.jsx("dd",{title:x?.defaultModel??i.defaultModel??void 0,children:x?.defaultModel??i.defaultModel??"Not set"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Models"}),e.jsxs("dd",{title:f?.lastError??void 0,children:[C," cached · ",ba(f?.fetchedAt)]})]})]}),a==="codex"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Account"}),e.jsx("dd",{title:n?.account?.email??void 0,children:n?.account?.label??n?.account?.email??"Not signed in"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Binary"}),e.jsx("dd",{title:n?.binaryPath??void 0,children:n?.binaryPath??"Not found"})]})]}):null,i.credential.lastError||f?.lastError||i.lastError?e.jsxs("div",{className:"provider-dialog-error",children:[e.jsx("dt",{children:"Error"}),e.jsx("dd",{title:i.credential.lastError??f?.lastError??i.lastError??void 0,children:i.credential.lastError??f?.lastError??i.lastError})]}):null]}),a==="codex"?e.jsx(wa,{providerBusy:t,status:i,onValidate:m}):k&&x&&f?e.jsx(Sa,{credentialTab:y,credentialTabsId:v,hasSubscriptionTab:R,providerId:a,providerBusy:t,settings:l,status:i,onDeleteCredential:c,onRefreshModels:u,onSaveConfig:g,onSaveCredential:o,onStartOpenAiSubscriptionAuth:h,onValidate:m}):i.routing.localByok&&!es(a)?e.jsxs("div",{className:"provider-dialog-note",children:[e.jsx(_s,{size:15}),e.jsx("span",{children:"Adapter pending"})]}):null]})})}function wa({providerBusy:s,status:n,onValidate:a}){const t=s==="codex:validate";return e.jsxs("div",{className:"provider-dialog-body codex-provider-body",children:[e.jsxs("div",{className:"provider-dialog-note codex-provider-note",children:[e.jsx(ge,{size:15}),e.jsxs("span",{children:["Uses your local ",e.jsx("code",{children:"codex login"})," session through the Codex app server. This route is separate from OpenAI Platform API-key billing."]})]}),e.jsx("div",{className:"settings-button-row codex-provider-actions",children:e.jsxs("button",{type:"button",className:"settings-secondary",disabled:t,onClick:()=>{a("codex",{modelId:n.defaultModel??void 0})},children:[t?e.jsx(le,{size:14,className:"settings-spin"}):e.jsx(Gs,{size:14}),e.jsx("span",{children:t?"Testing":"Test Codex login"})]})})]})}function Sa({credentialTab:s,credentialTabsId:n,hasSubscriptionTab:a,providerId:t,providerBusy:l,settings:i,status:d,onDeleteCredential:c,onRefreshModels:u,onSaveConfig:g,onSaveCredential:o,onStartOpenAiSubscriptionAuth:h,onValidate:m}){const x=i.providers[t],f=r.useMemo(()=>Ue(t,i),[t,i]),v=`provider-models-${t}`,S=r.useRef(t),[C,k]=r.useState(x.baseUrl??""),[P,R]=r.useState(x.defaultModel??""),[y,A]=r.useState(x.modelOverrides.join(`
3
- `)),[O,$]=r.useState({baseUrl:!1,defaultModel:!1,modelOverrides:!1}),[p,N]=r.useState("local_secret"),[b,j]=r.useState(""),[T,H]=r.useState(""),F=l===`${t}:config`,V=l===`${t}:credential`,Z=l===`${t}:validate`,E=l===`${t}:models`,U=l==="openai:credential",J=t==="openai",Y=t==="xai",W=t==="zai",G=(z=>`${n}-${z}-panel`)(s),_=s==="subscription"&&a,se=s==="subscription"&&W?"coding-plan":"api",ae=se==="coding-plan"?"Coding Plan key":"API key",ue=d.credential.connected?se==="coding-plan"?"Replace saved plan key":"Replace saved key":ae,ce=se==="coding-plan"?"Save plan key":"Save key",X=r.useMemo(()=>va(f,[P,...Ds(y)]),[P,f,y]),Q=Math.max(0,f.length-X.length);r.useEffect(()=>{if(S.current!==t){S.current=t,$({baseUrl:!1,defaultModel:!1,modelOverrides:!1}),k(x.baseUrl??""),R(x.defaultModel??""),A(x.modelOverrides.join(`
4
- `));return}O.baseUrl||k(x.baseUrl??""),O.defaultModel||R(x.defaultModel??""),O.modelOverrides||A(x.modelOverrides.join(`
5
- `))},[x.baseUrl,x.defaultModel,x.modelOverrides,O.baseUrl,O.defaultModel,O.modelOverrides,t]);const de=p==="env"?!!T.trim():!!b.trim();async function me(z){z.preventDefault(),await g(t,{enabled:!0,baseUrl:C.trim()||null,defaultModel:P.trim()||null,modelOverrides:Ds(y)}),$({baseUrl:!1,defaultModel:!1,modelOverrides:!1})}async function L(z){if(z.preventDefault(),!!de){if(p==="env"){await o(t,{source:"env",envVar:T.trim()});return}await o(t,{source:"local_secret",value:b}),j("")}}function w({panel:z=!0}={}){return e.jsxs("form",{className:"provider-credential-panel",id:z?G:void 0,role:z?"tabpanel":void 0,"aria-labelledby":z?`${n}-${s}`:void 0,onSubmit:B=>{L(B)},children:[e.jsxs("div",{className:"provider-card-grid credential-grid",children:[e.jsxs("div",{className:"settings-select-field",children:[e.jsx("span",{children:"Credential source"}),e.jsx(De,{value:p,disabled:V,label:"Credential source",options:ca,onChange:B=>N(B)})]}),p==="env"?e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Environment variable"}),e.jsx("input",{value:T,disabled:V,placeholder:"PROVIDER_API_KEY",onChange:B=>H(B.currentTarget.value)})]}):e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:ae}),e.jsx("input",{type:"password",value:b,disabled:V,placeholder:ue,autoComplete:"off",onChange:B=>j(B.currentTarget.value)})]})]}),e.jsxs("div",{className:"settings-button-row",children:[e.jsxs("button",{className:"settings-secondary",disabled:V||!de,children:[V?e.jsx(le,{size:14,className:"settings-spin"}):e.jsx(ge,{size:14}),e.jsx("span",{children:V?"Saving":ce})]}),e.jsx("button",{type:"button",className:"settings-icon-button ghost","aria-label":`Delete ${d.displayName} credential`,disabled:V||!d.credential.connected,onClick:()=>{c(t)},children:e.jsx(Se,{size:15})})]})]})}function D(){return J?e.jsxs("div",{className:"provider-subscription-panel",id:G,role:"tabpanel","aria-labelledby":`${n}-subscription`,children:[e.jsxs("div",{className:"provider-dialog-note codex-provider-note",children:[e.jsx(ge,{size:15}),e.jsx("span",{children:"ChatGPT subscription auth opens OpenAI login and stores a refresh token locally. API keys remain available under the API tab for raw Platform billing."})]}),e.jsxs("div",{className:"settings-button-row",children:[e.jsxs("button",{type:"button",className:"settings-secondary",disabled:U,onClick:()=>{h("browser")},children:[U?e.jsx(le,{size:14,className:"settings-spin"}):e.jsx(ge,{size:14}),e.jsx("span",{children:U?"Opening":"Connect ChatGPT"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:U,onClick:()=>{h("device")},children:[U?e.jsx(le,{size:14,className:"settings-spin"}):e.jsx(ge,{size:14}),e.jsx("span",{children:"Device code"})]}),e.jsx("button",{type:"button",className:"settings-icon-button ghost","aria-label":`Delete ${d.displayName} credential`,disabled:U||!d.credential.connected,onClick:()=>{c(t)},children:e.jsx(Se,{size:15})})]})]}):Y?e.jsx("div",{className:"provider-subscription-panel",id:G,role:"tabpanel","aria-labelledby":`${n}-subscription`,children:e.jsxs("div",{className:"provider-dialog-note xai-provider-note",children:[e.jsx(ge,{size:15}),e.jsx("span",{children:"SuperGrok includes Grok app and Grok Build access. xAI API calls here still use an xAI Console API key with API credits or invoiced billing, so there is no separate Connect SuperGrok step yet."})]})}):W?e.jsxs("div",{className:"provider-subscription-panel",id:G,role:"tabpanel","aria-labelledby":`${n}-subscription`,children:[e.jsxs("div",{className:"provider-dialog-note subscription-provider-note",children:[e.jsx(ge,{size:15}),e.jsx("span",{children:"GLM Coding Plan uses a plan API key with the dedicated Coding endpoint. General Z.ai API keys and balances are separate."})]}),w({panel:!1})]}):null}return e.jsxs("div",{className:"provider-dialog-body",children:[_?null:e.jsxs("form",{className:"provider-card-form",onSubmit:z=>{me(z)},children:[e.jsxs("div",{className:"provider-card-grid",children:[e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Base URL"}),e.jsx("input",{value:C,disabled:F,placeholder:"https://api.example.com/v1",onChange:z=>{$(B=>({...B,baseUrl:!0})),k(z.currentTarget.value)}})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Default model"}),e.jsx("input",{list:v,value:P,disabled:F,placeholder:"Model id",onChange:z=>{$(B=>({...B,defaultModel:!0})),R(z.currentTarget.value)}}),e.jsx("datalist",{id:v,children:X.map(z=>e.jsx("option",{value:z.value,children:z.label},z.value))}),Q>0?e.jsxs("small",{children:[Q," more cached models hidden from suggestions"]}):null]})]}),e.jsxs("div",{className:"settings-button-row",children:[e.jsxs("button",{className:"settings-secondary",disabled:F,children:[F?e.jsx(le,{size:14,className:"settings-spin"}):e.jsx(cs,{size:14}),e.jsx("span",{children:F?"Saving":"Save config"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:E,onClick:()=>{u(t)},children:[E?e.jsx(le,{size:14,className:"settings-spin"}):e.jsx(ie,{size:14}),e.jsx("span",{children:E?"Refreshing":"Refresh models"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:Z||!P.trim(),onClick:()=>{m(t,{baseUrl:C.trim()||void 0,modelId:P.trim()||void 0})},children:[Z?e.jsx(le,{size:14,className:"settings-spin"}):e.jsx(Gs,{size:14}),e.jsx("span",{children:Z?"Testing":"Test"})]})]})]}),e.jsx("div",{className:"provider-card-form credential-form",children:_?D():w()})]})}function Ca({status:s,busy:n,flashTailscaleUp:a,refresh:t,enableRemoteAccess:l,disableRemoteAccess:i,copyRemoteLink:d,copyTailscaleUpCommand:c,copyServeCommand:u,copyServeSetupUrl:g,copyOperatorCommand:o,createRemoteLink:h}){const m=s?.tailscale.installed??!1,x=s?.serve.enabled??!1,f=s?.serve.reachable??!1,v=!!(s?.webUiAvailable&&m),S=x?!!s?.remoteWebUrl:v,k=(s?.tailscale.peers??[]).filter(y=>!y.isSelf),P=!!s?.tailscale.error?.includes("set --operator"),R=!!(x&&s?.remoteWebUrl);return e.jsxs("section",{className:"account-settings remote-access-settings",children:[e.jsx("h1",{children:"Remote access"}),e.jsxs("div",{className:"account-summary remote-access-summary",children:[e.jsxs("div",{className:"account-summary-main",children:[e.jsx("div",{className:`remote-access-icon ${f?"online":x?"configured":""}`,children:m?e.jsx(Zs,{size:18}):e.jsx(Wn,{size:18})}),e.jsxs("div",{children:[e.jsx("strong",{children:f?"Tailscale Serve is reachable":x?"Tailscale Serve is configured":"Tailscale Serve is off"}),e.jsx("small",{children:s?Ra(s):"Checking Tailscale"})]})]}),e.jsxs("div",{className:"account-summary-actions",children:[e.jsx("button",{type:"button",className:"settings-icon-button",title:"Refresh remote access","aria-label":"Refresh remote access",disabled:n!==null,onClick:()=>{t()},children:e.jsx(ie,{className:n==="refresh"?"settings-spin":"",size:15})}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:n!==null||!m||!x&&!v,onClick:()=>{x?i():l()},children:[e.jsx(ot,{size:15}),e.jsx("span",{children:x?n==="disable"?"Turning off":"Turn off":n==="enable"?"Turning on":"Turn on"})]})]})]}),e.jsxs("div",{className:"account-list",children:[e.jsx("div",{className:"account-list-heading remote-access-link-heading",children:e.jsxs("div",{children:[e.jsx("span",{children:"OpenPond link"}),e.jsx("small",{children:R?"Browser UI":"Tailscale + Serve"})]})}),R&&e.jsx(pe,{label:"Remote URL",value:s?.remoteWebUrl??null,actionLabel:n==="copy-link"?"Copying":"Copy",disabled:!s?.remoteWebUrl||n!==null,onAction:d}),e.jsx(pe,{label:"Tailscale up",value:s?.tailscaleUpCommand??null,flash:a,actionLabel:n==="copy-up-command"?"Copying":"Copy",disabled:!s?.tailscaleUpCommand||n!==null,onAction:c}),e.jsx(pe,{label:"Serve command",value:s?.serveCommand??null,actionLabel:n==="copy-command"?"Copying":"Copy",disabled:!s?.serveCommand||n!==null,onAction:u}),s?.serve.setupUrl&&e.jsx(pe,{label:"Enable Serve",value:s.serve.setupUrl,actionLabel:n==="copy-serve-setup"?"Copying":"Copy",disabled:n!==null,onAction:g}),P&&e.jsx(pe,{label:"One-time setup",value:s?.operatorCommand??null,actionLabel:n==="copy-operator"?"Copying":"Copy",disabled:!s?.operatorCommand||n!==null,onAction:o}),e.jsx(pe,{label:"Local target",value:s?.localUrl??null}),s?.tailscale.authUrl&&e.jsx(pe,{label:"Tailscale login",value:s.tailscale.authUrl}),e.jsx(pe,{label:"Disable command",value:s?.disableCommand??null})]}),e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading remote-access-link-heading",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Authorized clients"}),e.jsxs("small",{children:[k.length," devices"]})]}),e.jsx("button",{type:"button",className:"settings-secondary",disabled:n!==null||!S,onClick:()=>{h()},children:e.jsx("span",{children:x?"Copy link":"Create link"})})]}),s?k.length===0?e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No clients reported"}),e.jsx("span",{children:s?.tailscale.running?"Tailscale did not return peer devices.":"Tailscale is not running."})]}):k.map(y=>e.jsx(Pa,{peer:y},y.id)):e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"Checking clients"}),e.jsx("span",{children:"Loading tailnet devices."})]})]}),e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Remote environment"}),e.jsx("small",{children:s?.tailscale.tailnetName??"Tailnet"})]}),e.jsx(ka,{status:s})]}),s?.serve.configText&&e.jsxs("div",{className:"remote-access-config",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Tailscale config"}),e.jsx("small",{children:s.serve.enabled?"OpenPond target found":"No OpenPond target"})]}),e.jsx("pre",{children:s.serve.configText})]})]})}function pe({actionLabel:s,disabled:n,flash:a,label:t,onAction:l,value:i}){return e.jsxs("div",{className:"product-row remote-access-value-row",children:[e.jsxs("div",{children:[e.jsx("strong",{className:a?"flash":void 0,children:t}),e.jsx("code",{children:i??"Not available"})]}),l&&e.jsx("button",{type:"button",className:"settings-secondary",disabled:n,onClick:()=>{l()},children:e.jsx("span",{children:s??"Copy"})})]})}function ka({status:s}){const n=[{label:"State",value:s?.tailscale.backendState??"Unknown"},{label:"Machine",value:s?.tailscale.machineName??"Unknown"},{label:"Tailnet",value:s?.tailscale.tailnetName??"Unknown"}],a=[{label:"Tailscale IP",value:s?.tailscale.tailscaleIps.join(", ")||"Unknown"},{label:"HTTPS host",value:s?.serve.httpsHost??s?.tailscale.dnsName??"Unknown"}];return e.jsxs("div",{className:"remote-access-environment",children:[e.jsx("div",{className:"remote-access-environment-row three",children:n.map(t=>e.jsx(Ms,{label:t.label,value:t.value},t.label))}),e.jsx("div",{className:"remote-access-environment-row two",children:a.map(t=>e.jsx(Ms,{label:t.label,value:t.value},t.label))})]})}function Ms({label:s,value:n}){return e.jsxs("div",{className:"remote-access-environment-cell",children:[e.jsx("strong",{children:s}),e.jsx("span",{children:n})]})}function Pa({peer:s}){return e.jsxs("div",{className:"account-row remote-access-peer-row",children:[e.jsx("div",{className:`remote-access-peer-dot ${s.online?"online":""}`}),e.jsxs("div",{className:"account-details",children:[e.jsx("strong",{children:s.name}),e.jsx("span",{children:s.dnsName??s.tailscaleIps[0]??"No address"})]}),e.jsx("span",{className:`account-state ${s.online?"signed_in":""}`,children:s.online?"Online":"Offline"}),e.jsx("span",{className:"account-state",children:s.os??"Unknown"})]})}function Ra(s){return s.tailscale.installed?s.tailscale.running?s.webUiAvailable?s.serve.reachable?s.remoteUrl??"Tailnet link ready":s.remoteUrl?`${s.remoteUrl} ready to configure`:"Tailnet DNS unavailable":"Browser UI is not served by this process":s.tailscale.authUrl?"Tailscale needs sign-in":"Tailscale is not running":"Tailscale is not installed"}const Aa=[{items:[{section:"account",label:"Account",Icon:ps},{section:"notifications",label:"Notifications",Icon:Ys},{section:"providers",label:"Providers",Icon:qs},{section:"usage",label:"Activity",Icon:$n}]},{label:"Harness",items:[{section:"harness",label:"Overview",Icon:_n},{section:"harness-refiner",label:"Refiner",Icon:ms},{section:"harness-continuous-review",label:"Continuous Review",Icon:ie},{section:"harness-contents",label:"Contents",Icon:En},{section:"harness-releases",label:"Releases",Icon:Fn}]},{label:"Customization",items:[{section:"defaults",label:"Defaults",Icon:mt},{section:"personalization",label:"Personalization",Icon:ms},{section:"editor",label:"Editor",Icon:Gn},{section:"skills",label:"Skills",Icon:Le}]},{label:"Agents",items:[{section:"profile",label:"Profiles",Icon:ps},{section:"subagents",label:"Agents",Icon:Be}]},{label:"System",items:[{section:"dataset-storage",label:"Dataset Storage",Icon:lt},{section:"remote",label:"Remote Access",Icon:Zs},{section:"diagnostics",label:"Diagnostics",Icon:Kn}]}];function Da({section:s,onBack:n,onSectionChange:a}){return e.jsxs("aside",{className:"settings-sidebar",children:[e.jsxs("button",{className:"settings-back","aria-label":"Back to app",onClick:n,children:[e.jsx(Dn,{size:15}),e.jsx("span",{children:"Back to app"})]}),e.jsx("nav",{className:"settings-nav","aria-label":"Settings",children:Aa.map((t,l)=>e.jsxs("div",{className:"settings-nav-group",children:[t.label?e.jsx("div",{className:"settings-nav-heading",children:t.label}):null,t.items.map(({section:i,label:d,Icon:c})=>e.jsxs("button",{className:`settings-nav-item ${s===i?"active":""}`,onClick:()=>a(i),children:[e.jsx(c,{size:16}),e.jsx("span",{children:d})]},i))]},t.label??`settings-${l}`))})]})}function $a({catalog:s,connection:n,onCatalog:a,onError:t,onOpenExtension:l,onToast:i}){const[d,c]=r.useState(""),[u,g]=r.useState(""),[o,h]=r.useState(null),[m,x]=r.useState(null),[f,v]=r.useState(null),S=r.useCallback(p=>{const N=p instanceof Error?p.message:String(p);v(N),t(N),i?.(N,"error")},[t,i]),C=r.useCallback(()=>{v(null),t(null)},[t]),k=r.useCallback(async p=>{if(p?.preventDefault(),!(!n||!d.trim()||m)){C(),x("preview");try{const N=await M.extensionPreview(n,{source:d.trim(),...u.trim()?{ref:u.trim()}:{}});h(N)}catch(N){h(null),S(N)}finally{x(null)}}},[m,C,n,S,u,d]),P=r.useCallback(async()=>{if(!(!n||!o||m)){C(),x("install");try{const p=await M.extensionAdd(n,{source:o.repositoryUrl,ref:o.requestedRef});a(p.catalog),c(""),g(""),h(null),i?.(`Installed ${p.extension.owner}/${p.extension.repo}.`,"success")}catch(p){S(p)}finally{x(null)}}},[m,C,n,a,i,o,S]),R=r.useCallback(async p=>{if(!(!n||m)){C(),x(`update:${p.id}`);try{const N=await M.extensionUpdate(n,p);a(N.catalog);const b=N.extension.resolvedCommit===p.resolvedCommit&&N.extension.packageHash===p.packageHash;i?.(b?`${p.owner}/${p.repo} is already current.`:`Updated ${p.owner}/${p.repo}.`,"success")}catch(N){S(N)}finally{x(null)}}},[m,C,n,a,i,S]),y=r.useCallback(async()=>{if(!(!n||m||s.extensions.length===0)){C(),x("update-all");try{const p=await M.extensionUpdateAll(n);a(p.catalog);const N=`Updated ${p.updated.length}; ${p.unchanged.length} already current${p.failed.length?`; ${p.failed.length} failed`:""}.`;i?.(N,p.failed.length?"error":"success"),p.failed.length&&v(p.failed.map(b=>b.error).join(" "))}catch(p){S(p)}finally{x(null)}}},[m,s.extensions.length,C,n,a,i,S]),A=r.useCallback(async p=>{if(!(!n||m)&&window.confirm(`Remove ${p.owner}/${p.repo} and its ${p.skills.length} installed skill${p.skills.length===1?"":"s"}? Profile and built-in skills will not be changed.`)){C(),x(`remove:${p.id}`);try{const N=await M.extensionRemove(n,p);a(N.catalog),i?.(`Removed ${p.owner}/${p.repo}.`,"success")}catch(N){S(N)}finally{x(null)}}},[m,C,n,a,i,S]),O=r.useCallback(p=>{c(p),h(null),v(null)},[]),$=r.useCallback(p=>{g(p),h(null),v(null)},[]);return e.jsxs("div",{className:"account-list native-skills-list github-extensions-list",children:[e.jsxs("div",{className:"account-list-heading github-extensions-heading",children:[e.jsx("span",{children:"Third-party extensions"}),e.jsxs("div",{className:"github-extensions-heading-actions",children:[e.jsxs("small",{children:[s.extensions.length," installed from GitHub"]}),e.jsxs("button",{className:"settings-secondary compact",disabled:!n||m!==null||s.extensions.length===0,type:"button",onClick:()=>{y()},children:[m==="update-all"?e.jsx(le,{className:"settings-spin",size:13}):e.jsx(ie,{size:13}),"Update all"]})]})]}),e.jsxs("form",{className:"github-extension-add",onSubmit:p=>{k(p)},children:[e.jsxs("div",{className:"github-extension-add-copy",children:[e.jsx("strong",{children:"Add a GitHub skill pack"}),e.jsx("span",{children:"Use a skills-CLI-compatible owner/repo or GitHub URL. OpenPond installs it locally without running setup code."})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Repository"}),e.jsx("input",{disabled:!n||m!==null,placeholder:"owner/repo",value:d,onChange:p=>O(p.target.value)})]}),e.jsxs("label",{className:"github-extension-ref-input",children:[e.jsx("span",{children:"Branch, tag, or SHA"}),e.jsx("input",{disabled:!n||m!==null,placeholder:"Default branch",value:u,onChange:p=>$(p.target.value)})]}),e.jsxs("button",{className:"settings-secondary",disabled:!n||!d.trim()||m!==null,type:"submit",children:[m==="preview"?e.jsx(le,{className:"settings-spin",size:14}):e.jsx(Xe,{size:14}),m==="preview"?"Checking":"Preview"]})]}),f||s.error?e.jsx("div",{className:"github-extension-message error",role:"alert",children:f??s.error}):null,o?e.jsxs("div",{className:"github-extension-preview",children:[e.jsxs("div",{children:[e.jsxs("strong",{children:[o.owner,"/",o.repo]}),e.jsxs("span",{children:[o.skills.length," skill",o.skills.length===1?"":"s"," at ",o.resolvedCommit.slice(0,12)]})]}),e.jsx("div",{className:"github-extension-preview-skills",children:o.skills.map(p=>e.jsx("span",{children:p.name},p.relativePath))}),e.jsxs("button",{className:"settings-secondary",disabled:m!==null,type:"button",onClick:()=>{P()},children:[m==="install"?e.jsx(le,{className:"settings-spin",size:14}):e.jsx(fe,{size:14}),m==="install"?"Installing":"Install extension"]})]}):null,s.extensions.length?s.extensions.map(p=>{const N=m===`update:${p.id}`,b=m===`remove:${p.id}`;return e.jsxs("div",{className:"github-extension-row",children:[e.jsxs("button",{"aria-label":`Open ${p.owner}/${p.repo} extension source`,className:"github-extension-open",disabled:!n||m!==null,type:"button",onClick:()=>l(p),children:[e.jsx("span",{className:"native-skill-icon","aria-hidden":"true",children:e.jsx(Xe,{size:17})}),e.jsxs("span",{className:"native-skill-identity",children:[e.jsxs("strong",{children:[p.owner,"/",p.repo]}),e.jsx("span",{children:p.skills.map(j=>j.name).join(", ")})]}),e.jsxs("span",{className:"native-skill-provider",children:[e.jsxs("strong",{children:[p.skills.length," skill",p.skills.length===1?"":"s"]}),e.jsxs("span",{children:[p.requestedRef," · ",p.resolvedCommit.slice(0,12)]})]}),e.jsx("span",{className:`native-skill-status ${p.validationStatus==="valid"?"":"invalid"}`,children:p.validationStatus==="valid"?"Ready":"Needs attention"}),e.jsx(Vs,{size:16,"aria-hidden":"true"})]}),e.jsxs("span",{className:"github-extension-row-actions",children:[e.jsx("button",{"aria-label":`Update ${p.owner}/${p.repo}`,className:"settings-icon-button ghost",disabled:m!==null,title:"Update extension",type:"button",onClick:()=>{R(p)},children:N?e.jsx(le,{className:"settings-spin",size:14}):e.jsx(ie,{size:14})}),e.jsx("button",{"aria-label":`Remove ${p.owner}/${p.repo}`,className:"settings-icon-button ghost danger",disabled:m!==null,title:"Remove extension",type:"button",onClick:()=>{A(p)},children:b?e.jsx(le,{className:"settings-spin",size:14}):e.jsx(Se,{size:14})})]})]},p.id)}):e.jsx("div",{className:"skills-settings-empty",children:"No third-party extensions installed."})]})}function Ea({onOpenSkill:s,onOpenExtension:n,personalSkills:a,extensionCatalog:t,connection:l,onExtensionCatalog:i,onError:d,onToast:c}){return e.jsxs("section",{className:"account-settings skills-settings","aria-labelledby":"skills-settings-title",children:[e.jsx("header",{className:"skills-settings-header",children:e.jsxs("div",{children:[e.jsx("h1",{id:"skills-settings-title",children:"Skills"}),e.jsx("p",{children:"Install third-party GitHub packs, inspect personal Codex skills, and view instructions bundled with OpenPond."})]})}),e.jsx($a,{catalog:t,connection:l,onCatalog:i,onError:d,onOpenExtension:n,onToast:c}),e.jsxs("div",{className:"account-list native-skills-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Personal Codex skills"}),e.jsx("small",{children:"Discovered from your local Codex skills folder"})]}),a.length?a.map(u=>e.jsxs("div",{className:"native-skill-row personal-skill-row",children:[e.jsx("span",{className:"native-skill-icon","aria-hidden":"true",children:e.jsx(Le,{size:17})}),e.jsxs("span",{className:"native-skill-identity",children:[e.jsx("strong",{children:u.name}),e.jsx("span",{children:u.description||"Packaged Codex skill"})]}),e.jsxs("span",{className:"native-skill-provider",children:[e.jsx("strong",{children:u.resourceFiles.length?`${u.resourceFiles.length} packaged resource${u.resourceFiles.length===1?"":"s"}`:"Instructions only"}),e.jsx("span",{children:u.sourcePath})]}),e.jsx("span",{className:`native-skill-status ${u.validationStatus==="valid"?"":"invalid"}`,children:u.validationStatus==="valid"?"Ready":"Needs attention"}),e.jsx("span",{"aria-hidden":"true"})]},u.sourcePath)):e.jsx("div",{className:"skills-settings-empty",children:"No personal Codex skills found."})]}),e.jsxs("div",{className:"account-list native-skills-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"App integration skills"}),e.jsx("small",{children:"Bundled with this OpenPond build"})]}),In.map(u=>{const g=Mn(u.provider)?.label??u.provider;return e.jsxs("button",{className:"native-skill-row",type:"button",onClick:()=>s(u),children:[e.jsx("span",{className:"native-skill-icon","aria-hidden":"true",children:e.jsx(Le,{size:17})}),e.jsxs("span",{className:"native-skill-identity",children:[e.jsx("strong",{children:u.name}),e.jsx("span",{children:u.description})]}),e.jsxs("span",{className:"native-skill-provider",children:[e.jsx("strong",{children:g}),e.jsx("span",{children:u.path})]}),e.jsx("span",{className:"native-skill-status",children:"Built in"}),e.jsx(Vs,{size:16,"aria-hidden":"true"})]},u.name)})]})]})}const us="default";function Ia({connection:s,embedded:n=!1,onError:a,onPreferences:t,preferences:l,providers:i}){const d=l.training,[c,u]=r.useState(Ye(d.defaultModelRef)),[g,o]=r.useState(d.creationMode),[h,m]=r.useState(d.autoApproveEvidence),[x,f]=r.useState(!1),v=r.useMemo(()=>Fs(i,{includeUnavailable:!0}),[i]),S=r.useMemo(()=>v.map(y=>({provider:y,models:Ue(y.value,i)})).filter(y=>y.models.length>0),[v,i]),C=Ma(c),k=On(l.defaultChatProvider,l.defaultChatModel,i)?` · ${Oa(l.codexReasoningEffort)} reasoning`:"",P=Ta(C,d.defaultModelRef??null)&&g===d.creationMode&&h===d.autoApproveEvidence;r.useEffect(()=>{u(Ye(d.defaultModelRef)),o(d.creationMode),m(d.autoApproveEvidence)},[l.defaultChatModel,l.defaultChatProvider,d.autoApproveEvidence,d.creationMode,d.defaultModelRef]);async function R(y){if(y.preventDefault(),!!s){f(!0),a(null);try{t(await M.savePreferences(s,{training:{defaultModelRef:C,creationMode:g,autoApproveEvidence:h}}))}catch(A){a(A instanceof Error?A.message:String(A))}finally{f(!1)}}}return e.jsxs("section",{className:`account-settings training-settings${n?" embedded":""}`,children:[n?null:e.jsx("h1",{children:"Training"}),e.jsxs("form",{className:"provider-settings-form",onSubmit:y=>{R(y)},children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Taskset authoring"}),e.jsx("small",{children:"The coding model that proposes tasks, graders, fixtures, and policy boundaries"})]}),e.jsx("div",{className:"provider-settings-grid single",children:e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Authoring model"}),e.jsxs("select",{value:c,disabled:x,onChange:y=>u(y.target.value),children:[e.jsxs("option",{value:us,children:["Use chat default — ",Te(l.defaultChatProvider,i)," · ",ss(l.defaultChatModel,i,l.defaultChatProvider),k]}),S.map(y=>e.jsx("optgroup",{label:y.provider.label,children:y.models.map(A=>e.jsx("option",{value:Ye({providerId:y.provider.value,modelId:A.value}),children:A.label},A.value))},y.provider.value))]}),e.jsx("small",{children:"By default, /train follows the same provider, model, and reasoning level selected for chat."})]})}),e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Default flow"}),e.jsx("small",{children:"Used by /train and Task Creator unless you choose another mode"})]}),e.jsx("div",{className:"provider-settings-grid single",children:e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Task Creator mode"}),e.jsxs("select",{value:g,disabled:x,onChange:y=>o(y.target.value),children:[e.jsx("option",{value:"customize",children:"Guided plan — review and revise before materializing"}),e.jsx("option",{value:"defaults",children:"Fast draft — use reversible defaults"})]})]})}),e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Evidence confirmation"}),e.jsx("small",{children:"Controls the first authoring gate; materialization and training remain separate"})]}),e.jsxs("label",{className:"settings-check-row",children:[e.jsx("input",{type:"checkbox",checked:h,disabled:x,onChange:y=>m(y.target.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:"Skip evidence confirmation"}),e.jsx("small",{children:"Immediately send excerpts from explicitly selected chats to the authoring model. This never approves Taskset materialization or training spend."})]})]}),e.jsx("button",{className:"settings-primary",disabled:x||P,children:e.jsx("span",{children:x?"Saving":"Save training settings"})})]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:"Authoring model"}),e.jsx("strong",{children:C?`${Te(C.providerId,i)} / ${ss(C.modelId,i,C.providerId)}`:"Chat default"})]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:"Safety boundary"}),e.jsx("strong",{children:"Taskset and training approvals always required"})]})]})}function Ye(s){return s?JSON.stringify([s.providerId,s.modelId]):us}function Ma(s){if(s===us)return null;try{const n=JSON.parse(s);return!Array.isArray(n)||n.length!==2||typeof n[0]!="string"||typeof n[1]!="string"?null:{providerId:n[0],modelId:n[1]}}catch{return null}}function Oa(s){return`${s.slice(0,1).toUpperCase()}${s.slice(1)}`}function Ta(s,n){return s?.providerId===n?.providerId&&s?.modelId===n?.modelId}function La({disabled:s,onChange:n,storageRoots:a,value:t}){const l=r.useId(),[i,d]=r.useState(!1),c=Os(t),u=h=>h.datasetStorePath,g="Dataset",o=a.find(h=>Os(u(h))===c)??null;return e.jsxs("div",{className:"model-storage-picker",children:[e.jsxs("label",{className:"model-storage-label",htmlFor:l,children:[g," storage"]}),e.jsxs("div",{className:"model-storage-control-row",children:[e.jsxs("select",{"aria-label":`${g} storage drive`,className:"model-storage-select",disabled:s,id:l,title:t??"No Dataset storage configured",value:t??"",onChange:h=>n(h.target.value||null),children:[e.jsx("option",{value:"",children:"Not configured"}),t&&!o?e.jsx("option",{value:t,children:"Manual location"}):null,a.map(h=>e.jsxs("option",{disabled:!h.mounted||!h.writable,title:u(h),value:u(h),children:[h.label," · ",Ha(h.kind)," · ",_a(h)]},h.id))]}),e.jsx("button",{className:"settings-icon-button model-storage-add",disabled:s,type:"button",title:"Add manual location","aria-label":"Add manual Dataset storage location",onClick:()=>d(!0),children:e.jsx(fe,{size:15})})]}),i?za(e.jsx(Ua,{initialPath:t??"",purpose:"dataset",onClose:()=>d(!1),onUse:h=>{n(h),d(!1)}})):null]})}function za(s){return typeof document>"u"?s:Yn.createPortal(s,document.body)}function Ua({initialPath:s,onClose:n,onUse:a,purpose:t="model"}){const l=r.useId(),[i,d]=r.useState(s),c=Ba(i);r.useEffect(()=>{const g=o=>{o.key==="Escape"&&n()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[n]);function u(g){g.preventDefault(),g.stopPropagation(),!c&&a(i.trim())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&n()},children:e.jsxs("form",{className:"git-dialog model-storage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":l,onSubmit:u,children:[e.jsx("button",{className:"git-dialog-close",type:"button",title:"Close","aria-label":`Close manual ${t} storage`,onClick:n,children:e.jsx(oe,{size:15})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(Qn,{size:18})}),e.jsxs("h2",{id:l,children:["Manual ",t," storage"]}),e.jsx("p",{children:"Enter an absolute path to a folder mounted on this machine."}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Mounted folder path"}),e.jsx("input",{autoFocus:!0,spellCheck:!1,value:i,placeholder:t==="dataset"?"/mnt/OpenPond/datasets":"/mnt/models or /run/user/…/gvfs/…",onChange:g=>d(g.target.value)})]}),e.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."}),i.trim()&&c?e.jsx("div",{className:"profile-dialog-warning",children:c}):null,e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",type:"button",onClick:n,children:"Cancel"}),e.jsx("button",{className:"git-dialog-primary",disabled:!!c,type:"submit",children:"Use location"})]})]})})}function Ba(s){const n=s.trim();return n?/^[a-z][a-z\d+.-]*:\/\//i.test(n)?"Use the mounted folder path, not an smb:// or other network URL.":n==="~"||n.startsWith("~/")||n.startsWith("/")||n.startsWith("\\\\")||/^[a-z]:[\\/]/i.test(n)?null:"Enter an absolute mounted folder path.":"Enter a mounted folder path."}function Ha(s){return s==="network"?"Network":s==="removable"?"Removable":s==="cache"?"Cache":"Local"}function _a(s){return s.mounted?s.writable?`${Fa(s.freeBytes)} free`:"Read only":"Not mounted"}function Os(s){const n=(s??"").trim().replace(/[\\/]+$/,"");return/^(?:[a-z]:[\\/]|\\\\)/i.test(n)?n.toLowerCase():n}function Fa(s){if(s==null)return"Unknown";if(s<1024)return`${s} B`;const n=["KB","MB","GB","TB"];let a=s,t=-1;do a/=1024,t+=1;while(a>=1024&&t<n.length-1);return`${a>=10?a.toFixed(0):a.toFixed(1)} ${n[t]}`}function Ga({state:s,catalog:n,busy:a,catalogLoading:t,onRefresh:l,onSave:i}){const[d,c]=r.useState(s?.settings.datasetStorePath??null);r.useEffect(()=>{c(s?.settings.datasetStorePath??null)},[s?.settings.datasetStorePath]);const u=r.useMemo(()=>s?.storageRoots.find(m=>Ts(m.datasetStorePath)===Ts(d))??null,[d,s?.storageRoots]),g=d===(s?.settings.datasetStorePath??null),o=n?.datasets??[];async function h(m){m.preventDefault(),await i(d)}return e.jsxs("section",{className:"account-settings compute-settings dataset-storage-settings",children:[e.jsxs("div",{className:"compute-title-row",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Dataset Storage"}),e.jsx("p",{className:"dataset-storage-intro",children:"Choose where Dataset artifacts are saved and review registered Datasets without loading their rows."})]}),e.jsx("button",{"aria-label":"Refresh Dataset storage",className:"settings-icon-button",disabled:a!==null||t,onClick:()=>{l()},title:"Refresh Dataset storage",type:"button",children:e.jsx(ie,{className:t?"settings-spin":void 0,size:15})})]}),e.jsx("div",{className:"account-summary",children:e.jsx("div",{className:"account-summary-main compute-summary-main",children:e.jsxs("div",{children:[e.jsx("strong",{children:u?.label??(d?"Manual location":"Not configured")}),e.jsx("small",{children:d??"Choose a writable local or mounted location before importing a Dataset."}),u?e.jsxs("small",{children:[Ka(u.kind)," · ",u.freeBytes==null?"Free space unknown":`${ln(u.freeBytes)} free`]}):null]})})}),e.jsxs("form",{className:"provider-settings-form",onSubmit:m=>{h(m)},children:[e.jsx("div",{className:"account-list-heading",children:e.jsx("span",{children:"Location"})}),e.jsx(La,{disabled:a!==null,onChange:c,storageRoots:s?.storageRoots??[],value:d}),e.jsx("button",{className:"settings-primary",disabled:a!==null||g,children:a==="save"?"Saving":"Save Dataset storage"})]}),e.jsxs("div",{className:"account-list dataset-storage-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Registered Datasets"}),e.jsx("small",{children:o.length})]}),o.length?o.map(m=>e.jsx(qa,{dataset:m},m.tasksetId)):e.jsx("div",{className:"empty-account-list",children:e.jsx("span",{children:t?"Loading registered Datasets":"No registered Datasets"})})]})]})}function qa({dataset:s}){const n=s.storageKind==="parquet"?"Parquet":"Inline Taskset";return e.jsxs("div",{className:"compute-row dataset-storage-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:s.name}),e.jsxs("small",{children:[rn(s.rowCount)," rows"," · ",Va(s)," · ",n," · ",s.sizeBytes==null?"Size unavailable":ln(s.sizeBytes)]}),!s.available&&s.unavailableReason?e.jsx("small",{className:"dataset-storage-error",children:s.unavailableReason}):null]}),e.jsx("span",{children:s.available?Wa(s.status):"Unavailable"})]})}function Va(s){return[["train",s.splitCounts.train],["validation",s.splitCounts.validation],["test",s.splitCounts.test],["frozen eval",s.splitCounts.frozen_eval]].filter(([,a])=>Number(a)>0).map(([a,t])=>`${rn(Number(t))} ${a}`).join(" · ")||"No split rows"}function ln(s){if(s<1024)return`${s} B`;const n=["KB","MB","GB","TB"];let a=s,t=-1;do a/=1024,t+=1;while(a>=1024&&t<n.length-1);return`${a>=10?a.toFixed(0):a.toFixed(1)} ${n[t]}`}function rn(s){return new Intl.NumberFormat().format(s)}function Ts(s){return s?.replace(/[\\/]+$/,"")??""}function Wa(s){return s.replaceAll("_"," ").replace(/^./,n=>n.toUpperCase())}function Ka(s){return s.replace(/^./,n=>n.toUpperCase())}function Ee(s){if(!s)return"Not yet";const n=new Date(s);return Number.isNaN(n.valueOf())?s:n.toLocaleString()}function we(s){return s?s.slice(0,10):"none"}function ve(s){const n=s.replaceAll("_"," ");return`${n.charAt(0).toUpperCase()}${n.slice(1)}`}function Ja(s){return s==="unresolved"?"Watching":s==="confirmed"?"Ready for Refiner":ve(s)}function Ya({review:s}){const n=[["Taskset",s.tasksetProposal],["Baseline evaluation",s.evaluation],["Training qualification",s.trainingQualification]];return e.jsx("div",{className:"harness-review-lineage","aria-label":"Review lineage",children:n.map(([a,t])=>e.jsxs("div",{className:t?"linked":"pending",children:[e.jsx("span",{children:a}),e.jsx("code",{children:t?we(t.contentHash):"Not created"})]},a))})}function Qa({candidate:s}){return e.jsxs("details",{className:"harness-disclosure-row",children:[e.jsxs("summary",{children:[e.jsx("span",{className:`harness-status harness-status-${s.status}`,children:Ja(s.status)}),e.jsx("strong",{children:s.statement}),e.jsxs("small",{children:[s.occurrences.length," occurrence",s.occurrences.length===1?"":"s"]}),e.jsx("time",{children:Ee(s.updatedAt)})]}),e.jsxs("div",{className:"harness-disclosure-body",children:[e.jsx("p",{children:s.resolution?.reason??s.recurrenceFamily}),e.jsxs("dl",{className:"harness-compact-metadata",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Pattern"}),e.jsx("dd",{children:s.recurrenceFamily})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Fingerprint"}),e.jsx("dd",{children:e.jsx("code",{children:we(s.fingerprint)})})]})]}),s.occurrences.length?e.jsxs("details",{className:"harness-history-details",children:[e.jsx("summary",{children:"Evidence receipts"}),e.jsx("ul",{className:"harness-evidence-list",children:s.occurrences.map(n=>e.jsxs("li",{children:[e.jsx("span",{children:ve(n.kind)}),e.jsx("code",{children:we(n.evidence.contentHash)}),e.jsx("time",{children:Ee(n.occurredAt)})]},`${n.evidence.id}:${n.evidence.contentHash}`))})]}):null]})]})}function Za({accepting:s,onAcceptTasksetReview:n,review:a}){const t=a.classification==="taskset"&&a.nextAuthority==="human_review"&&a.tasksetProposal===null;return e.jsxs("details",{className:"harness-disclosure-row",children:[e.jsxs("summary",{children:[e.jsx("span",{className:`harness-status harness-status-${a.classification}`,children:ve(a.classification)}),e.jsx("strong",{children:a.claim?.statement??a.reason}),e.jsxs("small",{children:[a.selectedEvidence.length," selected"]}),e.jsx("time",{children:Ee(a.createdAt)})]}),e.jsxs("div",{className:"harness-disclosure-body",children:[e.jsx("p",{children:a.reason}),e.jsxs("div",{className:"harness-review-metrics",children:[e.jsxs("span",{children:[e.jsx("strong",{children:a.selectedEvidence.length})," selected"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.excludedEvidence.length})," excluded"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.claim?.independentOccurrences??0})," independent occurrences"]}),e.jsxs("span",{children:["Next: ",e.jsx("strong",{children:ve(a.nextAuthority)})]})]}),e.jsx(Ya,{review:a}),t?e.jsx("div",{className:"harness-history-actions",children:e.jsx("button",{className:"settings-primary compact",disabled:s,onClick:()=>n(a),type:"button",children:s?"Opening Taskset review…":"Build training Taskset"})}):null]})]})}function Xa({receipt:s}){return e.jsxs("details",{className:"harness-disclosure-row",children:[e.jsxs("summary",{children:[e.jsx("span",{className:`harness-status harness-status-${s.decision}`,children:ve(s.decision)}),e.jsxs("strong",{children:[s.model.provider,"/",s.model.model]}),e.jsxs("small",{children:[ve(s.signal.strength)," signal"]}),e.jsx("time",{children:Ee(s.createdAt)})]}),e.jsxs("div",{className:"harness-disclosure-body",children:[e.jsx("p",{children:s.reasons.join(" ")}),e.jsxs("dl",{className:"harness-compact-metadata",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Review"}),e.jsx("dd",{children:e.jsx("code",{children:we(s.review.contentHash)})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Taskset"}),e.jsx("dd",{children:e.jsx("code",{children:we(s.tasksetRelease?.contentHash)})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Baseline"}),e.jsx("dd",{children:e.jsx("code",{children:we(s.baselineEvaluation?.contentHash)})})]})]})]})]})}function el({acceptingReviewId:s,candidates:n,onAcceptTasksetReview:a,qualifications:t,reviews:l,schedule:i}){const d=i.activityEnabled||i.enabled;return e.jsxs("div",{className:"harness-page-sections",children:[e.jsx("section",{className:"harness-history-section","aria-label":"Continuous Review status",children:e.jsx("div",{className:"harness-table-wrap",children:e.jsxs("table",{className:"harness-table harness-review-status-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Trigger"}),e.jsx("th",{children:"Last review"}),e.jsx("th",{children:"Last result"})]})}),e.jsx("tbody",{children:e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("span",{className:`harness-status ${d?"harness-status-advanced":""}`,children:d?"On":"Off"})}),e.jsx("td",{children:i.activityEnabled?`${i.activityBatchSize} new outcomes`:"Manual only"}),e.jsx("td",{children:Ee(i.lastRunAt)}),e.jsx("td",{children:i.lastResult?ve(i.lastResult.classification):"No completed review"})]})})]})})}),e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Patterns"}),e.jsx("p",{children:"Recurring evidence being watched or ready for the Refiner."})]}),e.jsx("span",{children:n.length})]}),e.jsx("div",{className:"harness-disclosure-list",children:n.length?n.map(c=>e.jsx(Qa,{candidate:c},`${c.id}:${c.contentHash}`)):e.jsx("div",{className:"harness-empty compact",children:"No recurring patterns are being tracked."})})]}),e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Review history"}),e.jsx("p",{children:"Receipts stay compact; expand one for evidence and downstream lineage."})]}),e.jsx("span",{children:l.length})]}),e.jsx("div",{className:"harness-disclosure-list",children:l.length?l.map(c=>e.jsx(Za,{accepting:s===c.id,onAcceptTasksetReview:a,review:c},`${c.id}:${c.contentHash}`)):e.jsx("div",{className:"harness-empty compact",children:"No Continuous Review receipts yet."})})]}),t.length?e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Training handoffs"}),e.jsx("p",{children:"Evidence-bound qualification receipts created for Models."})]}),e.jsx("span",{children:t.length})]}),e.jsx("div",{className:"harness-disclosure-list",children:t.map(c=>e.jsx(Xa,{receipt:c},`${c.id}:${c.contentHash}`))})]}):null]})}const sl="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 Ls(s){const n=new Date(s);return Number.isNaN(n.valueOf())?s:n.toLocaleString()}function Ne(s){return s?s.slice(0,10):"none"}function nl({busyReleaseHash:s,history:n,onRequestRelease:a,onStartAuthoring:t}){const l=r.useMemo(()=>{const i=new Map;for(const d of n.transitions)i.has(d.nextRelease.contentHash)||i.set(d.nextRelease.contentHash,d);return i},[n.transitions]);return e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Review Profile"}),e.jsx("p",{children:"Separately versioned policy composed with the immutable Refiner Core."})]}),t?e.jsx("button",{className:"settings-primary compact",onClick:()=>t(sl),type:"button",children:"Edit with Work"}):null]}),e.jsxs("div",{className:"harness-summary-grid",children:[e.jsxs("article",{children:[e.jsx("span",{children:"Active release"}),e.jsx("strong",{children:Ne(n.binding.release.contentHash)}),e.jsxs("small",{children:["Binding revision ",n.binding.revision]})]}),e.jsxs("article",{children:[e.jsx("span",{children:"Profile"}),e.jsx("strong",{children:n.currentRelease.profile.name}),e.jsxs("small",{children:[n.currentRelease.profile.id,"@",n.currentRelease.profile.version]})]}),e.jsxs("article",{children:[e.jsx("span",{children:"Core"}),e.jsx("strong",{children:n.currentRelease.coreVersion}),e.jsx("small",{children:Ne(n.currentRelease.coreHash)})]})]}),e.jsx("p",{children:n.currentRelease.profile.objective}),n.currentRelease.profile.instructions.length?e.jsx("div",{className:"harness-edit-list",children:n.currentRelease.profile.instructions.map(i=>e.jsx("section",{className:"harness-edit",children:e.jsxs("div",{children:[e.jsx("strong",{children:i.id}),e.jsx("span",{children:i.text})]})},i.id))}):e.jsx("div",{className:"harness-empty compact",children:"The default profile adds no instructions beyond the Refiner Core."})]}),e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Profile releases"}),e.jsx("p",{children:"Immutable definition history. Rollback changes future reviews only."})]}),e.jsx("span",{children:n.releases.length})]}),e.jsx("div",{className:"harness-table-wrap",children:e.jsxs("table",{className:"harness-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Profile"}),e.jsx("th",{children:"Release"}),e.jsx("th",{children:"Created"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx("tbody",{children:n.releases.map(i=>{const d=i.contentHash===n.binding.release.contentHash,c=!d&&l.get(i.contentHash)?.bindingChanged===!1,u=c?"activate":"rollback";return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("strong",{children:i.profile.name}),e.jsxs("small",{children:[i.profile.id,"@",i.profile.version," · ",i.profile.instructions.length," instructions"]})]}),e.jsx("td",{children:e.jsx("code",{children:Ne(i.contentHash)})}),e.jsx("td",{children:Ls(i.createdAt)}),e.jsx("td",{children:e.jsx("span",{className:"harness-status",children:d?"active":c?"draft":"immutable"})}),e.jsx("td",{children:d?null:e.jsx("button",{"aria-label":`${c?"Activate":"Roll back"} Refiner release`,className:"harness-table-icon-action",disabled:s!==null,onClick:()=>a(i,u),title:`${c?"Activate":"Roll back"} Refiner release`,type:"button",children:c?e.jsx(os,{size:14}):e.jsx(He,{size:14})})})]},i.contentHash)})})]})})]}),e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Definition changes"}),e.jsx("p",{children:"Receipts record which release changed, why, and which authoring Skill produced it."})]}),e.jsx("span",{children:n.transitions.length})]}),e.jsx("div",{className:"harness-table-wrap",children:e.jsxs("table",{className:"harness-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Operation"}),e.jsx("th",{children:"Change"}),e.jsx("th",{children:"Release transition"}),e.jsx("th",{children:"Validation"}),e.jsx("th",{children:"Created"})]})}),e.jsx("tbody",{children:n.transitions.map(i=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsxs("span",{className:"harness-status",children:[i.operation,i.bindingChanged?" · active":" · draft"]})}),e.jsxs("td",{children:[e.jsx("strong",{children:i.reason}),e.jsx("small",{children:i.authoringSkillHash?`Skill ${Ne(i.authoringSkillHash)}`:i.actor})]}),e.jsx("td",{children:e.jsxs("code",{children:[Ne(i.previousRelease?.contentHash)," → ",Ne(i.nextRelease.contentHash)]})}),e.jsx("td",{children:i.validation.valid?"Passed":i.validation.messages.join("; ")}),e.jsx("td",{children:Ls(i.createdAt)})]},i.contentHash))})]})})]})]})}const tl={enabled:!1,activityEnabled:!1,activityBatchSize:10,cadence:"manual",maxEstimatedCostUsd:.1,nextRunAt:null,lastRunAt:null,lastResult:null,lastError:null,updatedAt:null},al={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 ke(s){if(!s)return"Not yet";const n=new Date(s);return Number.isNaN(n.valueOf())?s:n.toLocaleString()}function Pe(s){return s?s.slice(0,10):"none"}function zs(s,n,a){return{workspaceId:s,baseRelease:n?{id:n.id,contentHash:n.contentHash}:null,targetRelease:{id:a.id,contentHash:a.contentHash},title:a.current?"Current Harness release":`Harness release ${Pe(a.contentHash)}`}}function ll({review:s,busy:n,onReview:a}){return e.jsxs("article",{className:"harness-history-card harness-review-card",children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"harness-history-kicker",children:[e.jsx("span",{className:"harness-status harness-status-retained",children:"review required"}),e.jsxs("span",{children:[s.proposal.route," · ",s.proposal.edits[0]?.operation??"change"]})]}),e.jsx("h2",{children:s.proposal.expectedOutcome})]}),e.jsx("time",{children:ke(s.proposal.createdAt)})]}),e.jsx("p",{children:s.proposal.edits.map(t=>t.summary).join(" ")}),e.jsxs("details",{className:"harness-history-details",children:[e.jsxs("summary",{children:["Exact edits (",s.proposal.edits.length,")"]}),e.jsx("div",{className:"harness-edit-list",children:s.proposal.edits.map(t=>e.jsxs("section",{className:"harness-edit",children:[e.jsxs("div",{children:[e.jsxs("strong",{children:[t.operation," · ",t.target]}),e.jsx("span",{children:t.summary})]}),t.content!==null?e.jsx("pre",{children:t.content}):e.jsx("p",{children:"File deleted."})]},t.id))})]}),s.validations.length?e.jsxs("details",{className:"harness-history-details",children:[e.jsxs("summary",{children:["Validation receipts (",s.validations.length,")"]}),e.jsx("div",{className:"harness-validation-list",children:s.validations.map(t=>e.jsxs("div",{children:[e.jsx("span",{className:`harness-validation-status ${t.status}`,children:t.status}),e.jsx("strong",{children:t.kind.replaceAll("_"," ")}),e.jsx("span",{children:t.summary})]},t.id))})]}):null,e.jsxs("footer",{className:"harness-review-actions",children:[e.jsxs("button",{className:"settings-secondary compact",disabled:n,onClick:()=>a(s,"decline"),type:"button",children:[e.jsx(oe,{size:13})," Decline"]}),e.jsxs("button",{className:"settings-primary compact",disabled:n||s.validations.some(t=>t.status!=="passed"),onClick:()=>a(s,"approve"),type:"button",children:[e.jsx(os,{size:13})," Approve and release"]})]})]})}function il({change:s,onClose:n}){const a=s.proposal;return e.jsxs(Zn,{ariaLabel:"Refiner change details",backdropClassName:"harness-details-dialog-backdrop",className:"harness-details-dialog",onClose:n,children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsx("span",{className:`harness-status harness-status-${s.receipt.decision}`,children:s.receipt.decision.replaceAll("_"," ")}),e.jsx("h2",{children:a?.expectedOutcome??s.receipt.reason}),e.jsx("p",{children:s.receipt.reason})]}),e.jsx("button",{"aria-label":"Close change details",onClick:n,type:"button",children:e.jsx(oe,{size:16})})]}),e.jsxs("div",{className:"harness-details-dialog-body",children:[a?.edits.length?e.jsxs("section",{children:[e.jsx("h3",{children:"Exact edits"}),e.jsx("div",{className:"harness-edit-list",children:a.edits.map(t=>e.jsxs("article",{className:"harness-edit",children:[e.jsxs("div",{children:[e.jsxs("strong",{children:[t.operation," · ",t.target]}),e.jsx("span",{children:t.summary})]}),t.content!==null?e.jsx("pre",{children:t.content}):e.jsx("p",{children:"File deleted."})]},t.id))})]}):null,s.validations.length?e.jsxs("section",{children:[e.jsx("h3",{children:"Validation"}),e.jsx("div",{className:"harness-validation-list",children:s.validations.map(t=>e.jsxs("div",{children:[e.jsx("span",{className:`harness-validation-status ${t.status}`,children:t.status}),e.jsx("strong",{children:t.kind.replaceAll("_"," ")}),e.jsx("span",{children:t.summary})]},t.id))})]}):null]})]})}function rl({history:s,reviewingProposalId:n,onReviewProposal:a}){const t=r.useMemo(()=>[...s.changes.map(l=>({id:`change:${l.receipt.id}`,at:l.receipt.createdAt,kind:"Refiner",title:l.proposal?.expectedOutcome??l.receipt.reason,detail:l.receipt.decision.replaceAll("_"," ")})),...s.routes.map(l=>({id:`route:${l.decision.id}`,at:l.decision.createdAt,kind:"Routed",title:l.decision.reason,detail:l.decision.route})),...s.evaluationReviews.map(l=>({id:`review:${l.id}`,at:l.createdAt,kind:"Continuous Review",title:l.claim?.statement??l.reason,detail:l.classification.replaceAll("_"," ")}))].sort((l,i)=>i.at.localeCompare(l.at)).slice(0,6),[s]);return e.jsxs("div",{className:"harness-page-sections",children:[s.pendingReviews.length?e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Needs review"}),e.jsx("p",{children:"Sensitive or high-impact proposals require your approval."})]}),e.jsx("span",{children:s.pendingReviews.length})]}),s.pendingReviews.map(l=>e.jsx(ll,{busy:n!==null,onReview:a,review:l},`${l.proposal.id}:${l.proposal.contentHash}`))]}):null,e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Recent activity"}),e.jsx("p",{children:"The latest events from both learning loops."})]}),e.jsx("span",{children:t.length})]}),t.length?e.jsx("div",{className:"harness-activity-list",children:t.map(l=>e.jsxs("article",{children:[e.jsx("span",{children:l.kind}),e.jsxs("div",{children:[e.jsx("strong",{children:l.title}),e.jsx("small",{children:l.detail})]}),e.jsx("time",{children:ke(l.at)})]},l.id))}):e.jsx("div",{className:"harness-empty compact",children:"No Harness learning activity yet."})]})]})}function ol({history:s,refiner:n,busyReleaseHash:a,onRequestRefinerRelease:t,onStartRefinerAuthoring:l,onOpenChangeDiff:i,onOpenSourceSession:d}){const[c,u]=r.useState(null);return e.jsxs("div",{className:"harness-page-sections",children:[e.jsx(nl,{busyReleaseHash:a,history:n,onRequestRelease:t,onStartAuthoring:l}),e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Applied changes"}),e.jsx("p",{children:"Every release transition with exact edits and validation receipts."})]}),e.jsx("span",{children:s.changes.length})]}),s.changes.length?e.jsx("div",{className:"harness-table-wrap",children:e.jsxs("table",{className:"harness-table harness-refiner-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Change"}),e.jsx("th",{children:"Target"}),e.jsx("th",{children:"Release"}),e.jsx("th",{children:"Created"}),e.jsx("th",{children:"Result"}),e.jsx("th",{children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx("tbody",{children:s.changes.map(g=>{const o=g.trigger?.runRef??null,h=g.proposal;return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:h?.expectedOutcome??g.receipt.reason})}),e.jsx("td",{children:e.jsx("code",{children:h?.edits[0]?.target??h?.route??"workspace"})}),e.jsx("td",{children:e.jsx("code",{children:Pe(g.receipt.nextRelease?.contentHash)})}),e.jsx("td",{children:ke(g.receipt.createdAt)}),e.jsx("td",{children:e.jsx("span",{className:`harness-status harness-status-${g.receipt.decision}`,children:g.receipt.decision.replaceAll("_"," ")})}),e.jsx("td",{children:e.jsxs("div",{className:"harness-inline-actions",children:[e.jsx("button",{"aria-label":"View evidence and exact edits",className:"harness-table-icon-action",onClick:()=>u(g),title:"View evidence and exact edits",type:"button",children:e.jsx(tt,{size:14})}),g.receipt.nextRelease?e.jsx("button",{"aria-label":"View release diff",className:"harness-table-icon-action",onClick:()=>i(g),title:"View release diff",type:"button",children:e.jsx(Qs,{size:14})}):null,o&&d?e.jsx("button",{"aria-label":"Open source conversation",className:"harness-table-icon-action",onClick:()=>d(o),title:"Open source conversation",type:"button",children:e.jsx(qs,{size:14})}):null]})})]},`${g.receipt.id}:${g.receipt.contentHash}`)})})]})}):e.jsx("div",{className:"harness-empty compact",children:"No Harness changes have been applied."})]}),e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Routed recommendations"}),e.jsx("p",{children:"Observations sent to runtime, product, Tasksets, or training without mutating the Harness."})]}),e.jsx("span",{children:s.routes.length})]}),s.routes.length?e.jsx("div",{className:"harness-table-wrap",children:e.jsxs("table",{className:"harness-table harness-route-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Recommendation"}),e.jsx("th",{children:"Source evidence"}),e.jsx("th",{children:"Created"}),e.jsx("th",{children:"Route"})]})}),e.jsx("tbody",{children:s.routes.map(g=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("p",{children:g.decision.reason})}),e.jsx("td",{children:e.jsx("p",{children:g.trigger?.reason??"Completed work"})}),e.jsx("td",{children:ke(g.decision.createdAt)}),e.jsx("td",{children:e.jsx("span",{className:"harness-status",children:g.decision.route})})]},`${g.decision.id}:${g.decision.contentHash}`))})]})}):e.jsx("div",{className:"harness-empty compact",children:"No recommendations have been routed."})]}),c?e.jsx(il,{change:c,onClose:()=>u(null)}):null]})}function cl(s){return s.includes("/skills/")||s.startsWith("skills/")?"Skill":s.includes("/agents/")||s.startsWith("agents/")?"Agent":s.includes("memory")?"Memory":s.endsWith(".md")?"Instruction":"File"}function dl(s){return s<1024?`${s} B`:`${(s/1024).toFixed(s<10240?1:0)} KB`}function ul({history:s,onOpenCurrentRelease:n}){const a=s.releases.find(t=>t.current)??s.releases[0]??null;return e.jsxs("div",{className:"harness-page-sections",children:[e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Current release"}),e.jsx("p",{children:"Read-only source contents currently supplied by the Personal Harness."})]}),a?e.jsx("button",{className:"settings-secondary compact",onClick:n,type:"button",children:"View release diff"}):null]}),a?.files.length?e.jsx("div",{className:"harness-table-wrap",children:e.jsxs("table",{className:"harness-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Source"}),e.jsx("th",{children:"Size"}),e.jsx("th",{children:"Revision"})]})}),e.jsx("tbody",{children:a.files.map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("span",{className:"harness-status",children:cl(t.path)})}),e.jsx("td",{children:e.jsx("code",{children:t.path})}),e.jsx("td",{children:dl(t.sizeBytes)}),e.jsx("td",{children:e.jsx("code",{children:Pe(t.contentHash)})})]},t.id))})]})}):e.jsx("div",{className:"harness-empty compact",children:"The current release has no source files."})]}),e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Memory"}),e.jsx("p",{children:"Bounded memory available through search; it is not copied into every prompt."})]}),e.jsx("span",{children:s.memories.length})]}),e.jsx("div",{className:"harness-disclosure-list",children:s.memories.length?s.memories.map(t=>e.jsxs("details",{className:"harness-disclosure-row",children:[e.jsxs("summary",{children:[e.jsx("span",{className:"harness-status",children:"Memory"}),e.jsx("strong",{children:t.key}),e.jsxs("small",{children:["revision ",t.revision]}),e.jsx("time",{children:ke(t.updatedAt)})]}),e.jsxs("div",{className:"harness-disclosure-body",children:[e.jsx("p",{children:t.content}),t.tags.length?e.jsx("small",{children:t.tags.join(" · ")}):null]})]},`${t.id}:${t.revision}`)):e.jsx("div",{className:"harness-empty compact",children:"No Harness memory has been saved."})})]})]})}function hl({busy:s,history:n,onOpenDiff:a,onRequestRollback:t}){return e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Release history"}),e.jsx("p",{children:"New work uses the current release; active runs stay pinned to the version they started with."})]}),e.jsx("span",{children:n.releases.length})]}),n.releases.length?e.jsx("div",{className:"harness-table-wrap",children:e.jsxs("table",{className:"harness-table harness-release-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Release"}),e.jsx("th",{children:"Contents"}),e.jsx("th",{children:"Created"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx("tbody",{children:n.releases.map((l,i)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsxs("div",{className:"harness-release-identity",children:[e.jsx("strong",{children:l.id}),e.jsx("code",{children:Pe(l.contentHash)})]})}),e.jsxs("td",{children:[l.files.length," files"]}),e.jsx("td",{children:ke(l.createdAt)}),e.jsx("td",{children:l.current?e.jsx("span",{className:"harness-current-pill",children:"Current"}):e.jsx("span",{className:"harness-status",children:"Previous"})}),e.jsx("td",{children:e.jsxs("div",{className:"harness-inline-actions",children:[e.jsx("button",{"aria-label":"View release changes",className:"harness-table-icon-action",onClick:()=>a(n.releases[i+1]??null,l),title:"View release changes",type:"button",children:e.jsx(Qs,{size:14})}),l.current?null:e.jsx("button",{"aria-label":"Roll back to release",className:"harness-table-icon-action",disabled:s,onClick:()=>t(l),title:"Roll back to release",type:"button",children:e.jsx(He,{size:14})})]})})]},`${l.id}:${l.contentHash}`))})]})}):e.jsx("div",{className:"harness-empty compact",children:"No Harness releases exist yet."})]})}function ml({connection:s,enabled:n,onAcceptEvaluationReview:a,onError:t,onDefaultReleaseDiff:l,onOpenReleaseDiff:i,onOpenSourceSession:d,onStartRefinerAuthoring:c,onToast:u,page:g}){const[o,h]=r.useState(null),[m,x]=r.useState(null),[f,v]=r.useState(null),[S,C]=r.useState(!1),[k,P]=r.useState(null),[R,y]=r.useState(null),[A,O]=r.useState(!1),[$,p]=r.useState(!1),[N,b]=r.useState(null),{confirmAction:j,confirmDialog:T,resolveConfirmDialog:H}=Bs(),F=!!(o?.evaluationReviewSchedule.activityEnabled||o?.evaluationReviewSchedule.enabled),[V,Z]=r.useState(!1),[E,U]=r.useState(!1);r.useEffect(()=>{o&&Z(o.backgroundReview.enabled)},[o?.backgroundReview.enabled]),r.useEffect(()=>{U(F)},[F]);const J=r.useCallback(async()=>{if(s){C(!0);try{const[w,D]=await Promise.all([M.harnessHistory(s),M.refinerHistory(s)]);h(w),x(D);const z=w.releases.findIndex(te=>te.current),B=z>=0?w.releases[z]:null;w.workspace&&B&&l(zs(w.workspace.id,w.releases[z+1]??null,B)),t(null)}catch(w){t(w instanceof Error?w.message:String(w))}finally{C(!1)}}},[s,l,t]);r.useEffect(()=>{n&&J()},[n,g,J]);const Y=r.useCallback(async w=>{if(!(!s||!o?.workspace)){p(!0);try{const D=await M.reviewHarnessEvaluation(s,{workspaceId:o.workspace.id,maxEstimatedCostUsd:w});h(D.history),t(null),u?.(`Continuous Review completed: ${D.receipt.classification.replaceAll("_"," ")}.`,"success")}catch(D){t(D instanceof Error?D.message:String(D))}finally{p(!1)}}},[s,o,t,u]),W=r.useCallback(async(w,D,z)=>{if(!(!s||!o?.workspace)){O(!0);try{let B=o;w==="refiner"&&D!==o.backgroundReview.enabled&&(B=(await M.updateHarnessBackgroundReview(s,{workspaceId:o.workspace.id,enabled:D})).history);const te=o.evaluationReviewSchedule.activityEnabled||o.evaluationReviewSchedule.enabled;if(w==="continuous-review"&&(z!==te||o.evaluationReviewSchedule.enabled)){const K=o.evaluationReviewSchedule;B=(await M.updateHarnessEvaluationReviewSchedule(s,{workspaceId:o.workspace.id,enabled:!1,activityEnabled:z,activityBatchSize:K.activityBatchSize,cadence:"manual",maxEstimatedCostUsd:K.maxEstimatedCostUsd})).history}h(B),t(null),u?.(`${w==="refiner"?"Refiner":"Continuous Review"} settings applied.`,"success")}catch(B){t(B instanceof Error?B.message:String(B))}finally{O(!1)}}},[s,o,t,u]),re=r.useCallback(async w=>{if(o?.workspace){b(w.id);try{await a(o.workspace.id,{id:w.id,contentHash:w.contentHash})&&(t(null),u?.("Taskset review opened in Models.","success"))}catch(D){t(D instanceof Error?D.message:String(D))}finally{b(null)}}},[o?.workspace,a,t,u]),G=r.useCallback((w,D)=>{o?.workspace&&i(zs(o.workspace.id,w,D))},[o?.workspace,i]),_=r.useCallback(w=>{!o?.workspace||!w.receipt.nextRelease||i({workspaceId:o.workspace.id,baseRelease:w.receipt.previousRelease,targetRelease:w.receipt.nextRelease,title:w.proposal?.expectedOutcome??w.receipt.reason})},[o?.workspace,i]),se=r.useCallback(async w=>{if(!(!s||!o?.workspace)){P(w.contentHash);try{const D=await M.rollbackHarness(s,{workspaceId:o.workspace.id,targetRelease:{id:w.id,contentHash:w.contentHash}});h(D.history),t(null),u?.("Personal Harness rolled back. Existing runs remain pinned.","success")}catch(D){t(D instanceof Error?D.message:String(D))}finally{P(null)}}},[s,o?.workspace,t,u]),ae=r.useCallback(async w=>{await j({title:"Roll back Harness release?",body:`New work will use ${Pe(w.contentHash)}. Active runs remain pinned to their current release.`,confirmLabel:"Roll back"})&&await se(w)},[j,se]),ue=r.useCallback(async(w,D)=>{if(!(!s||!await j({title:D==="activate"?"Activate Refiner release?":"Roll back Refiner release?",body:`Future reviews will use ${w.profile.name} at ${Pe(w.contentHash)}. Existing work remains pinned.`,confirmLabel:D==="activate"?"Activate":"Roll back"}))){v(w.contentHash);try{const B={release:{id:w.id,contentHash:w.contentHash},reason:`${D==="activate"?"Activate":"Rollback"} from Settings to ${w.profile.id}@${w.profile.version}.`,actor:"settings-user"};x(await(D==="activate"?M.activateRefinerRelease(s,B):M.rollbackRefinerRelease(s,B))),t(null),u?.(`Refiner ${D==="activate"?"activated":"rolled back"}. Existing work remains pinned.`,"success")}catch(B){t(B instanceof Error?B.message:String(B))}finally{v(null)}}},[j,s,t,u]),ce=r.useCallback(async(w,D)=>{if(!(!s||!o?.workspace)){y(w.proposal.id);try{const z=await M.reviewHarnessProposal(s,{workspaceId:o.workspace.id,proposal:{id:w.proposal.id,contentHash:w.proposal.contentHash},decision:D});h(z.history),t(null),u?.(D==="approve"?"Harness proposal approved and released.":"Harness proposal declined.",D==="approve"?"success":"info")}catch(z){t(z instanceof Error?z.message:String(z))}finally{y(null)}}},[s,o?.workspace,t,u]),X=o?.releases.find(w=>w.current)??o?.releases[0]??null,Q=X?o?.releases.indexOf(X)??-1:-1,de=al[g],me=o?g==="refiner"?V!==o.backgroundReview.enabled:E!==F||o.evaluationReviewSchedule.enabled:!1,L=g==="refiner"||g==="continuous-review";return e.jsxs("section",{className:"account-settings harness-history-settings","aria-labelledby":"harness-history-title",children:[e.jsxs("div",{className:"account-settings-title harness-page-title",children:[e.jsxs("div",{children:[e.jsx("h1",{id:"harness-history-title",children:de.title}),e.jsx("p",{children:de.description})]}),o?.workspace&&L?e.jsxs("div",{className:"harness-page-header-actions",children:[g==="continuous-review"?e.jsx("button",{className:"settings-secondary compact",disabled:$,onClick:()=>{Y(o.evaluationReviewSchedule.maxEstimatedCostUsd)},type:"button",children:$?"Reviewing…":"Review now"}):null,e.jsxs("label",{className:"harness-page-toggle",children:[e.jsx("span",{children:g==="refiner"?V?"On":"Off":E?"On":"Off"}),e.jsxs("span",{className:"provider-toggle",children:[e.jsx("input",{"aria-label":g==="refiner"?"Enable Refiner":"Enable Continuous Review",checked:g==="refiner"?V:E,disabled:A,onChange:w=>g==="refiner"?Z(w.target.checked):U(w.target.checked),type:"checkbox"}),e.jsx("span",{"aria-hidden":"true"})]})]}),e.jsx("button",{className:"settings-primary compact",disabled:A||!me,onClick:()=>{W(g,V,E)},type:"button",children:A?"Applying…":"Apply changes"})]}):null]}),s?null:e.jsx("div",{className:"harness-empty",children:"Connect to the Local OpenPond server to inspect the Harness."}),s&&S&&!o?e.jsx("div",{className:"harness-empty",children:"Loading Harness history…"}):null,o&&!o.workspace?e.jsx("div",{className:"harness-empty",children:"No Personal Harness workspace has been created yet."}):null,o?.workspace&&g==="overview"?e.jsx(rl,{history:o,onReviewProposal:ce,reviewingProposalId:R}):null,o&&m&&g==="refiner"?e.jsx(ol,{busyReleaseHash:f,history:o,refiner:m,onOpenChangeDiff:_,onOpenSourceSession:d,onRequestRefinerRelease:(w,D)=>{ue(w,D)},onStartRefinerAuthoring:c}):null,o?.workspace&&g==="continuous-review"?e.jsx(el,{acceptingReviewId:N,candidates:o.refinementCandidates,onAcceptTasksetReview:w=>{re(w)},qualifications:o.modelImprovementQualifications,reviews:o.evaluationReviews,schedule:o.evaluationReviewSchedule??tl}):null,o?.workspace&&g==="contents"?e.jsx(ul,{history:o,onOpenCurrentRelease:()=>{X&&G(Q>=0?o.releases[Q+1]??null:null,X)}}):null,o?.workspace&&g==="releases"?e.jsx(hl,{busy:k!==null,history:o,onOpenDiff:G,onRequestRollback:w=>{ae(w)}}):null,e.jsx(Hs,{onResolve:H,state:T})]})}function Us(s){return s?s.slice(0,10):"initial"}function pl({connection:s,expanded:n,onResizeStart:a,onToggleExpanded:t,selection:l}){const[i,d]=r.useState(null),[c,u]=r.useState(null),[g,o]=r.useState(!0),h=r.useCallback(async()=>{u(null),o(!0);try{d(await M.harnessReleaseDiff(s,l))}catch(f){d(null),u(f instanceof Error?f.message:String(f))}finally{o(!1)}},[s,l]);r.useEffect(()=>{h()},[h]);const m=r.useMemo(()=>i?{appId:`harness:${l.workspaceId}`,repoPath:l.title,initialized:!0,dirty:i.filesChanged>0,filesChanged:i.filesChanged,additions:i.additions,deletions:i.deletions,repoFiles:i.files.map(f=>f.path),files:i.files,error:null,updatedAt:""}:null,[i,l.title,l.workspaceId]),x=`${l.title} · ${Us(l.baseRelease?.contentHash)} → ${Us(l.targetRelease.contentHash)}`;return e.jsx(Xn,{appId:`harness:${l.workspaceId}`,workspaceId:`harness:${l.targetRelease.contentHash}`,workspaceKind:"local_project",connection:s,diff:m,editorPreferences:null,expanded:n,filesWithPreview:!0,loading:g,onOpenBrowserUrl:()=>{},onRefresh:h,onResizeStart:a,onToggleExpanded:t,readOnly:!0,workspaceError:c,workspaceInitialized:!0,workspaceName:x})}function gl({connection:s,onError:n,onPayload:a}){const[t,l]=r.useState(!1),[i,d]=r.useState(!1);async function c(h,m){if(s){l(!0),n(null);try{const x=await M.switchOpenPondAccount(s,{handle:h,baseUrl:m??null}),f=await M.savePreferences(s,{defaultTeamId:null});a({...x,preferences:f.preferences})}catch(x){n(x instanceof Error?x.message:String(x))}finally{l(!1)}}}async function u(h,m){if(!s)return!1;l(!0),n(null);try{return a(await M.removeOpenPondAccount(s,{handle:h,baseUrl:m??null})),!0}catch(x){return n(x instanceof Error?x.message:String(x)),!1}finally{l(!1)}}async function g(h){if(!(!s||!h.apiKey.trim())){l(!0),n(null);try{const m=h.handle?.trim(),x=h.environment?.trim(),f=await M.saveOpenPondAccount(s,{apiKey:h.apiKey.trim(),handle:m||void 0,baseUrl:h.baseUrl,apiBaseUrl:h.apiBaseUrl,environment:x||"custom",setActive:!0}),v=await M.savePreferences(s,{defaultTeamId:null});a({...f,preferences:v.preferences})}catch(m){throw n(m instanceof Error?m.message:String(m)),m}finally{l(!1)}}}async function o(){if(s){d(!0),n(null);try{a(await M.refreshOpenPondAccounts(s))}catch(h){n(h instanceof Error?h.message:String(h))}finally{d(!1)}}}return{refreshingAccounts:i,saving:t,refreshAccounts:o,removeAccount:u,saveAccount:g,switchAccount:c}}function xl({connection:s,onError:n,onPreferences:a,preferences:t,providers:l}){const[i,d]=r.useState(t.defaultBranchPrefix),[c,u]=r.useState(t.defaultNewProjectDirectory),[g,o]=r.useState(t.advancedWorkspaceControls),[h,m]=r.useState(t.contextCompaction.autoEnabled),[x,f]=r.useState(t.subagents.enabled),[v,S]=r.useState(t.subagents.delegationMode),[C,k]=r.useState(!t.subagents.defaultModelRef),[P,R]=r.useState(t.subagents.defaultModelRef?.providerId??t.defaultChatProvider),[y,A]=r.useState(t.subagents.defaultModelRef?.modelId??t.defaultChatModel),[O,$]=r.useState(t.subagents.roles),[p,N]=r.useState(t.subagents.maxConcurrentRuns),[b,j]=r.useState(t.subagents.maxConcurrentRunsPerProvider),[T,H]=r.useState(t.subagents.maxConcurrentRunsPerWorkspaceTarget),[F,V]=r.useState(!1),Z=C?null:{providerId:P,modelId:y.trim()},E=x!==t.subagents.enabled||v!==t.subagents.delegationMode||!fl(Z,t.subagents.defaultModelRef)||p!==t.subagents.maxConcurrentRuns||b!==t.subagents.maxConcurrentRunsPerProvider||T!==t.subagents.maxConcurrentRunsPerWorkspaceTarget||JSON.stringify(O)!==JSON.stringify(t.subagents.roles);r.useEffect(()=>{d(t.defaultBranchPrefix),u(t.defaultNewProjectDirectory),o(t.advancedWorkspaceControls),m(t.contextCompaction.autoEnabled),f(t.subagents.enabled),S(t.subagents.delegationMode),k(!t.subagents.defaultModelRef),R(t.subagents.defaultModelRef?.providerId??t.defaultChatProvider),A(t.subagents.defaultModelRef?.modelId??t.defaultChatModel),$(t.subagents.roles),N(t.subagents.maxConcurrentRuns),j(t.subagents.maxConcurrentRunsPerProvider),H(t.subagents.maxConcurrentRunsPerWorkspaceTarget)},[t.defaultChatProvider,t.defaultChatModel,t.defaultBranchPrefix,t.defaultNewProjectDirectory,t.advancedWorkspaceControls,t.contextCompaction.autoEnabled,t.subagents]);function U(L){R(L),A(w=>ns(L,w,l))}function J(){return C?t.defaultChatProvider:P}function Y(){return C?t.defaultChatModel:y}function W(L,w){$(D=>D.map(z=>z.id===L?w(z):z))}function re(L,w){W(L,D=>({...D,enabled:w}))}function G(L,w){W(L,D=>({...D,background:w}))}function _(L,w){W(L,D=>{if(w)return{...D,modelRef:null};const z=D.modelRef?.providerId??J(),B=D.modelRef?.modelId??Y();return{...D,modelRef:Ge(z,B,l)??null}})}function se(L,w){W(L,D=>({...D,modelRef:Ge(w,D.modelRef?.modelId??Y(),l)??null}))}function ae(L,w){W(L,D=>{const z=D.modelRef?.providerId??J(),B=w.trim();return{...D,modelRef:B?{providerId:z,modelId:B}:null}})}function ue(L,w){W(L,D=>({...D,isolationMode:w}))}function ce(L,w){W(L,D=>({...D,toolPolicy:w}))}function X(L,w){W(L,D=>({...D,peerMessages:w}))}function Q(L,w){W(L,D=>({...D,maxConcurrentRuns:be(w,1,16)}))}async function de(){let L=null;if(window.openpond?.selectFolder){const w=await window.openpond.selectFolder();if(w.canceled)return;L=w.path}else L=window.prompt("Default new project directory",c);L?.trim()&&u(L.trim())}async function me(L){if(L.preventDefault(),!!s){V(!0),n(null);try{a(await M.savePreferences(s,{defaultBranchPrefix:Qe(i),defaultNewProjectDirectory:c.trim(),advancedWorkspaceControls:g,contextCompaction:{...t.contextCompaction,autoEnabled:h},subagents:{enabled:x,workspaceDefaultsVersion:t.subagents.workspaceDefaultsVersion,toolDefaultsVersion:t.subagents.toolDefaultsVersion,delegationMode:v,defaultModelRef:C?null:Ge(P,y,l)??null,roles:O,maxConcurrentRuns:be(p,1,32),maxConcurrentRunsPerProvider:b===null?null:be(b,1,32),maxConcurrentRunsPerWorkspaceTarget:T===null?null:be(T,1,32)}}))}catch(w){n(w instanceof Error?w.message:String(w))}finally{V(!1)}}}return{advancedWorkspaceControls:g,contextCompactionAutoEnabled:h,defaultBranchPrefix:i,defaultNewProjectDirectory:c,subagentsEnabled:x,subagentDelegationMode:v,subagentsUseDefaultModel:C,subagentsProvider:P,subagentsModel:y,subagentRoles:O,subagentsMaxConcurrentRuns:p,subagentsMaxConcurrentRunsPerProvider:b,subagentsMaxConcurrentRunsPerWorkspaceTarget:T,subagentsDirty:E,saving:F,chooseDefaultProjectDirectory:de,saveDefaults:me,changeSubagentsProvider:U,changeSubagentRoleProvider:se,setAdvancedWorkspaceControls:o,setContextCompactionAutoEnabled:m,setDefaultBranchPrefix:d,setDefaultNewProjectDirectory:u,setSubagentsUseDefaultModel:k,setSubagentsModel:A,setSubagentsEnabled:f,setSubagentDelegationMode:L=>S(L),setSubagentsMaxConcurrentRuns:L=>N(be(L,1,32)),setSubagentsMaxConcurrentRunsPerProvider:L=>j(L===null?null:be(L,1,32)),setSubagentsMaxConcurrentRunsPerWorkspaceTarget:L=>H(L===null?null:be(L,1,32)),setSubagentRoleBackground:G,setSubagentRoleEnabled:re,setSubagentRoleIsolationMode:ue,setSubagentRoleMaxConcurrentRuns:Q,setSubagentRoleModel:ae,setSubagentRolePeerMessages:X,setSubagentRoleToolPolicy:ce,setSubagentRoleUseDefaultModel:_}}function be(s,n,a){return Number.isFinite(s)?Math.min(a,Math.max(n,Math.trunc(s))):n}function fl(s,n){return(s?.providerId??null)===(n?.providerId??null)&&(s?.modelId??null)===(n?.modelId??null)}const jl=15e3,bl=100,vl=100,yl=2500;function Nl({onError:s,section:n}){const[a,t]=r.useState(null),[l,i]=r.useState(null),[d,c]=r.useState(bl),[u,g]=r.useState([]),[o,h]=r.useState(null),[m,x]=r.useState(!0),f=r.useRef(null),[v,S]=r.useState(null),C=!!(window.openpond?.openLogsFolder||window.openpond?.readRecentLogs||window.openpond?.copyRecentLogs||window.openpond?.exportDiagnostics),P=!!window.openpond?.readRecentLogs?`${u.length} of ${d} line${d===1?"":"s"}${m?" tailing":""}`:"Unavailable";r.useEffect(()=>{n==="diagnostics"&&R(d,"refresh",{quiet:!0})},[n]),r.useEffect(()=>{if(n!=="diagnostics"||!m||!window.openpond?.readRecentLogs)return;let N=!1;const b=window.setInterval(()=>{N||(N=!0,R(d,"refresh",{quiet:!0}).finally(()=>{N=!1}))},yl);return()=>window.clearInterval(b)},[n,m,d]),r.useEffect(()=>{if(n!=="diagnostics"||!m)return;const N=f.current;N&&(N.scrollTop=N.scrollHeight)},[n,m,u]);async function R(N=d,b="refresh",j={}){const T=window.openpond?.readRecentLogs;if(!T){const H="Log view is not available in this runtime.";j.quiet||(S({label:"Logs",value:H,warning:!0}),s(H));return}j.quiet||i(b);try{const H=await Me(T(N),"Read logs");if(!H.ok)throw new Error(H.error);c(H.lineLimit),h(H.logDir),g(H.lines),j.quiet?S(F=>F?.label==="Logs"?null:F):S(null)}catch(H){const F=H instanceof Error?H.message:String(H);S({label:"Logs",value:F,warning:!0}),j.quiet||s(F)}finally{j.quiet||i(null)}}function y(){x(!1),R(d+vl,"older")}function A(){const N=!m;x(N),N&&R(d,"refresh",{quiet:!0})}async function O(){const N=window.openpond?.openLogsFolder;if(!N){const b="Desktop logs are not available in this runtime.";S({label:"Logs",value:b,warning:!0}),s(b);return}t("logs"),s(null);try{const b=await Me(N(),"Open logs");if(!b.ok)throw new Error(b.error??"Could not open the logs folder.");S(null)}catch(b){const j=b instanceof Error?b.message:String(b);S({label:"Logs",value:j,warning:!0}),s(j)}finally{t(null)}}async function $(){const N=window.openpond?.copyRecentLogs;if(!N){const b="Recent log copy is not available in this runtime.";S({label:"Copy",value:b,warning:!0}),s(b);return}t("copy"),s(null);try{const b=await Me(N(1e3),"Copy recent logs");if(!b.ok)throw new Error(b.error??"Could not copy recent logs.");S({label:"Copy",value:b.lines?`Copied ${b.lines} recent log lines.`:"Copied recent logs."})}catch(b){const j=b instanceof Error?b.message:String(b);S({label:"Copy",value:j,warning:!0}),s(j)}finally{t(null)}}async function p(){const N=window.openpond?.exportDiagnostics;if(!N){const b="Diagnostics export is not available in this runtime.";S({label:"Export",value:b,warning:!0}),s(b);return}t("export"),s(null);try{const b=await Me(N(),"Export diagnostics");if(!b.ok)throw new Error(b.error??"Could not export diagnostics.");S({label:"Export",value:b.path?`Saved to ${b.path}`:"Diagnostics exported."})}catch(b){const j=b instanceof Error?b.message:String(b);S({label:"Export",value:j,warning:!0}),s(j)}finally{t(null)}}return{diagnosticsAvailable:C,diagnosticsBusy:a,diagnosticsStatus:v,logDir:o,logLineLimit:d,logLines:u,logViewBusy:l,logViewSummary:P,logViewportRef:f,tailLogs:m,copyRecentLogs:$,exportDiagnosticsBundle:p,loadOlderLogs:y,openLogsFolder:O,refreshLogView:R,toggleTailLogs:A}}async function Me(s,n){let a;try{return await Promise.race([s,new Promise((t,l)=>{a=window.setTimeout(()=>{l(new Error(`${n} did not receive a desktop response.`))},jl)})])}finally{a!==void 0&&window.clearTimeout(a)}}function wl({connection:s,enabled:n,onError:a,onPreferences:t,onToast:l,preferences:i}){const[d,c]=r.useState(i.editor),[u,g]=r.useState(null),[o,h]=r.useState(!1),[m,x]=r.useState(!1),[f,v]=r.useState(!1);r.useEffect(()=>{c(i.editor)},[i.editor]);const S=r.useCallback(async()=>{if(s){x(!0);try{g(await M.workspaceLspSettingsStatus(s))}catch(y){a(y instanceof Error?y.message:String(y))}finally{x(!1)}}},[s,a]);r.useEffect(()=>{!n||!s||S()},[s,n,S]);function C(y,A){c(O=>({...O,languages:{...O.languages,[y]:{...O.languages[y],mode:A}}}))}function k(y,A){c(O=>({...O,languages:{...O.languages,[y]:{...O.languages[y],customCommand:A}}}))}async function P(y){if(y.preventDefault(),!!s){h(!0),a(null);try{const A=await M.savePreferences(s,{editor:d});t(A),g(await M.workspaceLspSettingsStatus(s))}catch(A){a(A instanceof Error?A.message:String(A))}finally{h(!1)}}}async function R(){if(s){v(!0),a(null);try{await M.restartWorkspaceLsp(s),g(await M.workspaceLspSettingsStatus(s)),l?.("Language servers restarted.","success")}catch(y){a(y instanceof Error?y.message:String(y))}finally{v(!1)}}}return{editorPreferences:d,lspStatus:u,restarting:f,saving:o,statusLoading:m,refreshLspStatus:S,restartLanguageServers:R,saveEditorSettings:P,setEditorPreferences:c,setLanguageCustomCommand:k,setLanguageMode:C}}function Sl({connection:s,onError:n,onPayload:a,personalization:t}){const l=r.useMemo(()=>t.templates.map(p=>({value:p.id,label:p.name,description:p.id===t.activeTemplateId?"Selected":p.source==="built_in"?p.description:void 0})),[t.activeTemplateId,t.templates]),[i,d]=r.useState(t.activeTemplateId),[c,u]=r.useState(t.soul),[g,o]=r.useState(""),[h,m]=r.useState(!1),[x,f]=r.useState(!1),v=t.templates.find(p=>p.id===i)??t.templates[0],S=v?.source==="custom",C=v?c!==v.content:!0,k=i!==t.activeTemplateId||c!==t.soul||C,P=!!(S&&c.trim()&&v&&k);r.useEffect(()=>{d(t.activeTemplateId),u(t.soul);const p=t.templates.find(N=>N.id===t.activeTemplateId);o(p?`${p.name} Copy`:""),m(!1)},[t.activeTemplateId,t.soul,t.templates]);async function R(p=!1){if(!p&&!S)return;const N=p?g:v?.name;if(!(!s||!c.trim()||!N?.trim())){f(!0),n(null);try{a(await M.savePersonalization(s,{activeTemplateId:i,templateName:N,soul:c,saveAsNew:p})),m(!1)}catch(b){n(b instanceof Error?b.message:String(b))}finally{f(!1)}}}async function y(p){const N=t.templates.find(b=>b.id===p);if(N&&(d(N.id),o(`${N.name} Copy`),u(N.content),m(!1),!!s)){f(!0),n(null);try{a(await M.savePersonalization(s,{activeTemplateId:N.id,templateName:N.name,soul:N.content,saveAsNew:!1}))}catch(b){n(b instanceof Error?b.message:String(b))}finally{f(!1)}}}function A(){v&&(o(`${v.name} Copy`),u(v.content),m(!1))}function O(p){u(p),v&&!S&&p!==v.content&&m(!0)}function $(){v&&(o(`${v.name} Copy`),m(!0))}return{canSaveCurrentTemplate:P,personalizationTemplateId:i,personalizationTemplateOptions:l,saveAsNewOpen:h,saving:x,selectedPersonalizationTemplate:v,selectedTemplateIsCustom:S,soulDraft:c,templateNameDraft:g,changePersonalizationTemplate:y,changeSoulDraft:O,openSaveAsNew:$,resetPersonalizationDraft:A,savePersonalization:R,setSaveAsNewOpen:m,setTemplateNameDraft:o}}function Cl({connection:s,onError:n,onPreferences:a,onProviders:t,preferences:l,providers:i}){const[d,c]=r.useState(l.defaultChatProvider),[u,g]=r.useState(l.defaultChatModel),[o,h]=r.useState(!1),[m,x]=r.useState(null),[f,v]=r.useState(null);r.useEffect(()=>{c(l.defaultChatProvider),g(l.defaultChatModel)},[l.defaultChatProvider,l.defaultChatModel]);async function S(b){if(b.preventDefault(),!!s){h(!0),n(null);try{a(await M.savePreferences(s,{defaultChatProvider:d,defaultChatModel:ns(d,u,i)}))}catch(j){n(j instanceof Error?j.message:String(j))}finally{h(!1)}}}function C(b){c(b),g(j=>ns(b,j,i))}async function k(b,j,T){if(!s)return null;x(`${b}:${j}`),v(null),n(null);try{return await T()}catch(H){return n(H instanceof Error?H.message:String(H)),null}finally{x(null)}}async function P(b,j){await k(b,"config",async()=>{const T=await M.saveProviderSettings(s,{providers:{[b]:j}});return t(T),T})}async function R(b,j){await k(b,"credential",async()=>{const T=await M.saveProviderCredential(s,b,j);return t(T),T})}async function y(b){await k(b,"credential",async()=>{const j=await M.deleteProviderCredential(s,b,{});return t(j),j})}async function A(b){return k("openai","credential",async()=>{const j=await M.startOpenAiSubscriptionAuth(s,{method:b});return j.method==="browser"?(window.open(j.url,"_blank","noopener,noreferrer"),v("OpenAI ChatGPT login opened in your browser. Return here after authorization.")):(window.open(j.url,"_blank","noopener,noreferrer"),v(`OpenAI device login started. Enter code ${j.userCode}.`)),O(j.expiresAt),j})}async function O(b){if(s)for(;Date.now()<b;){await new Promise(j=>setTimeout(j,2500));try{const j=await M.providerSettings(s);t(j);const T=j.statuses.openai?.credential;if(T?.connected&&T.source==="chatgpt_subscription"){v("OpenAI ChatGPT subscription connected.");return}}catch{}}}async function $(b){await k(b,"models",async()=>{const j=await M.refreshProviderModels(s,b,{force:!0});return t(j.providers),j})}async function p(b){await k(b,"models",async()=>{const j=await M.loadProviderModels(s,b,{limit:500});return t(j.providers),j})}async function N(b,j={}){await k(b,"validate",async()=>{const T=await M.validateProviderCredential(s,b,j);return v(T.ok?`${b} validated${T.modelId?` with ${T.modelId}`:""}.`:T.errors.join(`
6
- `)||`${b} validation failed.`),t(T.providers),T})}return{defaultModel:u,defaultProvider:d,providerBusy:m,saving:o,validationMessage:f,changeDefaultProvider:C,deleteProviderCredential:y,loadProviderModels:p,refreshProviderModels:$,saveProviderConfig:P,saveProviderCredential:R,saveProviders:S,setDefaultModel:g,startOpenAiSubscriptionAuth:A,validateProvider:N}}function kl({connection:s,enabled:n,onError:a,onToast:t}){const[l,i]=r.useState(null),[d,c]=r.useState(null),[u,g]=r.useState(!1),o=r.useRef(null),h=r.useCallback(async(A={})=>{if(s){A.quiet||c("refresh");try{const O=await M.remoteAccess(s);i(O),a(null)}catch(O){a(O instanceof Error?O.message:String(O))}finally{A.quiet||c(null)}}},[s,a]);r.useEffect(()=>{!n||!s||h({quiet:!0})},[s,n,h]),r.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);function m(){o.current!==null&&window.clearTimeout(o.current),g(!1),window.setTimeout(()=>{g(!0),o.current=window.setTimeout(()=>{g(!1),o.current=null},1500)},0)}async function x(){if(a(null),!!s)try{i(await M.remoteAccess(s))}catch{}}async function f(){if(!s)return null;l&&!l.tailscale.running&&m(),c("enable");try{const A=await M.enableRemoteAccess(s);return i(A.status),a(null),A.status.tailscale.running?!A.status.serve.enabled&&A.status.serve.error&&t?.(A.status.serve.setupUrl?"Tailscale Serve needs to be enabled for this tailnet. Copy the Enable Serve link.":A.message||A.status.serve.error,"error"):(m(),t?.(A.message||"Tailscale is not running. Run Tailscale up first.","error")),A.status}catch{return await x(),m(),t?.("Unable to turn on remote access. Run Tailscale up first.","error"),null}finally{c(null)}}async function v(){if(s&&window.confirm("Turn off remote access? This runs tailscale serve reset and clears Tailscale Serve config on this device.")){c("disable");try{const A=await M.disableRemoteAccess(s);i(A.status),a(null)}catch{await x()}finally{c(null)}}}async function S(){l?.remoteWebUrl&&(c("copy-link"),await ye(l.remoteWebUrl),c(null))}async function C(){l?.serveCommand&&(c("copy-command"),await ye(l.serveCommand),c(null))}async function k(){l?.serve.setupUrl&&(c("copy-serve-setup"),await ye(l.serve.setupUrl),c(null))}async function P(){l?.tailscaleUpCommand&&(c("copy-up-command"),await ye(l.tailscaleUpCommand),c(null))}async function R(){l?.operatorCommand&&(c("copy-operator"),await ye(l.operatorCommand),c(null))}async function y(){if(!l?.serve.enabled){const A=await f();A?.serve.enabled&&A.remoteWebUrl&&await ye(A.remoteWebUrl);return}await S()}return{status:l,busy:d,flashTailscaleUp:u,refresh:h,enableRemoteAccess:f,disableRemoteAccess:v,copyRemoteLink:S,copyTailscaleUpCommand:P,copyServeCommand:C,copyServeSetupUrl:k,copyOperatorCommand:R,createRemoteLink:y}}function Pl(s){const[n,a]=r.useState(null),[t,l]=r.useState(null),i=r.useCallback(async()=>{if(s.connection){l("load");try{a(await M.datasetStorageState(s.connection)),s.onError(null)}catch(c){s.onError(c instanceof Error?c.message:String(c))}finally{l(null)}}},[s.connection,s.onError]),d=r.useCallback(async c=>{if(!s.connection||!c)return!1;l("save");try{return a(await M.updateDatasetStorage(s.connection,c)),s.onError(null),!0}catch(u){return s.onError(u instanceof Error?u.message:String(u)),!1}finally{l(null)}},[s.connection,s.onError]);return r.useEffect(()=>{s.enabled&&i()},[s.enabled,i]),{state:n,busy:t,refresh:i,save:d}}function Rl(s){const{connection:n,enabled:a,onError:t,profileId:l}=s,[i,d]=r.useState(null),[c,u]=r.useState(!1),g=r.useCallback(async()=>{if(n){u(!0);try{d(await M.datasetCatalog(n,l)),t(null)}catch(o){t(Al(o))}finally{u(!1)}}},[n,t,l]);return r.useEffect(()=>{a&&g()},[a,g]),{catalog:i,loading:c,refresh:g}}function Al(s){return s instanceof Error?s.message:String(s)}const Dl=new Set(["harness","harness-refiner","harness-continuous-review","harness-contents","harness-releases"]);function $l(s){return s==="harness-refiner"?"refiner":s==="harness-continuous-review"?"continuous-review":s==="harness-contents"?"contents":s==="harness-releases"?"releases":"overview"}const El=r.lazy(()=>mn(()=>import("./UsageSettingsSection-B3sbqaUV.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url).then(s=>({default:s.UsageSettingsSection})));function ni({payload:s,connection:n,diagnostics:a,onPayload:t,onError:l,onToast:i,onBack:d,onOpenSourceSession:c,onStartRefinerAuthoring:u,onAcceptEvaluationReview:g,onOpenSkill:o,onOpenExtension:h,teamChatCurrentUserId:m,teamChatEnabled:x,teamChatNotificationMode:f,teamChatThreads:v,onTeamChatNotificationModeChange:S,onTeamChatThreadMuteChange:C,diffPanelWidth:k,diffPanelResizing:P,diffPanelExpanded:R,onDiffPanelResizeStart:y,onDiffPanelExpandedChange:A,initialSection:O="account"}){const[$,p]=r.useState(O),[N,b]=r.useState(null),[j,T]=r.useState(!1),H=s?.codex??null,F=r.useMemo(()=>Tn(s?.preferences),[s?.preferences]),V=s?.personalization??Ln,Z=a??s?.diagnostics??[],E=zn()&&Un(n?.platform),U=r.useCallback(K=>{s&&t({...s,providers:K})},[t,s]),J=r.useCallback(K=>{s&&t({...s,preferences:K.preferences})},[t,s]),Y=r.useCallback(K=>{s&&t({...s,extensionCatalog:K})},[t,s]),W=gl({connection:n,onError:l,onPayload:t}),re=Cl({connection:n,onError:l,onPayload:t,onPreferences:J,onProviders:U,preferences:F,providers:s?.providers??null}),G=xl({connection:n,onError:l,onPayload:t,onPreferences:J,preferences:F,providers:s?.providers??null}),_=wl({connection:n,enabled:$==="editor",onError:l,onPayload:t,onPreferences:J,onToast:i,preferences:F}),se=Sl({connection:n,onError:l,onPayload:t,personalization:V}),ae=Nl({onError:l,section:$}),ue=kl({connection:n,enabled:$==="remote",onError:l,onToast:i}),ce=$==="dataset-storage",X=Pl({connection:n,enabled:ce,onError:l}),Q=Rl({connection:n,enabled:ce,onError:l,profileId:s?.profile.activeProfile??"default"}),de=X.save,me=r.useCallback(async()=>{await Promise.all([X.refresh(),Q.refresh()])},[X.refresh,Q.refresh]),L=r.useCallback(()=>$!=="subagents"||!G.subagentsDirty?!0:window.confirm("You have unsaved changes. Leave Subagents without saving?"),[G.subagentsDirty,$]),w=r.useCallback(K=>{K!==$&&L()&&(T(!1),A(!1),p(K))},[L,A,$]),D=r.useCallback(()=>{L()&&(T(!1),A(!1),d())},[L,d,A]);r.useEffect(()=>{p(O)},[O]),r.useEffect(()=>{if($!=="subagents"||!G.subagentsDirty)return;const K=Re=>{Re.preventDefault(),Re.returnValue="You have unsaved changes."};return window.addEventListener("beforeunload",K),()=>window.removeEventListener("beforeunload",K)},[G.subagentsDirty,$]);const z={"--diff-panel-width":`${k}px`},B=Dl.has($),te=B&&j&&N;return e.jsxs("div",{className:`settings-shell ${E?"platform-macos":""} ${te?"harness-diff-open":""} ${R?"harness-diff-expanded":""} ${P?"diff-panel-resizing":""}`,style:z,children:[e.jsx("div",{className:"settings-drag-region","aria-hidden":"true"}),e.jsxs("div",{className:"settings-window-controls",children:[B?e.jsx("button",{type:"button",className:`topbar-diff-button ${te?"active":""}`,title:`${te?"Hide":"Show"} sidebar`,"aria-label":`${te?"Hide":"Show"} sidebar`,"aria-pressed":!!te,disabled:!N,onClick:()=>T(K=>!K),children:e.jsx(Bn,{size:16})}):null,e.jsx(Hn,{platform:n?.platform})]}),e.jsx(Da,{section:$,onBack:D,onSectionChange:w}),e.jsx("main",{className:`settings-content ${$==="profile"||B?"settings-content-wide":""}`,children:$==="account"?e.jsx(jt,{payload:s,connection:n,onPayload:t,onPreferences:J,onError:l,onToast:i,...W}):$==="notifications"?e.jsx(Ot,{currentUserId:m,enabled:x,mode:f,threads:v,onModeChange:S,onThreadMuteChange:C}):B?e.jsx(ml,{connection:n,enabled:B,onAcceptEvaluationReview:g,onError:l,onDefaultReleaseDiff:b,onOpenSourceSession:c,onStartRefinerAuthoring:u,onOpenReleaseDiff:K=>{b(K),T(!0)},onToast:i,page:$l($)}):$==="profile"?e.jsx(Zt,{payload:s,connection:n,onPayload:t,onError:l,onToast:i}):$==="skills"?e.jsx(Ea,{personalSkills:s?.codexPersonalSkills??[],extensionCatalog:s?.extensionCatalog??{rootPath:"",registryPath:"",extensions:[],error:null},connection:n,onExtensionCatalog:Y,onError:l,onToast:i,onOpenSkill:o,onOpenExtension:h}):$==="providers"?e.jsx(ya,{account:s?.account??null,codex:H,providers:s?.providers??null,...re}):$==="dataset-storage"?e.jsx(Ga,{state:X.state,catalog:Q.catalog,busy:X.busy,catalogLoading:Q.loading,onRefresh:me,onSave:de}):$==="defaults"?e.jsxs("div",{className:"settings-stacked-sections",children:[e.jsx(yt,{preferences:F,...G}),e.jsx(Ns,{embedded:!0,preferences:F,...G})]}):$==="context"?e.jsx(Ns,{preferences:F,...G}):$==="training"?e.jsx(Ia,{connection:n,onError:l,onPreferences:J,preferences:F,providers:s?.providers??null}):$==="subagents"?e.jsx(Pt,{preferences:F,providers:s?.providers??null,...G}):$==="editor"?e.jsx(kt,{preferences:F,..._}):$==="remote"?e.jsx(Ca,{...ue}):$==="usage"?e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"usage-load-state",children:"Loading activity…"}),children:e.jsx(El,{account:s?.account??null,connection:n,enabled:$==="usage",onError:l,onOpenSourceSession:c})}):$==="personalization"?e.jsx(Lt,{...se}):e.jsx(Nt,{diagnostics:Z,...ae})}),B&&n&&te?e.jsx(pl,{connection:n,expanded:R,onResizeStart:y,onToggleExpanded:()=>A(!R),selection:te}):null]})}export{ni as SettingsView};
@@ -1 +0,0 @@
1
- import{c as o}from"./App-D7vhbyMO.js";const c=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],n=o("chevron-up",c);export{n as C};