openpond 0.2.35 → 0.2.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-server.d.ts +197 -4
- package/dist/app-server.js +1 -1
- package/dist/chunks/actions-command-GNQREIDD.js +2 -0
- package/dist/chunks/{app-layer-HK2GTSRX.js → app-layer-BDAKS3DG.js} +1 -1
- package/dist/chunks/app-server-runtime-D74FFS27.js +2 -0
- package/dist/chunks/apps-2SUP5JZE.js +2 -0
- package/dist/chunks/chunk-2O5UZOYL.js +13 -0
- package/dist/chunks/{chunk-BRJKTOMI.js → chunk-3I5BMVJI.js} +1 -1
- package/dist/chunks/{chunk-E4U7LXSW.js → chunk-3LG4G5JR.js} +2 -2
- package/dist/chunks/{chunk-4QX2I2DX.js → chunk-3N4GQL6I.js} +1 -1
- package/dist/chunks/{chunk-DR3XPQRZ.js → chunk-3YA2CD22.js} +1 -1
- package/dist/chunks/{chunk-EFTLCT7C.js → chunk-4R4KM6LL.js} +1 -1
- package/dist/chunks/{chunk-MXLB6MEW.js → chunk-5YUITAUN.js} +1 -1
- package/dist/chunks/{chunk-QPZNN5Q3.js → chunk-6EAQL7YX.js} +1 -1
- package/dist/chunks/{chunk-77BXXOHW.js → chunk-BLXEK5F7.js} +1 -1
- package/dist/chunks/{chunk-QWENRTVW.js → chunk-DAOLQUAK.js} +1 -1
- package/dist/chunks/{chunk-JFSDNQHW.js → chunk-DG4DIFF4.js} +3 -3
- package/dist/chunks/{chunk-SRQVXHSM.js → chunk-DXOOJFFU.js} +1 -1
- package/dist/chunks/chunk-EIB7GHIQ.js +4 -0
- package/dist/chunks/{chunk-XCTFXXVY.js → chunk-FFEI7IRU.js} +1 -1
- package/dist/chunks/chunk-FOW3LI6G.js +2 -0
- package/dist/chunks/{chunk-JLWAK5PS.js → chunk-FQOVC2GR.js} +78 -78
- package/dist/chunks/chunk-HZP5U2AA.js +3 -0
- package/dist/chunks/chunk-I6DQSOSF.js +12 -0
- package/dist/chunks/chunk-IYROEHYB.js +2 -0
- package/dist/chunks/{chunk-BOQBDCVU.js → chunk-KCFVJDIV.js} +1 -1
- package/dist/chunks/chunk-L6NNQUAT.js +53 -0
- package/dist/chunks/chunk-OO7JG7KM.js +42 -0
- package/dist/chunks/chunk-PKBU37CH.js +5 -0
- package/dist/chunks/chunk-QUNRWDVO.js +155 -0
- package/dist/chunks/{chunk-34URWDE7.js → chunk-S4RSY6CR.js} +1 -1
- package/dist/chunks/{chunk-VL553I5E.js → chunk-SL7XLTIT.js} +199 -199
- package/dist/chunks/{chunk-BAKCGJ5D.js → chunk-TZ6N7WFI.js} +1 -1
- package/dist/chunks/{chunk-Z6F6PYF4.js → chunk-UJLZRM2M.js} +1 -1
- package/dist/chunks/chunk-XISNUB62.js +2 -0
- package/dist/chunks/{chunk-PZ2ZILPN.js → chunk-XLVFY2BA.js} +1 -1
- package/dist/chunks/{chunk-K6EGNB2A.js → chunk-YQPECTJ2.js} +1 -1
- package/dist/chunks/{chunk-PMXE4CAA.js → chunk-Z3RBK6LN.js} +1 -1
- package/dist/chunks/cli-A2P56J7R.js +2 -0
- package/dist/chunks/configuration-command-URDRLDNY.js +2 -0
- package/dist/chunks/core-commands-CMAAUKPQ.js +2 -0
- package/dist/chunks/desktop-test-5PKGG6H6.js +3 -0
- package/dist/chunks/dist-CEKBK32A.js +2 -0
- package/dist/chunks/dist-GKCGK44T.js +2 -0
- package/dist/chunks/{extension-RMJAXEKN.js → extension-DG2XISC6.js} +1 -1
- package/dist/chunks/{help-QDMTLEIL.js → help-ZLJV3ZVW.js} +1 -1
- package/dist/chunks/hosted-harness-runtime-ABEMAABI.js +2 -0
- package/dist/chunks/hosted-profile-compiler-CSLJT75T.js +3 -0
- package/dist/chunks/{opchat-MHH4C5YQ.js → opchat-IMGIFM4W.js} +1 -1
- package/dist/chunks/organizations-G3UOHURO.js +2 -0
- package/dist/chunks/{profile-KVDJTM4D.js → profile-LMRN5QMQ.js} +1 -1
- package/dist/chunks/project-agent-DTAVYEB6.js +2 -0
- package/dist/chunks/sandbox-command-YO6RR5SD.js +2 -0
- package/dist/chunks/{sandbox-template-Q6K5JXA3.js → sandbox-template-LN5OQ55F.js} +1 -1
- package/dist/chunks/{src-42VXY5DZ.js → src-A5KEQW52.js} +1 -1
- package/dist/chunks/{src-ZGGKHNNF.js → src-LRJO4THC.js} +3 -3
- package/dist/chunks/{teams-bot-7TPB34DR.js → teams-bot-RY5M6AOW.js} +1 -1
- package/dist/chunks/{workspaces-XFUQZH5T.js → workspaces-KZ6ZJXXY.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/web/assets/{App-BKY1b22z.js → App-BRZg56AC.js} +32 -32
- package/dist/web/assets/{AppDialog-C64bP66E.js → AppDialog-BR9UjEFe.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-fVkWSvWK.js → AppTerminalPanel-DNXVV6S_.js} +2 -2
- package/dist/web/assets/{AppsView-DHnab11q.js → AppsView-DhaB7uT7.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-C7YeQ9KS.js → BrowserSidebar-zecj1P2T.js} +1 -1
- package/dist/web/assets/{CartesianChart-CYX3IXBM.js → CartesianChart-DRhWC0XA.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-j2oBkesr.js → CollaborationTabs-BzNNwOcD.js} +1 -1
- package/dist/web/assets/{CommandMenu-BN1a4dTn.js → CommandMenu-C7HuXmgN.js} +1 -1
- package/dist/web/assets/{CommunityView-CNoxP71Z.js → CommunityView-C4HfU5ky.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-IoK3lqK8.js → ComposerCreateImproveStrip-CG8YZxWB.js} +1 -1
- package/dist/web/assets/{GetStartedView-QPabIxZC.js → GetStartedView-ZxtcgU5X.js} +1 -1
- package/dist/web/assets/HostedModelLearningReview-BhGIhvoc.js +1 -0
- package/dist/web/assets/{HostedModelLearningSettings-TkSSxw8x.js → HostedModelLearningSettings-BKM_1-LZ.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-CRFw6V7e.js → LabModelVersionDetailPage-CklKwV_e.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-Dl8KWUe0.js → LabSkillSidebar-Cq_axOXr.js} +1 -1
- package/dist/web/assets/{LabsRoute-BzdL7mUM.js → LabsRoute-BPGkQnKq.js} +6 -6
- package/dist/web/assets/{MainChatThread-C3IdxbN3.js → MainChatThread-DvllW6Ej.js} +2 -2
- package/dist/web/assets/{MainPane-BdR1K59_.js → MainPane-BaUIvio6.js} +4 -4
- package/dist/web/assets/{MarkdownText-CkLxqh2M.js → MarkdownText-DP7Hjp4L.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-VkWpZX6S.js → NativeSkillSidebar-BSSKKH-y.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-D_K16Ho-.js → NewExperienceSwitcher-cWw4m_pU.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-B6E1wWOM.js → NewProjectDialog-BMzXEHsC.js} +1 -1
- package/dist/web/assets/{OutputsPage-27MuutGA.js → OutputsPage-CGWtgJ_j.js} +1 -1
- package/dist/web/assets/{ProjectsPage-CokpZHgx.js → ProjectsPage-C00Wt3oR.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-B6JhJdlc.js → RightChatPanelStack-0D_jpeAm.js} +1 -1
- package/dist/web/assets/{RightSidebarHomePanel-nn0dqUF0.js → RightSidebarHomePanel-BgHpI97K.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-idJ8AO15.js → ScheduledWorkPage-C-P_Jv04.js} +1 -1
- package/dist/web/assets/{SettingsView-ZH2gDC6E.js → SettingsView-BJDvzvtZ.js} +3 -3
- package/dist/web/assets/{TeamChatView-B5cG9M6w.js → TeamChatView-BdUQNXvx.js} +2 -2
- package/dist/web/assets/{TerminalOverlay-9SPRce9W.js → TerminalOverlay-85H1eqcg.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-2dkxe7py.js → TrainingCreationPanel-Bdx2BJzb.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-oYbOFapi.js → TrainingDraftPanel-TcvqZfYS.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-zWs4Z_9b.js → UsageSettingsSection-Dm8bsNIT.js} +1 -1
- package/dist/web/assets/{WorkSidebarPanel-CiBQztz6.js → WorkSidebarPanel-C9bKi4NH.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-BPt29A2a.js → WorkspaceDiffPanel-CFzHklbv.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-pb6fs4-2.js → WorkspaceEnvironmentMenu-_e6IkhGw.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-DHD-L4Vs.js → WorkspaceGitDialogs-BglcR8S9.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-BxtCNaRo.js → WorkspaceMonacoEditor-BuipCT-i.js} +3 -3
- package/dist/web/assets/{arrow-up-right-DcP3EZaY.js → arrow-up-right-jN0p0koy.js} +1 -1
- package/dist/web/assets/{clipboard-BXulVWTJ.js → clipboard-Bat4as9H.js} +1 -1
- package/dist/web/assets/{cloud-upload-B3hP6o0H.js → cloud-upload-CFs0F_2n.js} +1 -1
- package/dist/web/assets/{cssMode-c85YG3Pd.js → cssMode-Cg4Jey3B.js} +1 -1
- package/dist/web/assets/{folder-open-CtOXE4jL.js → folder-open-BqInWH_9.js} +1 -1
- package/dist/web/assets/{folder-plus-KO96VZiR.js → folder-plus-BSA6I7ld.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-Bhtev2bN.js → git-commit-horizontal-CLDqrpDQ.js} +1 -1
- package/dist/web/assets/{htmlMode-BbCawv2y.js → htmlMode-DHHN3vwk.js} +1 -1
- package/dist/web/assets/{index-Hynq87d2.js → index-VtbQYCWA.js} +2 -2
- package/dist/web/assets/{info-Dqf1UVHA.js → info-BSebzpyp.js} +1 -1
- package/dist/web/assets/{jsonMode-CFycP8DE.js → jsonMode-mvqMGlEK.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-CYX4VXe2.js → lspLanguageFeatures-Bw_QMGcP.js} +1 -1
- package/dist/web/assets/{minimize-2-BCmNskf_.js → minimize-2-CaHjbHpF.js} +1 -1
- package/dist/web/assets/{monaco.contribution-CJYgsAyM.js → monaco.contribution-CBkwYqsg.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CPkt_0fd.js → monaco.contribution-CiXEi4Ka.js} +2 -2
- package/dist/web/assets/{monaco.contribution-3ZJbmsu3.js → monaco.contribution-DubQum0F.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DR_TcZx7.js → monaco.contribution-KrPDFXc4.js} +2 -2
- package/dist/web/assets/{monitor-DWlfguJj.js → monitor-DwOfVMY6.js} +1 -1
- package/dist/web/assets/{python-rAXzgbqp.js → python-BPnA89YS.js} +1 -1
- package/dist/web/assets/{refresh-cw-BUPgzu5R.js → refresh-cw-DO-hUyTn.js} +1 -1
- package/dist/web/assets/{save-Mb-ECgFZ.js → save-C7WFI7Mn.js} +1 -1
- package/dist/web/assets/{square-CxNbsHso.js → square-DiLQ59tw.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-DUvtEJ40.js → toggleHighContrast-BWFPIQBM.js} +1 -1
- package/dist/web/assets/{tsMode-IPAavolh.js → tsMode-CWxqU0x6.js} +1 -1
- package/dist/web/assets/{upload-Bn6_UQEa.js → upload-vUnuWYGk.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-DAHspLJg.js → useLocalAgentSchedules-BFbGmflA.js} +1 -1
- package/dist/web/assets/{useSessionTurnCache-CUiJuUjd.js → useSessionTurnCache-C0zgYrCB.js} +1 -1
- package/dist/web/assets/{wifi-off-Bsy0Wjm8.js → wifi-off-DbNO6u3Z.js} +1 -1
- package/dist/web/assets/{workers-35o3qFXU.js → workers-4I09fePv.js} +1 -1
- package/dist/web/assets/{yaml-Ba5fmKgb.js → yaml-DpHYonDY.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/chunks/actions-command-6LFZFTLA.js +0 -2
- package/dist/chunks/app-server-runtime-CAWXM33C.js +0 -2
- package/dist/chunks/apps-YJRRLX2N.js +0 -2
- package/dist/chunks/chunk-5BFWDFPX.js +0 -166
- package/dist/chunks/chunk-B5LKUQGM.js +0 -2
- package/dist/chunks/chunk-CWW2EK77.js +0 -4
- package/dist/chunks/chunk-IFP6W4OW.js +0 -54
- package/dist/chunks/chunk-OYJ73BSC.js +0 -42
- package/dist/chunks/chunk-TBX3Z7TX.js +0 -2
- package/dist/chunks/chunk-XR6ZLKVW.js +0 -15
- package/dist/chunks/cli-YI6G22CQ.js +0 -2
- package/dist/chunks/configuration-command-CYUWO6CD.js +0 -2
- package/dist/chunks/core-commands-Z5C7S6OH.js +0 -2
- package/dist/chunks/desktop-test-JBZCCTSN.js +0 -3
- package/dist/chunks/dist-XCT2G25K.js +0 -2
- package/dist/chunks/hosted-profile-compiler-7SGXUZB4.js +0 -3
- package/dist/chunks/organizations-5KM2JD32.js +0 -2
- package/dist/chunks/project-agent-SXUMNJLZ.js +0 -2
- package/dist/chunks/sandbox-command-FQGX5MSS.js +0 -2
- package/dist/web/assets/HostedModelLearningReview-CNd3-FrC.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./UsageSettingsSection-
|
|
2
|
-
import{r,j as e,_ as Rn}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./UsageSettingsSection-Dm8bsNIT.js","./index-VtbQYCWA.js","./index-lqk3IxE0.css","./App-BRZg56AC.js","./App-7h_oHCFd.css","./arrow-up-right-jN0p0koy.js","./CartesianChart-DRhWC0XA.js","./UsageSettingsSection-Csg3diiE.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r,j as e,_ as Rn}from"./index-VtbQYCWA.js";import{c as je,aW as gs,v as Pn,ay as fs,aX as An,aY as is,X as ue,aZ as ls,a_ as Js,a$ as In,b0 as Dn,b1 as $n,b2 as En,b3 as Mn,w as E,b4 as Ln,P as fe,D as De,ax as On,b5 as Ys,b6 as Tn,b7 as Qe,am as Zs,b8 as Un,b9 as zn,ba as Bn,Z as Qs,H as Be,bb as Hn,I as _n,_ as Te,h as rs,bc as Xe,bd as qe,aF as Fn,C as Gn,be as Me,K as es,aq as qn,m as Ue,bf as de,bg as Wn,bh as ss,bi as ns,af as Xs,bj as Vn,g as Kn,aT as en,bk as Jn,an as xs,B as Yn,f as sn,bl as Zn,bm as Qn,y as Xn,aj as et,W as ts,a8 as We,ak as Ne,aJ as st,bn as nt,bo as tt,bp as at,bq as it,ai as lt,br as rt}from"./App-BRZg56AC.js";import{R as oe,P as nn}from"./refresh-cw-DO-hUyTn.js";/* empty css */import{S as os}from"./save-C7WFI7Mn.js";import{T as Ce,P as tn,e as ot,B as He,W as ct,A as dt,C as ut}from"./MarkdownText-DP7Hjp4L.js";import{F as an}from"./folder-open-BqInWH_9.js";import{B as ht,a as ln,W as mt,S as pt}from"./wifi-off-DbNO6u3Z.js";import{R as _e,u as gt}from"./useLocalAgentSchedules-BFbGmflA.js";import{C as xe}from"./cloud-upload-CFs0F_2n.js";import{G as ze}from"./git-commit-horizontal-CLDqrpDQ.js";import{F as ft}from"./folder-plus-BSA6I7ld.js";import{A as xt}from"./AppDialog-BR9UjEFe.js";import{C as rn,W as jt}from"./WorkspaceDiffPanel-CFzHklbv.js";import"./training-model-data-CKOkpBBL.js";import"./info-BSebzpyp.js";import"./minimize-2-CaHjbHpF.js";import"./clipboard-Bat4as9H.js";const vt=[["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"}]],bt=je("clipboard-copy",vt);const yt=[["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"}]],Nt=je("eye",yt);const wt=[["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"}]],St=je("hard-drive",wt);const kt=[["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"}]],pe=je("key-round",kt);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"}]],on=je("radio-tower",Ct);const Rt=[["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"}]],Pt=je("rotate-cw",Rt);const At=[["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"}]],It=je("sliders-horizontal",At);const Dt=[["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"}]],js=je("circle-user",Dt);function vs({connection:s,bannerOnly:n=!1,onOpen:a,onSaved:t}){const[i,l]=r.useState(null),[c,d]=r.useState(null),[u,p]=r.useState(null),[o,g]=r.useState(!1),[m,h]=r.useState(null),[f,N]=r.useState(!1),[S,P]=r.useState(gs);Pn(()=>P(gs()));const C=r.useRef(0),I=r.useCallback(async v=>{if(!s)return;const k=++C.current,L=await fs(s,"/v1/configuration",{signal:v});!v?.aborted&&k===C.current&&l(L)},[s]);r.useEffect(()=>{l(null),d(null),p(null),h(null);const v=new AbortController,k=()=>{I(v.signal).catch(R=>{v.signal.aborted||h(String(R))})};k();const L=window.setInterval(k,3e3);return()=>{C.current+=1,v.abort(),window.clearInterval(L)}},[I]);async function A(v,k){if(!(!s||!i)){N(!0),h(null);try{const L=v==="restore"?{action:v,revision:k,expectedRevision:i.rawRevision}:v==="validate"?{action:v,text:c??i.text??`schema_version = 1
|
|
3
3
|
`}:{action:v,text:c??i.text??`schema_version = 1
|
|
4
4
|
`,expectedRevision:u??i.rawRevision};await fs(s,"/v1/configuration",{method:"POST",body:JSON.stringify(L)}),v!=="validate"&&(d(null),p(null),await I(),await t?.()),h(v==="validate"?"Configuration is valid.":"Saved. Changes apply to the next turn.")}catch(L){h(L instanceof Error?L.message:String(L))}finally{N(!1)}}}return!s||n&&!i?.issue&&!S?null:e.jsxs("section",{className:`account-settings configuration-settings ${n?"configuration-banner":""}`,"aria-label":"Configuration",children:[n?null:e.jsxs("header",{children:[e.jsx("h1",{children:"Configuration"}),e.jsx("p",{children:"Manage your settings in one TOML file. The controls below save to the same file; unset an override to inherit its default."})]}),S?e.jsxs("p",{role:"alert",children:[S," ",e.jsx("button",{type:"button",onClick:An,children:"Retry saving preferences"})]}):null,i?.issue?e.jsxs("div",{role:"alert",children:[e.jsx("strong",{children:"Configuration needs attention"}),e.jsx("p",{children:i.issue.message}),e.jsx("p",{children:e.jsxs("code",{children:[i.issue.path,i.issue.line?`:${i.issue.line}:${i.issue.column??1}`:""]})}),e.jsxs("p",{children:[i.issue.action," Affected turns are blocked until this is corrected."]}),e.jsx("button",{type:"button",onClick:()=>{n?a?.():g(!0)},children:"Open configuration"})]}):null,n?null:e.jsxs("details",{open:o,onToggle:v=>g(v.currentTarget.open),children:[e.jsx("summary",{children:"Configuration file and sources"}),e.jsx("p",{children:e.jsx("code",{children:i?.path??"Loading…"})}),e.jsx("p",{children:"Unset an override to inherit its default. Changes apply to the next turn; current turns retain their model settings."}),e.jsx("textarea",{"aria-label":"TOML configuration",spellCheck:!1,rows:18,style:{width:"100%",fontFamily:"monospace"},value:c??i?.text??`schema_version = 1
|
|
5
5
|
`,onChange:v=>{c===null&&p(i?.rawRevision??null),d(v.target.value)}}),c!==null&&i?.rawRevision!==u?e.jsx("p",{role:"alert",children:"The file changed elsewhere. Reload before saving your edits."}):null,e.jsxs("div",{className:"configuration-actions",children:[e.jsx("button",{type:"button",disabled:f||!i,onClick:()=>{A("validate")},children:"Validate"}),e.jsx("button",{type:"button",disabled:f||!i||c!==null&&i.rawRevision!==u,onClick:()=>{A("replace")},children:"Save config"}),e.jsx("button",{type:"button",disabled:f,onClick:()=>{d(null),p(null),I().catch(v=>h(String(v)))},children:"Reload file"})]}),i?.recoverableRevisions.length?e.jsxs("label",{children:["Restore a verified revision ",e.jsxs("select",{value:"",disabled:f,onChange:v=>{v.target.value&&A("restore",v.target.value)},children:[e.jsx("option",{value:"",children:"Choose a revision…"}),i.recoverableRevisions.map(v=>e.jsxs("option",{value:v.revision,children:[new Date(v.createdAt).toLocaleString()," · ",v.revision.slice(0,12)]},v.revision))]})]}):null,i?.effective?e.jsxs("details",{children:[e.jsx("summary",{children:"Effective values and sources"}),e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Setting"}),e.jsx("th",{children:"Source"}),e.jsx("th",{children:"Location"})]})}),e.jsx("tbody",{children:Object.entries(i.effective.provenance).map(([v,k])=>e.jsxs("tr",{children:[e.jsx("td",{children:JSON.parse(v).join(".")}),e.jsx("td",{children:k.layer==="user"?"Set here":`Inherited from ${k.layer}`}),e.jsx("td",{children:k.path})]},v))})]}),e.jsx("pre",{children:JSON.stringify(i.effective.document,null,2)})]}):null]}),m?e.jsx("p",{role:"status",children:m}):null]})}function bs({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 ys({state:s,label:n}){return e.jsx("span",{className:`account-state ${s}`,children:n??s.replace("_"," ")})}const $t="https://www.openpond.ai",Et="https://api.openpond.ai";function Ns(s){try{const a=new URL(s).hostname.toLowerCase();if(a==="openpond.ai"||a==="www.openpond.ai")return Et}catch{}return""}function ws(s,n){try{const a=new URL(s);if(a.protocol==="https:"||a.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(a.hostname))return null}catch{}return`${n} must be an https:// URL (or http:// for localhost).`}function Ss({account:s,busy:n,mode:a="update",onClose:t,onSave:i,onRemove:l}){const c=r.useId(),d=r.useRef(null),u=a==="connect",p=s?.baseUrl??$t,o=s?.apiBaseUrl??Ns(p),[g,m]=r.useState(p),[h,f]=r.useState(o),[N,S]=r.useState(""),[P,C]=r.useState(null),[I,A]=r.useState(null);is(I);function v(R){m(R),f(R.trim().replace(/\/+$/,"")===p?o:Ns(R))}async function k(R){R.preventDefault(),C(null),A(null);const j=N.trim(),w=g.trim().replace(/\/+$/,""),y=h.trim().replace(/\/+$/,""),x=(u&&!j?"API key is required.":null)??ws(w,"Environment URL")??ws(y,"API URL");if(x){C(x),(x.startsWith("Environment URL")||x.startsWith("API URL"))&&d.current&&(d.current.open=!0);return}try{await i({handle:u?void 0:s?.handle,currentBaseUrl:u?null:s?.baseUrl??null,baseUrl:w,apiBaseUrl:y,chatApiBaseUrl:u||y!==o?null:s?.chatApiBaseUrl,apiKey:j||void 0,environment:new URL(w).hostname.replace(/^www\./,"")==="openpond.ai"?"production":"custom"})}catch(U){A(U instanceof Error?U.message:String(U))}}async function L(){l&&await l()&&t()}return e.jsx("div",{className:"git-dialog-backdrop account-endpoint-dialog-backdrop",role:"presentation",onMouseDown:R=>{R.target===R.currentTarget&&!n&&t()},children:e.jsxs("form",{className:"git-dialog account-endpoint-dialog",role:"dialog","aria-modal":"true","aria-labelledby":c,onSubmit:R=>{k(R)},children:[e.jsx("button",{className:"git-dialog-close",disabled:n,type:"button",title:"Close","aria-label":"Close",onClick:t,children:e.jsx(ue,{size:16})}),e.jsx("div",{className:"git-dialog-icon",children:u?e.jsx(pe,{size:18}):e.jsx(ls,{size:18})}),e.jsx("h2",{id:c,children:u?"Add account":"Account settings"}),e.jsx("p",{children:u?"Connect an OpenPond account with an API key.":"Review this account and its verified key access."}),!u&&s?e.jsxs("div",{className:"account-dialog-details",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Account"}),e.jsx("strong",{children:s.displayLabel||s.handle})]}),s.email?e.jsxs("div",{children:[e.jsx("span",{children:"Email"}),e.jsx("strong",{children:s.email})]}):null,e.jsxs("div",{children:[e.jsx("span",{children:"Handle"}),e.jsx("strong",{children:s.handle})]}),e.jsxs("div",{children:[e.jsx("span",{children:"API key"}),e.jsx("strong",{children:s.apiKeyHint??(s.authHealth==="signed_in"?"Connected with a session":"No saved API key")})]}),e.jsxs("div",{children:[e.jsx("span",{children:"Access"}),e.jsx("strong",{children:s.apiKeyAccess?s.apiKeyAccess.teamId?"This workspace":s.apiKeyAccess.ownerType==="user"?"All my workspaces":"Account access":"Not verified"})]}),s.apiKeyAccess?e.jsxs("div",{children:[e.jsx("span",{children:"Scopes"}),e.jsx("strong",{children:s.apiKeyAccess.scopes.join(", ")||"No scopes"})]}):null]}):null,u?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"API key"}),e.jsx("input",{autoComplete:"off",disabled:n,placeholder:"opk_...",type:"password",value:N,onChange:R=>S(R.target.value)})]}):null,e.jsxs("details",{className:"account-dialog-advanced",ref:d,children:[e.jsx("summary",{children:"Advanced"}),e.jsxs("div",{className:"account-dialog-advanced-fields",children:[u?null:e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Replace API key"}),e.jsx("input",{autoComplete:"off",disabled:n,placeholder:"Leave blank to keep the current key",type:"password",value:N,onChange:R=>S(R.target.value)}),e.jsx("small",{children:"Enter a new key to replace the saved credential."})]}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Environment URL"}),e.jsx("input",{disabled:n,inputMode:"url",spellCheck:!1,type:"url",value:g,onChange:R=>v(R.target.value)}),e.jsx("small",{children:"Change this URL to connect this account to another environment."})]}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"API URL"}),e.jsx("input",{disabled:n,inputMode:"url",spellCheck:!1,type:"url",value:h,onChange:R=>f(R.target.value)}),e.jsx("small",{children:"Enter the API URL for a custom environment."})]})]})]}),P?e.jsx("div",{className:"profile-dialog-warning",children:P}):null,e.jsx("div",{className:"git-dialog-footer account-dialog-footer",children:e.jsxs("div",{className:"account-dialog-save-actions",children:[!u&&l?e.jsxs("button",{className:"git-dialog-secondary account-dialog-remove",disabled:n,type:"button",onClick:()=>{L()},children:[e.jsx(Ce,{size:14})," Remove account"]}):null,e.jsx("button",{className:"git-dialog-secondary",disabled:n,type:"button",onClick:t,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:n,type:"submit",children:[e.jsx(os,{size:14}),e.jsx("span",{children:n?"Saving":u?"Connect account":"Save changes"})]})]})})]})})}const Mt="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 Lt({payload:s,connection:n,saving:a,refreshingAccounts:t,saveAccount:i,refreshAccounts:l,switchAccount:c,removeAccount:d,onPayload:u,onPreferences:p,onError:o,onToast:g}){const m=s?.account,h=m?.state??"loading",f=h==="signed_in",N=h==="signed_out",S=h==="auth_error",P=m?.email?.trim()||null,C=m?.accounts??[],[I,A]=r.useState([]),[,v]=r.useState(!1),[k,L]=r.useState(null),[R,j]=r.useState(null),[w,y]=r.useState(null),[x,U]=r.useState(null),[F,q]=r.useState(!1),[K,X]=r.useState(null),[T,ee]=r.useState(null),[Z,H]=r.useState(!1),{confirmAction:V,confirmDialog:te,resolveConfirmDialog:W}=Js(),G=C.find(M=>M.isActive)??C[0]??null,ne=s?.preferences.defaultTeamId?.trim()||null,ae=w??ne,ie=In(m),le=s?.accountMeta.asOf??"",b=ve(m?.environment,G?.environment),$=f?ve(G?.displayLabel,G?.handle,m?.label,m?.activeProfile?.handle,"Signed in"):S?"Account needs attention":N?"No account connected":"Loading account",_=f?P??ks(G?.baseUrl??m?.baseUrl,b):S?"Not connected":N?"Cloud projects, hosted agents, and team defaults are disabled until you sign in.":"Checking account status.",he=C.length>0,ce=S?Ot(m?.error):null,O=r.useMemo(()=>I.filter(M=>M.status==="active"),[I]),B=(r.useMemo(()=>ae?O.find(M=>M.teamId===ae)??null:null,[O,ae])??Dn(O))?.teamId??"",se=r.useMemo(()=>O.map(M=>({value:M.teamId,label:ve(M.displayName,M.name,M.slug,"Team"),description:$n(M.role)})),[O]),Q=B||se[0]?.value||"",Ie=se.length>0,xn=!n||!!R||!!k||O.length===0,Fe=x?Ve(x):null,us=!!(Fe&&K===Fe),jn=f||S,vn=ve(T?.version,s?.server.version,"Loading"),hs=T?T.devMode?"Dev mode":T.packaged?`${zt(T.releaseChannel)} build`:"Local build":null,ms=Tt(ve(G?.baseUrl,m?.activeProfile?.baseUrl,m?.baseUrl,"https://openpond.ai"));r.useEffect(()=>{const M=window.openpond?.getDesktopRuntimeInfo;if(!M)return;let J=!1;return M().then(Y=>{J||ee(Y)}).catch(()=>{J||ee(null)}),()=>{J=!0}},[]),r.useEffect(()=>{if(!n||!ie){A([]),L(null),v(!1);return}let M=!1;const J=En(ie);return J?(A(J),v(!1)):(A([]),v(!0)),L(null),Mn({accountKey:ie,force:!!le,fetchOrganizations:async()=>(await E.organizations(n)).organizations.map(Ln).filter(re=>!!re).filter(re=>re.status==="active")}).then(Y=>{M||A(Y)}).catch(Y=>{M||(J||A([]),L(Y instanceof Error?Y.message:String(Y)))}).finally(()=>{M||v(!1)}),()=>{M=!0}},[le,n,ie]),r.useEffect(()=>{w&&ne===w&&y(null)},[ne,w]);async function bn(M,J={notify:!0}){const Y=O.find(re=>re.teamId===M)??null;if(!(!n||!Y||R||(w??ne)===Y.teamId)){y(Y.teamId),j(Y.teamId),o(null),Tn({teamId:Y.teamId,accountKey:ie,force:!0,fetchAgents:async re=>(await E.listSandboxAgents(n,{teamId:re})).agents}).catch(()=>{});try{p(await E.savePreferences(n,{defaultTeamId:Y.teamId})),J.notify&&g?.("Default team updated","success")}catch(re){y(null),o(re instanceof Error?re.message:String(re))}finally{j(null)}}}async function Ge(M="Continue"){return jn?V({title:"Change active OpenPond account?",body:Mt,confirmLabel:M,cancelLabel:"Cancel"}):!0}async function yn(M){await Ge("Save account")&&(await i({apiKey:M.apiKey??"",handle:M.handle,baseUrl:M.baseUrl,apiBaseUrl:M.apiBaseUrl,environment:M.environment}),q(!1))}async function Nn(M){if(!n||!x)throw new Error("OpenPond server connection is not ready.");if(x.isActive&&!await Ge("Save endpoints"))return;const J=Ve(x);X(J),o(null);try{const Y=await E.updateOpenPondAccountConfig(n,{handle:M.handle??x.handle,currentBaseUrl:M.currentBaseUrl,apiKey:M.apiKey,baseUrl:M.baseUrl,apiBaseUrl:M.apiBaseUrl,chatApiBaseUrl:M.chatApiBaseUrl,environment:M.environment,setActive:x.isActive});u(Y),g?.("Account updated","success"),U(null)}catch(Y){throw o(Y instanceof Error?Y.message:String(Y)),Y}finally{X(null)}}async function wn(M){const J=M.handle?.trim()||"";J&&await Ge("Switch account")&&await c(J,M.baseUrl)}async function Sn(M){const J=M.handle?.trim()||"";if(!J)return!1;const Y=ve(M.displayLabel,M.email,M.handle,"this account");return await V({title:"Remove saved account?",body:`Remove ${Y} 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 d(J,M.baseUrl,M.isActive)?(g?.("Account removed","success"),!0):!1}async function kn(){const M=window.openpond?.reloadDesktopApp;if(!(!M||Z)){H(!0),o(null);try{const J=await M();if(!J.ok)throw new Error(J.error??"OpenPond could not refresh the app.")}catch(J){H(!1),o(J instanceof Error?J.message:String(J))}}}async function Cn(){const M=window.openpond?.browser;M?.openExternal&&(await M.openExternal({conversationId:"openpond-account-sign-up",url:ms})).ok||window.open(ms,"_blank","noopener,noreferrer")}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:()=>q(!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:()=>{l()},children:e.jsx(oe,{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(bs,{handle:$,image:f?m?.avatarUrl??G?.avatarUrl??null:null}),e.jsxs("div",{children:[e.jsx("span",{children:"Active account"}),e.jsx("strong",{children:$}),e.jsxs("div",{className:"account-summary-meta",children:[e.jsx("small",{className:f&&P?"private-account-email":f?void 0:"account-summary-copy",tabIndex:f&&P?0:void 0,children:_}),f&&Ie?e.jsx(De,{className:"account-team-dropdown",compact:!0,disabled:xn,label:"Default team",options:se,value:Q,onChange:M=>{bn(M)}}):null]})]})]}),e.jsx("div",{className:"account-summary-actions",children:e.jsx(ys,{state:h,label:N?"not signed in":void 0})})]}),he?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:[C.length," account",C.length===1?"":"s"]})]}),C.map(M=>{const J=M.handle?.trim()||"",Y=ve(M.displayLabel,M.handle,"Unknown account"),re=M.email?.trim()||null,ps=Ve(M);return e.jsxs("div",{className:"account-row",children:[e.jsx(bs,{handle:Y,image:M.avatarUrl??null}),e.jsxs("div",{className:"account-details",children:[e.jsx("strong",{children:Y}),re?e.jsx("span",{className:"private-account-email",tabIndex:0,children:re}):null,e.jsx("span",{children:ks(M.baseUrl,M.environment)}),M.apiKeyHint?e.jsxs("span",{children:["API key ",M.apiKeyHint]}):null]}),e.jsxs("div",{className:"account-row-actions",children:[M.isActive?e.jsx("span",{className:"active-pill",children:"Active"}):null,M.isActive?null:e.jsx("button",{className:"inline-action",disabled:a||!J,type:"button",onClick:()=>{wn(M)},children:"Use"}),e.jsx("button",{className:"settings-icon-button ghost account-endpoint-action",disabled:!n||a||!!K||!J,type:"button","aria-label":`Settings for ${Y}`,title:"Account settings",onClick:()=>U(M),children:e.jsx(ls,{size:15})})]})]},ps)})]}):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(M=>e.jsxs("div",{className:"product-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:M.name}),e.jsx("span",{children:M.type})]}),e.jsx(ys,{state:M.status})]},M.id))]}),e.jsxs("div",{className:"settings-footnote account-build-footnote",children:[e.jsxs("div",{className:"account-build-details",children:[e.jsx("span",{children:"Build version"}),e.jsxs("div",{className:"account-build-version",children:[e.jsx("strong",{children:Ut(vn)}),hs?e.jsx("span",{className:`account-build-context${T?.devMode?" development":""}`,children:hs}):null]})]}),e.jsxs("div",{className:"account-build-actions",children:[T?.canReload?e.jsxs("button",{className:"settings-secondary compact",disabled:Z,type:"button",title:"Reload the local Electron app",onClick:()=>{kn()},children:[e.jsx(oe,{className:Z?"settings-spin":void 0,size:14}),e.jsx("span",{children:Z?"Refreshing":"Refresh app"})]}):null,f?null:e.jsxs("button",{className:"settings-primary compact account-sign-up-action",type:"button",onClick:()=>{Cn()},children:[e.jsx("span",{children:"Sign up"}),e.jsx(On,{size:13})]})]})]}),ce?e.jsxs("div",{className:"settings-footnote warning account-error-footnote",children:[e.jsx("span",{children:"Account error"}),e.jsx("strong",{children:ce})]}):null,x?e.jsx(Ss,{account:x,busy:us||a,onClose:()=>{us||U(null)},onSave:Nn,onRemove:()=>Sn(x)},Fe):null,F?e.jsx(Ss,{busy:a,mode:"connect",onClose:()=>{a||q(!1)},onSave:yn}):null,e.jsx(Ys,{state:te,onResolve:W})]})}function Ve(s){return`${s.handle.trim().toLowerCase()}|${s.baseUrl??"default"}`}function ve(...s){for(const n of s){const a=n?.trim();if(a)return a}return""}function Ot(s){const n=s?.trim();if(!n)return null;const a=n.toLowerCase();return a.includes("protected deployment")?"OpenPond could not reach the account service. Restart and try again.":a.includes("unexpected token '<'")||a.includes("<!doctype")?"OpenPond received a web login page instead of account data. Restart and 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 ks(s,n){try{if(s)return new URL(s).host}catch{}return n?.trim()||"openpond.ai"}function Tt(s){try{return new URL("/login",s).toString()}catch{return"https://openpond.ai/login"}}function Ut(s){const n=s.trim();return!n||n==="Loading"?"Loading":n.startsWith("v")?n:`v${n}`}function zt(s){return s&&`${s[0].toUpperCase()}${s.slice(1)}`}function Bt({advancedWorkspaceControls:s,defaultBranchPrefix:n,defaultNewProjectDirectory:a,preferences:t,saving:i,steerActiveResponses:l,chooseDefaultProjectDirectory:c,saveDefaults:d,setAdvancedWorkspaceControls:u,setSteerActiveResponses:p,setDefaultBranchPrefix:o,setDefaultNewProjectDirectory:g}){const m=Qe(n)===t.defaultBranchPrefix&&a.trim()===t.defaultNewProjectDirectory&&s===t.advancedWorkspaceControls&&l===t.steerActiveResponses;return e.jsxs("section",{className:"account-settings",children:[e.jsx("h2",{children:"General"}),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:l,disabled:i,onChange:h=>p(h.target.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:"Steer active responses"}),e.jsx("small",{children:"Send a new message into the active response immediately. Turn this off to queue it instead."})]})]}),e.jsxs("label",{className:"settings-check-row",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:i,onChange:h=>u(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:i,placeholder:"feat/",onChange:h=>o(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:i,placeholder:"~/Documents/OpenPond Projects",onChange:h=>g(h.target.value)})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:i,onClick:()=>{c()},children:[e.jsx(an,{size:14}),e.jsx("span",{children:"Browse"})]})]}),e.jsx("button",{className:"settings-primary",disabled:i||m,children:e.jsx("span",{children:i?"Saving":"Save settings"})})]}),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 Ht({diagnostics:s,diagnosticsAvailable:n,diagnosticsBusy:a,diagnosticsStatus:t,logDir:i,logLineLimit:l,logLines:c,logViewBusy:d,logViewSummary:u,logViewportRef:p,tailLogs:o,copyRecentLogs:g,exportDiagnosticsBundle:m,loadOlderLogs:h,openLogsFolder:f,refreshLogView:N,toggleTailLogs:S}){const P=s.filter(I=>I.name==="diagnostic"&&I.status==="failed").slice().reverse().map(_t),C=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:[P.length," saved"]})]}),e.jsx("div",{className:"diagnostics-error-list",role:"list",children:P.length===0?e.jsx("div",{className:"diagnostics-error-empty",children:"No saved errors"}):P.map(I=>e.jsxs("article",{className:"diagnostics-error-entry",role:"listitem",children:[e.jsx(Zs,{size:15}),e.jsxs("div",{className:"diagnostics-error-body",children:[e.jsxs("div",{className:"diagnostics-error-title",children:[e.jsx("strong",{children:I.message}),e.jsx("time",{dateTime:I.timestamp,children:I.timeLabel})]}),e.jsxs("div",{className:"diagnostics-error-meta",children:[e.jsx("span",{children:I.surface}),I.status?e.jsx("span",{children:I.status}):null,I.sequence?e.jsxs("span",{children:["#",I.sequence]}):null]}),I.detail?e.jsxs("details",{className:"diagnostics-error-detail",children:[e.jsx("summary",{children:"Details"}),e.jsx("pre",{children:I.detail})]}):null]})]},I.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||!C?.openLogsFolder,onClick:()=>{f()},children:[e.jsx(an,{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||!C?.exportDiagnostics,onClick:()=>{m()},children:[e.jsx(Un,{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||!C?.copyRecentLogs,onClick:()=>{g()},children:[e.jsx(bt,{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:!C?.readRecentLogs,onClick:S,children:o?e.jsx(tn,{size:15}):e.jsx(nn,{size:15})}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Refresh logs","aria-label":"Refresh logs",disabled:d!==null||!C?.readRecentLogs,onClick:()=>{N(l,"refresh")},children:e.jsx(oe,{size:15})}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:d!==null||!C?.readRecentLogs,onClick:h,children:[e.jsx(ot,{size:15}),e.jsx("span",{children:d==="older"?"Loading":"Older"})]})]})]}),e.jsx("div",{ref:p,className:"diagnostics-log-viewer",role:"log","aria-live":o?"polite":"off",children:c.length===0?e.jsx("div",{className:"diagnostics-log-empty",children:d?"Loading logs":"No log lines"}):c.map((I,A)=>e.jsxs("div",{className:"diagnostics-log-entry",children:[e.jsx("span",{className:"diagnostics-log-source",children:I.file}),e.jsx("code",{children:I.line})]},`${I.file}:${I.timestamp}:${I.index}:${A}`))}),i&&e.jsxs("div",{className:"diagnostics-log-dir",children:[e.jsx("span",{children:"Source"}),e.jsx("strong",{children:i})]})]}),t&&e.jsxs("div",{className:`settings-footnote ${t.warning?"warning":""}`,children:[e.jsx("span",{children:t.label}),e.jsx("strong",{children:t.value})]})]})}function _t(s){const n=Cs(s.data),a=Cs(n.context),i=ge(n.stack)??ge(n.detail)??ge(a.detail)??null;return{id:s.id,timestamp:s.timestamp,timeLabel:Gt(s.timestamp),message:Ft(s,n),surface:ge(n.surface)??s.source??"diagnostic",status:s.status??null,sequence:s.sequence??null,detail:i}}function Ft(s,n){return ge(s.error)??ge(s.output)??ge(n.message)??ge(n.error)??"Diagnostic event"}function Gt(s){const n=new Date(s);return Number.isNaN(n.getTime())?s:n.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Cs(s){return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}function ge(s){return typeof s=="string"&&s.trim()?s.trim():null}const Rs=[{id:"typescript",label:"TypeScript",placeholder:"typescript-language-server"},{id:"python",label:"Python",placeholder:"pyright-langserver"},{id:"rust",label:"Rust",placeholder:"rust-analyzer"}];function qt({editorPreferences:s,lspStatus:n,preferences:a,restarting:t,saving:i,statusLoading:l,refreshLspStatus:c,restartLanguageServers:d,saveEditorSettings:u,setEditorPreferences:p,setLanguageCustomCommand:o,setLanguageMode:g}){const m=JSON.stringify(s)!==JSON.stringify(a.editor),h=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:i,label:"Language servers",options:zn,onChange:f=>p(N=>({...N,languageServers:f}))})]})}),e.jsxs("label",{className:"settings-check-row",children:[e.jsx("input",{type:"checkbox",checked:s.diagnosticsWhileEditing,disabled:i||s.languageServers==="off",onChange:f=>p(N=>({...N,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:i||s.languageServers==="off",onChange:f=>p(N=>({...N,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:Rs.map(f=>{const N=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:Ps(h.get(f.id),l)})]}),e.jsxs("div",{className:"settings-select-field",children:[e.jsx("span",{children:"Mode"}),e.jsx(De,{value:N.mode,disabled:i||s.languageServers==="off",label:`${f.label} language server mode`,options:Bn,onChange:S=>g(f.id,S)})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Custom executable"}),e.jsx("input",{value:N.customCommand,disabled:i||s.languageServers==="off"||N.mode!=="custom",placeholder:f.placeholder,onChange:S=>o(f.id,S.target.value)})]})]},f.id)})}),e.jsx("button",{className:"settings-primary",disabled:i||!m,children:e.jsx("span",{children:i?"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:l?"Checking":n?"Current":"Not checked"}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Refresh LSP status","aria-label":"Refresh LSP status",disabled:l||t,onClick:()=>{c()},children:e.jsx(oe,{className:l?"settings-spin":void 0,size:15})}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:l||t,onClick:()=>{d()},children:[e.jsx(Pt,{className:t?"settings-spin":void 0,size:15}),e.jsx("span",{children:t?"Restarting":"Restart"})]})]})]}),Rs.map(f=>{const N=h.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:N?.command??N?.message??void 0,children:N?.command??N?.message??"Not checked"})]}),e.jsx("span",{className:`lsp-status-pill ${N?.status??"missing"}`,children:Ps(N,l)})]},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 Ps(s,n){return n&&!s?"Checking":s?s.status==="found"?"Found":s.status==="disabled"?"Disabled":s.status==="error"?"Error":"Missing":"Not checked"}function As({contextCompactionAutoEnabled:s,embedded:n=!1,preferences:a,saving:t,saveDefaults:i,setContextCompactionAutoEnabled:l}){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:c=>{i(c)},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:c=>l(c.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 Wt({subagentsEnabled:s,subagentDelegationMode:n,subagentsUseDefaultModel:a,subagentsProvider:t,subagentsModel:i,subagentRoles:l,subagentsMaxConcurrentRuns:c,subagentsMaxConcurrentRunsPerProvider:d,subagentsMaxConcurrentRunsPerWorkspaceTarget:u,preferences:p,providers:o,saving:g,saveDefaults:m,changeSubagentsProvider:h,setSubagentsEnabled:f,setSubagentDelegationMode:N,setSubagentsUseDefaultModel:S,setSubagentsModel:P,setSubagentsMaxConcurrentRuns:C,setSubagentsMaxConcurrentRunsPerProvider:I,setSubagentsMaxConcurrentRunsPerWorkspaceTarget:A,setSubagentRoleEnabled:v,setSubagentRoleIsolationMode:k,setSubagentRoleMaxConcurrentRuns:L,setSubagentRoleModel:R,setSubagentRolePeerMessages:j,setSubagentRoleToolPolicy:w,changeSubagentRoleProvider:y}){const x=Qs(o,{enabledOnly:!0}),U=a?p.defaultChatProvider:t,F=a?p.defaultChatModel:i,q=cn(Be(U,o),F),K=a?null:{providerId:t,modelId:i.trim()},X=Zt({enabled:s,delegationMode:n,defaultModelRef:K,roles:l,maxConcurrentRuns:c,maxConcurrentRunsPerProvider:d,maxConcurrentRunsPerWorkspaceTarget:u},p);return e.jsx("section",{className:"account-settings subagents-settings",children:e.jsxs("form",{className:"subagent-settings-form",onSubmit:T=>{m(T)},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${X?"":" dirty"}`,disabled:g||X,children:e.jsx("span",{children:g?"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:g,onChange:T=>f(T.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:g||!s,onChange:T=>N(T.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:U,disabled:g||!s,onChange:T=>{S(!1),h(T.target.value)},children:x.map(T=>e.jsx("option",{value:T.value,children:T.label},T.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Model"}),e.jsx("select",{value:F,disabled:g||!s,onChange:T=>{S(!1),P(T.target.value)},children:q.map(T=>e.jsx("option",{value:T.value,children:T.label},T.value))})]})]})]}),e.jsx("div",{className:"subagent-role-list",children:l.map(T=>{const ee=Hn.find(G=>G.id===T.id),Z=T.modelRef?.providerId??U,H=T.modelRef?.modelId||_n(Z,o)||F,V=Yt(x,o,{providerId:Z,modelId:H}),te=Oe(Z,H),W=g||!s||!T.enabled;return e.jsxs("section",{className:`subagent-role-row${T.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:ee?.label??T.id}),e.jsx("small",{children:ee?.description??"Custom subagent role."})]}),e.jsxs("label",{className:"provider-toggle subagent-card-toggle","aria-label":`${ee?.label??T.id} enabled`,children:[e.jsx("input",{type:"checkbox",checked:T.enabled,disabled:g||!s,onChange:G=>v(T.id,G.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:te,disabled:W,onChange:G=>{const ne=V.find(ae=>ae.value===G.target.value);ne&&(y(T.id,ne.providerId),R(T.id,ne.modelId))},children:V.map(G=>e.jsx("option",{value:G.value,children:G.label},G.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Isolation"}),e.jsx("select",{value:T.isolationMode,disabled:W,onChange:G=>k(T.id,G.target.value),children:Vt.map(G=>e.jsx("option",{value:G.value,children:G.label},G.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Tools"}),e.jsx("select",{value:T.toolPolicy,disabled:W,onChange:G=>w(T.id,G.target.value),children:Kt.map(G=>e.jsx("option",{value:G.value,children:G.label},G.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Peer messages"}),e.jsx("select",{value:T.peerMessages,disabled:W,onChange:G=>j(T.id,G.target.value),children:Jt.map(G=>e.jsx("option",{value:G.value,children:G.label},G.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:T.maxConcurrentRuns,disabled:W,onChange:G=>L(T.id,Is(G.target.value,1))})]})})]},T.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:c,disabled:g||!s,onChange:T=>C(Is(T.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:d??"",placeholder:"No cap",disabled:g||!s,onChange:T=>I(as(T.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:g||!s,onChange:T=>A(as(T.target.value))})]})]})]})]})})}const Vt=[{value:"none",label:"Direct workspace"},{value:"copy_on_write",label:"Copy-on-write"},{value:"worktree",label:"Worktree"}],Kt=[{value:"read_only",label:"Read only"},{value:"workspace_write",label:"Workspace write"},{value:"full_tools",label:"Full tools"}],Jt=[{value:"parent_scoped",label:"Parent-scoped handoffs"},{value:"disabled",label:"Disabled"}];function cn(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 Yt(s,n,a){const t=[];for(const i of s){const l=cn(Be(i.value,n),i.value===a.providerId?a.modelId:"");for(const c of l)t.push({value:Oe(i.value,c.value),label:`${i.label} / ${c.label}`,providerId:i.value,modelId:c.value})}return a.modelId&&!t.some(i=>i.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 as(s){const n=s.trim();if(!n)return null;const a=Number(n);return Number.isFinite(a)?a:null}function Is(s,n){return as(s)??n}function Zt(s,n){const a=n.subagents;return s.enabled===a.enabled&&s.delegationMode===a.delegationMode&&Qt(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 Qt(s,n){return(s?.providerId??null)===(n?.providerId??null)&&(s?.modelId??null)===(n?.modelId??null)}const Xt=[{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 ea({currentUserId:s,enabled:n,mode:a,threads:t,onModeChange:i,onThreadMuteChange:l}){const[c,d]=r.useState(null),[u,p]=r.useState(null);is(u);const o=r.useMemo(()=>t.filter(h=>h.archivedAt===null).map(h=>({thread:h,label:sa(h,s)})).sort((h,f)=>{const N=+!!f.thread.mutedAt-+!!h.thread.mutedAt;return N!==0?N:h.label.localeCompare(f.label)}),[s,t]),g=o.filter(({thread:h})=>!!h.mutedAt).length,m=r.useCallback(async h=>{d(h.id),p(null),await l(h.id,!h.mutedAt)||p("Could not update this conversation. Try again."),d(null)},[l]);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:Xt.map(h=>e.jsxs("label",{className:`notification-mode-option${a===h.mode?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"team-chat-notification-mode",checked:a===h.mode,onChange:()=>i(h.mode)}),e.jsxs("span",{children:[e.jsx("strong",{children:h.label}),e.jsx("small",{children:h.detail})]})]},h.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:g===1?"1 muted":`${g} 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:h,label:f})=>{const N=!!h.mutedAt,S=c===h.id;return e.jsxs("div",{className:"notification-thread-row",children:[e.jsx("span",{className:`notification-thread-icon${N?" muted":""}`,children:N?e.jsx(ht,{size:15}):e.jsx(ln,{size:15})}),e.jsxs("span",{className:"notification-thread-copy",children:[e.jsx("strong",{children:f}),e.jsx("small",{children:N?"Muted":"Uses the team chat setting"})]}),e.jsx("button",{type:"button",className:"settings-secondary",disabled:c!==null,onClick:()=>{m(h)},children:S?"Saving":N?"Unmute":"Mute"})]},h.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 sa(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 na({canSaveCurrentTemplate:s,personalizationTemplateId:n,personalizationTemplateOptions:a,saveAsNewOpen:t,saving:i,selectedPersonalizationTemplate:l,selectedTemplateIsCustom:c,soulDraft:d,templateNameDraft:u,changePersonalizationTemplate:p,changeSoulDraft:o,openSaveAsNew:g,resetPersonalizationDraft:m,savePersonalization:h,setSaveAsNewOpen:f,setTemplateNameDraft:N}){function S(P){P.preventDefault(),h(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:P=>N(P.target.value),placeholder:"Name","aria-label":"Template name"}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Cancel","aria-label":"Cancel",disabled:i,onClick:()=>f(!1),children:e.jsx(ue,{size:15})}),e.jsx("button",{type:"button",className:"settings-icon-button primary",title:"Save new template","aria-label":"Save new template",disabled:i||!d.trim()||!u.trim(),onClick:()=>{h(!0)},children:e.jsx(rs,{size:15})})]}):e.jsxs(e.Fragment,{children:[e.jsx("small",{children:c?"Custom template":"Built-in template"}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Save as new","aria-label":"Save as new",disabled:i||!l||!d.trim(),onClick:g,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:i||a.length===0,label:"Personalization template",options:a,onChange:P=>{p(P)}})]})}),e.jsxs("label",{className:"settings-select-field personalization-editor",children:[e.jsx("span",{children:"SOUL.md"}),e.jsx("textarea",{value:d,onChange:P=>o(P.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:i||!l,onClick:m,children:e.jsx(_e,{size:15})}),c&&e.jsx("button",{className:"settings-icon-button primary",title:"Save template","aria-label":"Save template",disabled:i||!s,children:e.jsx(os,{size:15})})]})]})]})}function ta({connection:s,profile:n,selectedDefaultTeamId:a}){const t=gt(s),i=la(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:[i.active.map(l=>e.jsx(Ds,{pending:t.pendingScheduleIds.has(l.id),schedule:l,refreshing:t.loading,onRefresh:()=>{t.refresh()},onRun:()=>{t.run(l)},onToggle:()=>{t.toggle(l)}},l.id)),e.jsx(aa,{}),n.agents.map(l=>e.jsx(ia,{agent:l,defaultAction:n.summary.defaultAction,profile:n,selectedDefaultTeamId:a},l.id)),i.paused.map(l=>e.jsx(Ds,{pending:t.pendingScheduleIds.has(l.id),schedule:l,refreshing:t.loading,onRefresh:()=>{t.refresh()},onRun:()=>{t.run(l)},onToggle:()=>{t.toggle(l)}},l.id))]})]})})]})}function aa(){return e.jsxs("tr",{className:"profile-agent-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(He,{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 ia({agent:s,defaultAction:n,profile:a,selectedDefaultTeamId:t}){const i=ca(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(He,{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:i.check})}),e.jsx("td",{children:e.jsx($e,{status:i.sync})})]})}function Ds({pending:s,refreshing:n,schedule:a,onRefresh:t,onRun:i,onToggle:l}){const c=ra(a),d=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(He,{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:c})}),e.jsx("td",{children:e.jsxs("div",{className:"profile-schedule-actions",children:[e.jsx("span",{className:"profile-schedule-expression",title:oa(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(oe,{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:i,children:e.jsx(_e,{size:14})}),e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:s,type:"button",title:d,"aria-label":`${d}: ${a.scheduleName}`,onClick:l,children:a.enabled?e.jsx(tn,{size:14}):e.jsx(nn,{size:14})})]})]})})]})}function $e({status:s}){return e.jsx("span",{className:`profile-status-text ${s.state}`,children:s.label})}function la(s){const n=[],a=[];for(const t of s)t.enabled?n.push(t):a.push(t);return n.sort((t,i)=>$s(t)-$s(i)),{active:n,paused:a}}function $s(s){return s.lastRunStatus==="running"?0:s.lastRunStatus==="queued"?1:2}function ra(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 oa(s){const n=[`${s.scheduleType}: ${s.scheduleExpression}`];return s.nextRunAt&&n.push(`next ${Es(s.nextRunAt)}`),s.lastRunAt&&n.push(`last ${Es(s.lastRunAt)}`),n.join(" - ")}function Es(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 ca(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||ua(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(da(s,a))return{check:{state:"ready",label:"Passed"},sync:{state:"warning",label:"Sync acct"}};const t=s.summary.localHead??s.git?.head??null,i=s.hosted?.lastPushedLocalHead??null;return!(s.summary.hostedHead??s.hosted?.sourceCommitSha??null)&&!i?{check:{state:"ready",label:"Passed"},sync:{state:"loading",label:"Not synced"}}:t&&i&&t!==i?{check:{state:"ready",label:"Passed"},sync:{state:"loading",label:"Needed"}}:{check:{state:"ready",label:"Passed"},sync:{state:"ready",label:"Synced"}}}function da(s,n){const a=s.hosted?.teamId?.trim()??"";return!!(a&&n&&a!==n)}function ua(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 i of s.diff.files){const l=i.path.replace(/^profiles\/[^/]+\//,"");(l===t||l.startsWith(`${t}/`)||l.startsWith(`agents/${n.id}/`))&&(a+=1)}return a}function Ms(s){return s.policy.kind==="model"?`${s.policy.model.provider}/${s.policy.model.model}`:"Fixture"}function ha({comparison:s}){const n=[...new Set(s.members.map(t=>t.source.sourceRevision))],a=[...new Set(s.members.map(Ms))];return e.jsxs("table",{className:"profile-evaluations-comparison-matrix",children:[e.jsxs("caption",{children:["Same frozen Taskset ",s.tasksetRelease.id," across Profile source and model choices"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Profile source"}),a.map(t=>e.jsx("th",{scope:"col",children:t},t))]})}),e.jsx("tbody",{children:n.map(t=>e.jsxs("tr",{children:[e.jsx("th",{scope:"row",title:t,children:t.slice(0,12)}),a.map(i=>{const l=s.members.filter(c=>c.source.sourceRevision===t&&Ms(c)===i);return e.jsx("td",{children:l.length?l.map(c=>e.jsxs("div",{children:[e.jsx("strong",{children:c.score===null?"No score":`${Math.round(c.score*100)}%`}),e.jsxs("small",{children:[" · Run ",c.runManifest.id]})]},c.runManifest.id)):"—"},i)})]},t))})]})}function Ls(s){switch(s.kind){case"profile":return"Complete Profile";case"workflow":return`Workflow · ${s.workflowId}`;case"skill":return`Skill · ${s.skillPath}`;case"agent_action":return`Agent action · ${s.actionId}`}}function we(s){const n=new Date(s);return Number.isNaN(n.getTime())?s:n.toLocaleString()}function ma(s){return Object.values(s.statuses).flatMap(n=>{if(!n.enabled||!n.available||!n.credential.connected)return[];const a=s.providers[n.id];return[...new Set([...n.modelIds,...s.modelCaches[n.id]?.models.map(i=>i.id)??[],...a?.modelOverrides??[],n.defaultModel,a?.defaultModel].filter(i=>!!i))].map(i=>({key:JSON.stringify([n.id,i]),providerId:n.id,modelId:i,label:`${n.displayName} · ${i}`}))})}function pa({connection:s,selectedProfileKey:n,focusTarget:a}){const t=r.useRef(null),[i,l]=r.useState(null),[c,d]=r.useState(null),[u,p]=r.useState(50),[o,g]=r.useState(20),[m,h]=r.useState(20),[f,N]=r.useState([]),[S,P]=r.useState(!1),[C,I]=r.useState(null),[A,v]=r.useState([]),[k,L]=r.useState(""),[R,j]=r.useState(null),[w,y]=r.useState(!1),[x,U]=r.useState(!1),[F,q]=r.useState(null),[K,X]=r.useState(null),[T,ee]=r.useState(!1),[Z,H]=r.useState(null);if(r.useEffect(()=>{if(!s||!n){l(null),v([]),j(null);return}let b=!0;return ee(!0),l(null),d(null),p(50),g(20),h(20),N([]),v([]),L(""),j(null),X(null),H(null),E.profileEvaluations(s).then($=>{b&&l($)}).catch($=>{b&&H($ instanceof Error?$.message:String($))}).finally(()=>{b&&ee(!1)}),E.providerSettings(s).then($=>{if(!b)return;const _=ma($);v(_),L(_[0]?.key??"")}).catch($=>{b&&H($ instanceof Error?$.message:String($))}),()=>{b=!1}},[s,n]),r.useEffect(()=>{if(!a||!i)return;const b=i.definitions.find($=>$.target.kind===a.kind&&(a.kind==="profile"||a.kind==="workflow"&&$.target.kind==="workflow"&&$.target.workflowId===a.id||a.kind==="skill"&&$.target.kind==="skill"&&$.target.skillPath===a.id));d(b?.id??null),X(b?null:"No evaluation definition is saved for this Profile component."),t.current?.scrollIntoView({behavior:"smooth",block:"start"})},[i,a]),!n)return null;const V=i?.definitions.find(b=>b.id===c),te=V?i?.runs.filter(b=>b.manifest.profileEvaluation?.definitionId===V.id)??[]:[],W=async()=>{const b=A.find(_=>_.key===k);if(!s||!V||!b||w)return;const $={id:`evaluation-${crypto.randomUUID()}`,createdAt:new Date().toISOString(),definitionId:V.id,modelRef:{providerId:b.providerId,modelId:b.modelId}};y(!0),j(null),X(null),H(null);try{j({request:$,prepared:await E.profileEvaluationPrepare(s,$)})}catch(_){H(_ instanceof Error?_.message:String(_))}finally{y(!1)}},G=async()=>{if(!(!s||!R||x)){U(!0),H(null);try{const b=await E.profileEvaluationRun(s,{...R.request,expectedManifestHash:R.prepared.manifest.contentHash});l(await E.profileEvaluations(s)),j(null),X(`Run ${b.manifest.id} ${b.passed?"passed":"did not pass"}.`)}catch(b){H(b instanceof Error?b.message:String(b))}finally{U(!1)}}},ne=async b=>{const $=A.find(_=>_.key===k);if(!(!s||!$||F)){q(b),X(null),H(null);try{const _=await E.profileEvaluationRunSuite(s,{id:`suite-${crypto.randomUUID()}`,createdAt:new Date().toISOString(),suiteId:b,modelRef:{providerId:$.providerId,modelId:$.modelId}});l(await E.profileEvaluations(s)),X(`Suite ${_.id} ${_.passed?"passed":"did not pass"}.`)}catch(_){H(_ instanceof Error?_.message:String(_))}finally{q(null)}}},ae=b=>{N($=>$.includes(b)?$.filter(_=>_!==b):[...$,b])},ie=async()=>{if(!(!s||f.length<2||S)){P(!0),H(null);try{await E.profileEvaluationCompare(s,f),l(await E.profileEvaluations(s)),N([])}catch(b){H(b instanceof Error?b.message:String(b))}finally{P(!1)}}},le=async(b,$)=>{if(!(!s||C)){I($),H(null);try{const _=await E.profileEvaluationSaveReport(s,b,$);l(await E.profileEvaluations(s)),X(`Report ${_.id} saved to Profile source. Commit and publish the Profile when ready.`)}catch(_){H(_ instanceof Error?_.message:String(_))}finally{I(null)}}};return e.jsxs("section",{ref:t,"aria-label":"Profile evaluations",className:"profile-evaluations",children:[e.jsxs("div",{className:"profile-workflows-header",children:[e.jsx("h3",{children:"Evaluations"}),e.jsx("p",{children:"Checks and retained results for this Profile’s released components."})]}),T?e.jsx("p",{children:"Loading evaluations…"}):null,Z?e.jsx("p",{role:"alert",children:Z}):null,K?e.jsx("p",{role:"status",children:K}):null,i&&i.definitions.length===0?e.jsx("p",{children:"No evaluations in this Profile yet."}):null,i?.suites.length?e.jsxs("div",{className:"profile-evaluations-suites","aria-label":"Evaluation suites",children:[e.jsx("label",{htmlFor:"profile-evaluation-suite-model",children:"Suite model"}),e.jsx("select",{id:"profile-evaluation-suite-model",value:k,disabled:!!F,onChange:b=>L(b.target.value),children:A.map(b=>e.jsx("option",{value:b.key,children:b.label},b.key))}),A.length===0?e.jsx("p",{children:"Connect a provider and load its models in Providers settings to run a suite."}):null,i.suites.map(b=>e.jsxs("div",{className:"profile-evaluations-suite",children:[e.jsx("strong",{children:b.label}),e.jsxs("span",{children:[b.scope==="profile"?"Profile suite":"Component suite"," · ",b.definitionIds.length," checks"]}),e.jsx("button",{type:"button",disabled:!k||!!F||x,onClick:()=>{ne(b.id)},children:F===b.id?"Running suite…":"Run suite"}),i.suiteRuns.filter($=>$.suiteId===b.id).slice(0,5).map($=>e.jsxs("details",{className:"profile-evaluations-suite-run",children:[e.jsxs("summary",{children:[we($.completedAt)," · ",$.passed?"Passed":"Did not pass"," · ",$.members.length," checks"]}),e.jsxs("small",{children:["Profile source ",$.sourceRevision.slice(0,12)," · Suite run ",$.id]}),e.jsx("button",{type:"button",disabled:!!C,onClick:()=>{le("suite",$.id)},children:C===$.id?"Saving report…":"Save report to Profile"}),e.jsx("ul",{children:$.members.map(_=>e.jsxs("li",{children:[e.jsx("strong",{children:$.sourceRevision===i.sourceRevision?i.definitions.find(he=>he.id===_.definitionId)?.label??_.definitionId:_.definitionId}),e.jsxs("span",{children:[_.passed?"Passed":"Did not pass"," · ",_.score===null?"No score":`${Math.round(_.score*100)}%`," · Run ",_.runManifest.id]})]},_.runManifest.id))})]},$.id))]},b.id))]}):null,i?.definitions.map(b=>{const $=i.runs.find(_=>_.manifest.profileEvaluation?.definitionId===b.id);return e.jsxs("div",{className:"profile-evaluations-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:b.label}),e.jsx("p",{children:b.description||Ls(b.target)}),e.jsxs("small",{children:[Ls(b.target)," · ",b.taskIds.length," tasks · ",b.seeds.length," seeds"]}),$?e.jsxs("small",{children:["Latest: ",$.passed?"Passed":"Did not pass"," · ",$.metric.value===null?"No score":`${Math.round($.metric.value*100)}%`," · ",we($.completedAt)]}):null]}),e.jsx("button",{type:"button","aria-expanded":c===b.id,onClick:()=>{d(c===b.id?null:b.id),p(50),g(20),j(null)},children:c===b.id?"Hide details":"View details"})]},b.id)}),V?e.jsxs("div",{className:"profile-evaluations-detail",children:[e.jsx("h4",{children:V.label}),e.jsxs("p",{children:["Taskset ",V.tasksetRelease.id," · ",V.tasksetRelease.contentHash.slice(0,12)]}),e.jsxs("p",{children:["Frozen split: ",V.split," · Minimum pass rate: ",Math.round(V.criterion.minimumPassRate*100),"%"]}),e.jsxs("div",{className:"profile-evaluations-run-form",children:[e.jsx("label",{htmlFor:"profile-evaluation-model",children:"Model"}),e.jsx("select",{id:"profile-evaluation-model",value:k,disabled:w||x,onChange:b=>{L(b.target.value),j(null)},children:A.map(b=>e.jsx("option",{value:b.key,children:b.label},b.key))}),A.length===0?e.jsx("p",{children:"Connect a provider and load its models in Providers settings to run this check."}):null,e.jsx("button",{type:"button",disabled:!k||w||x,onClick:()=>{W()},children:w?"Checking run…":"Check run setup"}),R?e.jsxs("div",{className:"profile-evaluations-run-plan",children:[e.jsx("strong",{children:"Run setup"}),e.jsxs("small",{children:["Profile source ",R.prepared.manifest.profileEvaluation?.sourceRevision.slice(0,12)," · Harness ",R.prepared.manifest.execution.kind==="harness"?R.prepared.manifest.execution.harnessRelease.id:""]}),e.jsxs("small",{children:["Taskset ",R.prepared.taskset.id," · ",R.prepared.manifest.population.length," attempts · ",R.prepared.manifest.limits.timeoutMs/1e3,"s per attempt"]}),e.jsxs("small",{children:["Connected app scopes: ",R.prepared.taskset.connectedAppScopes.join(", ")||"none declared"]}),e.jsx("button",{type:"button",disabled:x,onClick:()=>{G()},children:x?"Running evaluation…":"Run evaluation"})]}):null]}),e.jsxs("div",{className:"profile-evaluations-cases",children:[e.jsx("strong",{children:"Task cases"}),e.jsx("ul",{children:V.taskIds.slice(0,u).map(b=>e.jsx("li",{children:b},b))}),V.taskIds.length>u?e.jsx("button",{type:"button",onClick:()=>p(b=>b+50),children:"Show more cases"}):null,e.jsxs("span",{children:["Seeds: ",V.seeds.join(", ")]})]}),e.jsxs("div",{className:"profile-evaluations-history",children:[e.jsx("strong",{children:"Run history"}),te.length===0?e.jsx("p",{children:"No runs for this check yet."}):e.jsx("ul",{children:te.slice(0,o).map(b=>e.jsxs("li",{children:[e.jsxs("span",{children:[we(b.completedAt)," · ",b.passed?"Passed":"Did not pass"," · ",b.receiptRefs.length," attempts"]}),e.jsxs("small",{children:["Model ",b.manifest.policy.kind==="model"?`${b.manifest.policy.model.provider}/${b.manifest.policy.model.model}`:"fixture"," · Source ",b.manifest.profileEvaluation?.sourceRevision.slice(0,10)," · Run ",b.manifest.id]}),e.jsx("button",{type:"button",disabled:!!C,onClick:()=>{le("run",b.manifest.id)},children:C===b.manifest.id?"Saving report…":"Save report to Profile"})]},b.manifest.id))}),te.length>o?e.jsx("button",{type:"button",onClick:()=>g(b=>b+20),children:"Show more runs"}):null]})]}):null,i&&i.runs.length>1?e.jsxs("div",{className:"profile-evaluations-detail","aria-label":"Compare evaluation runs",children:[e.jsx("h4",{children:"Compare runs"}),e.jsx("p",{children:"Select two or more runs. Comparisons require the same Taskset, cases, environment, grading policy, limits, and runtime."}),e.jsx("div",{className:"profile-evaluations-comparison-runs",children:i.runs.slice(0,m).map(b=>e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:f.includes(b.manifest.id),onChange:()=>ae(b.manifest.id),disabled:S}),e.jsxs("span",{children:[e.jsxs("strong",{children:[b.manifest.profileEvaluation?.definitionId??"Profile evaluation"," · ",b.metric.value===null?"No score":`${Math.round(b.metric.value*100)}%`]}),e.jsxs("small",{children:[we(b.completedAt)," · ",b.manifest.policy.kind==="model"?`${b.manifest.policy.model.provider}/${b.manifest.policy.model.model}`:"fixture"," · Source ",b.manifest.profileEvaluation?.sourceRevision.slice(0,10)," · ",b.manifest.id]})]})]},b.manifest.id))}),i.runs.length>m?e.jsx("button",{type:"button",onClick:()=>h(b=>b+20),children:"Show more runs"}):null,e.jsx("button",{type:"button",disabled:f.length<2||S,onClick:()=>{ie()},children:S?"Comparing…":`Save comparison of ${f.length} runs`})]}):null,i&&i.comparisons.length>0?e.jsxs("div",{className:"profile-evaluations-detail","aria-label":"Saved evaluation comparisons",children:[e.jsx("h4",{children:"Saved comparisons"}),e.jsx("ul",{children:i.comparisons.map(b=>e.jsxs("li",{children:[e.jsxs("strong",{children:[we(b.createdAt)," · ",b.members.length," runs"]}),e.jsx("button",{type:"button",disabled:!!C,onClick:()=>{le("comparison",b.id)},children:C===b.id?"Saving report…":"Save report to Profile"}),e.jsx("ul",{children:b.members.map($=>e.jsxs("li",{children:[$.source.definitionId," · ",$.policy.kind==="model"?`${$.policy.model.provider}/${$.policy.model.model}`:"fixture"," · Source ",$.source.sourceRevision.slice(0,10)," · ",$.score===null?"No score":`${Math.round($.score*100)}%`]},$.runManifest.id))}),e.jsx(ha,{comparison:b})]},b.id))})]}):null,i?.reports.length?e.jsxs("div",{className:"profile-evaluations-detail","aria-label":"Profile evaluation reports",children:[e.jsx("h4",{children:"Reports saved in Profile source"}),e.jsx("ul",{children:i.reports.map(b=>e.jsxs("li",{children:[e.jsxs("strong",{children:[we(b.createdAt)," · ",b.summary.passedChecks,"/",b.summary.totalChecks," checks passed"]}),e.jsxs("small",{children:["Tested source ",b.testedSources.map($=>$.sourceRevision.slice(0,10)).join(", ")," · Evidence ",b.evidence.map($=>$.id).join(", ")]})]},b.id))})]}):null]})}function ga({actions:s,busy:n,library:a,onSelect:t}){const i=a.profiles.find(c=>Xe(c.ref,a.lastUsed))??a.profiles[0]??null,l=i?qe(i.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:l,onChange:c=>{const d=Fn(a,c.currentTarget.value),u=a.profiles.find(p=>Xe(p.ref,d));u&&t(u)},children:a.profiles.length?a.profiles.map(c=>e.jsx("option",{value:qe(c.ref),children:c.name},qe(c.ref))):e.jsx("option",{value:"",children:"No profiles"})}),e.jsx(Gn,{"aria-hidden":"true",size:14})]}),s]})}function fa({addDisabled:s,commitDisabled:n,commitLabel:a,refreshDisabled:t,repoDisabled:i,syncDisabled:l,syncLabel:c,syncStatus:d,onAdd:u,onCommit:p,onRefresh:o,onRepo:g,onSync:m}){const[h,f]=r.useState(!1),N=r.useRef(null);r.useEffect(()=>{if(!h)return;function P(I){N.current?.contains(I.target)||f(!1)}function C(I){I.key==="Escape"&&f(!1)}return document.addEventListener("pointerdown",P),document.addEventListener("keydown",C),()=>{document.removeEventListener("pointerdown",P),document.removeEventListener("keydown",C)}},[h]);function S(P){f(!1),P()}return e.jsx("div",{className:"profile-selector-actions",children:e.jsxs("div",{className:"profile-settings-menu-root",ref:N,children:[e.jsx("button",{"aria-expanded":h,"aria-haspopup":"menu","aria-label":"Profile settings",className:"settings-icon-button ghost profile-settings-menu-trigger",type:"button",onClick:()=>f(P=>!P),children:e.jsx(ls,{size:15})}),h?e.jsxs("div",{className:"profile-settings-menu",role:"menu",children:[e.jsxs("button",{disabled:n,role:"menuitem",type:"button",onClick:()=>S(p),children:[e.jsx(ze,{size:14}),e.jsx("span",{children:a})]}),e.jsxs("button",{disabled:l,role:"menuitem",type:"button",onClick:()=>S(m),children:[e.jsx(xe,{size:14}),e.jsxs("span",{children:[e.jsx("strong",{children:c}),d?e.jsx("small",{children:d}):null]})]}),e.jsxs("button",{disabled:i,role:"menuitem",type:"button",onClick:()=>S(g),children:[e.jsx(Me,{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(oe,{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 xa=[{id:"actions",label:"Actions",detail:"Profile-level reusable actions"},{id:"workflows",label:"Workflows",detail:"Workflow definitions and actions"},{id:"instructions",label:"Instructions",detail:"Profile instructions used by evaluations"},{id:"prompts",label:"Prompts",detail:"Shared prompt files"},{id:"goals",label:"Goals",detail:"Goal definitions; never started automatically"},{id:"evals",label:"Evals",detail:"Evaluation definitions and fixtures"},{id:"examples",label:"Examples",detail:"Example inputs and usage"},{id:"tasksets",label:"Tasksets",detail:"Training and evaluation tasksets"},{id:"extensions",label:"Extension declarations",detail:"Third-party extension metadata"}];function ja({connection:s,entry:n,onClose:a,onPublished:t}){const[i,l]=r.useState("github"),[c,d]=r.useState(""),[u,p]=r.useState(`${n.name}-profile`),[o,g]=r.useState("public"),[m,h]=r.useState(()=>n.state.agents.filter(x=>x.enabled).map(x=>x.id)),[f,N]=r.useState(()=>n.state.skills.filter(x=>x.enabled).map(x=>x.name)),[S,P]=r.useState([]),[C,I]=r.useState(null),[A,v]=r.useState(null),[k,L]=r.useState(null),R=r.useMemo(()=>({ref:n.ref,selection:{agentIds:m,skillNames:f,optionalContent:S},target:{provider:i,owner:c.trim()||null,repository:u.trim(),visibility:i==="github"?"public":o}}),[m,n.ref,S,c,i,u,f,o]);function j(x,U,F){return F?[...new Set([...x,U])]:x.filter(q=>q!==U)}async function w(x){if(x.preventDefault(),!(!u.trim()||A)){v("preview"),L(null);try{I(await E.profilePublicationPreview(s,R))}catch(U){L(U instanceof Error?U.message:String(U))}finally{v(null)}}}async function y(){if(!(!C||C.blockedReasons.length>0||A)){v("publish"),L(null);try{const x=await E.profilePublicationPublish(s,{...R,expectedSourceHash:C.sourceHash,confirmed:!0});t(`Published ${n.name} to ${x.owner}/${x.repository}`),a()}catch(x){L(x instanceof Error?x.message:String(x))}finally{v(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:x=>x.stopPropagation(),onSubmit:w,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!A,type:"button","aria-label":"Close",onClick:a,children:e.jsx(ue,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(xe,{size:18})}),e.jsxs("h2",{id:"profile-publication-title",children:["Publish ",n.name]}),e.jsx("p",{children:"Choose the exact Agents, Skills, workflows, and optional files to share. OpenPond will show the complete file list before it pushes anything."}),C?e.jsx(va,{preview:C}):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:i==="github",onChange:()=>{l("github"),g("public")}}),e.jsx(es,{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:i==="openpond_git",onChange:()=>{l("openpond_git"),g("private")}}),e.jsx(qn,{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:[i==="github"?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"GitHub owner (optional)"}),e.jsx("input",{value:c,placeholder:"Uses gh account",onChange:x=>d(x.currentTarget.value)})]}):null,e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Repository"}),e.jsx("input",{value:u,onChange:x=>p(x.currentTarget.value)})]}),i==="openpond_git"?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Visibility"}),e.jsxs("select",{value:o,onChange:x=>g(x.currentTarget.value),children:[e.jsx("option",{value:"private",children:"Private"}),e.jsx("option",{value:"public",children:"Public"})]})]}):null]}),e.jsx(Ke,{title:"Agents",empty:"No Agents in this Profile",children:n.state.agents.map(x=>e.jsx(Je,{checked:m.includes(x.id),label:x.name,detail:x.path,onChange:U=>h(F=>j(F,x.id,U))},x.id))}),e.jsx(Ke,{title:"Skills",empty:"No Skills in this Profile",children:n.state.skills.map(x=>e.jsx(Je,{checked:f.includes(x.name),label:x.name,detail:x.description||x.path,onChange:U=>N(F=>j(F,x.name,U))},x.name))}),e.jsx(Ke,{title:"Optional content",empty:"",children:xa.map(x=>e.jsx(Je,{checked:S.includes(x.id),label:x.label,detail:x.detail,onChange:U=>P(F=>j(F,x.id,U))},x.id))})]}),k?e.jsx("div",{className:"profile-dialog-warning",children:k}):null,e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:!!A,type:"button",onClick:C?()=>I(null):a,children:C?"Back":"Cancel"}),C?e.jsxs("button",{className:"git-dialog-primary",disabled:!!A||C.blockedReasons.length>0,type:"button",onClick:()=>{y()},children:[e.jsx(xe,{size:14}),e.jsx("span",{children:A==="publish"?"Publishing":C.replacesExisting?"Confirm and replace":"Confirm and publish"})]}):e.jsx("button",{className:"git-dialog-primary",disabled:!!A||!u.trim(),type:"submit",children:A==="preview"?"Building preview":"Review exact files"})]})]})})}function Ke({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 Je({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:i=>t(i.currentTarget.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:n}),e.jsx("small",{children:a})]})]})}function va({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 · ",Os(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," · ",Os(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 Os(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function ba({section:s="all",catalogPresentation:n="list",payload:a,connection:t,onPayload:i,onError:l,onToast:c,onSkillCommand:d,overviewContent:u}){const[p,o]=r.useState(""),[g,m]=r.useState(null),[h,f]=r.useState(!1),[N,S]=r.useState(null),[P,C]=r.useState(null),[I,A]=r.useState(null),v=a?.profile??null,k=a?.preferences.defaultTeamId?.trim()||"",L=s==="all"||s==="profile"||s==="controls",R=s==="all"||s==="profile",j=s==="all"||s==="agents",w=s==="all"||s==="profile";async function y(H){t&&(i(await E.bootstrap(t)),c?.(H,"success"))}async function x(H,V){if(!(!t||g)){m(H),l(null);try{await V()}catch(te){l(te instanceof Error?te.message:String(te))}finally{m(null)}}}function U(){x("init",async()=>{await E.profileInit(t,{}),await y("Profile initialized")})}function F(){x("commit",async()=>{await E.profileCommit(t,{message:p.trim()||null}),o(""),await y("Profile commit complete")})}function q(){x("push",async()=>{if(!k)throw new Error("Select a default team before syncing a hosted profile.");await E.profileCheck(t,{kind:"all"}),await E.profilePush(t,{teamId:k,ensureHosted:!0,message:null}),await y("Profile synced to hosted profile repo")})}function K(H){x(`select:${H.ref.profileId}`,async()=>{await E.profileSelect(t,H.ref),await y(`Using ${H.name}`)})}function X(H){x("add",async()=>{H.source==="blank"?await E.profileInit(t,{path:H.path,profile:H.profile,template:"blank-profile"}):H.source==="local"?await E.profileLoad(t,H):await E.profileInstall(t,H),f(!1),await y(H.source==="blank"?`${H.profile} created`:"Profile added")})}function T(H){x("update",async()=>{await E.profileUpdate(t,H.ref),await y(`${H.name} updated`)})}function ee(H){x("remove",async()=>{await E.profileRemove(t,H.ref),S(null),await y("Profile removed from this device")})}function Z(){x("refresh",async()=>{await y("Profiles refreshed")})}return e.jsxs("section",{className:"account-settings profile-settings",children:[v?.mode==="local"?e.jsxs(e.Fragment,{children:[L?e.jsxs(e.Fragment,{children:[R&&n==="select"?e.jsx(ga,{actions:e.jsx(Ts,{connection:t,onAdd:()=>f(!0),onRefresh:Z,presentation:"menu",profile:v,profileBusy:g,profileCommitMessage:p,selectedDefaultTeamId:k,syncDisabledReason:Us(v,k),setProfileCommitMessage:o,submitProfileCommit:F,submitProfilePush:q}),busy:!!g,library:a?.profileLibrary??{lastUsed:null,profiles:[]},onSelect:K}):e.jsxs(e.Fragment,{children:[R?e.jsx(ya,{busy:!!g,library:a?.profileLibrary??{lastUsed:null,profiles:[]},onAdd:()=>f(!0),onRefresh:Z,onRemove:S,onPublish:C,onUpdate:T,onSelect:K}):null,e.jsx(Ts,{connection:t,profile:v,profileBusy:g,profileCommitMessage:p,selectedDefaultTeamId:k,syncDisabledReason:Us(v,k),setProfileCommitMessage:o,submitProfileCommit:F,submitProfilePush:q})]}),u]}):null,j?e.jsx(ta,{connection:t,profile:v,selectedDefaultTeamId:k}):null,w?e.jsxs(e.Fragment,{children:[e.jsx(Ra,{onSkillCommand:d,onEvaluate:H=>A({kind:"skill",id:H}),profile:v}),e.jsx(pa,{connection:t,focusTarget:I,selectedProfileKey:a?.profileLibrary?.lastUsed?JSON.stringify(a.profileLibrary.lastUsed):null})]}):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||!!g,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||!!g,type:"button",onClick:U,children:[e.jsx(fe,{size:14}),e.jsx("span",{children:g==="init"?"Creating":"Create starter Profile"})]})]})]}),h?e.jsx(Na,{busy:!!g,onClose:()=>f(!1),onSubmit:X}):null,N?e.jsx(wa,{busy:!!g,entry:N,onClose:()=>S(null),onConfirm:()=>ee(N)}):null,P&&t?e.jsx(ja,{connection:t,entry:P,onClose:()=>C(null),onPublished:H=>c?.(H,"success")}):null]})}function ya({busy:s,library:n,onAdd:a,onRefresh:t,onRemove:i,onPublish:l,onSelect:c,onUpdate:d}){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(oe,{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 p=Xe(u.ref,n.lastUsed);return e.jsxs("div",{className:`product-row profile-catalog-row ${p?"selected":""}`,role:"button",tabIndex:s?-1:0,"aria-disabled":s,onClick:()=>{s||c(u)},onKeyDown:o=>{s||o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),c(u))},children:[e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(Me,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:u.name}),e.jsx("span",{title:u.repoPath,children:u.repoPath})]})]}),e.jsx(dn,{status:{state:u.state.error?"warning":"ready",label:u.state.error?"error":p?"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(),d(u)},onKeyDown:o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),o.stopPropagation(),d(u))},children:[e.jsx(oe,{size:14}),e.jsx("span",{children:"Update"})]}):null,e.jsxs("span",{className:"settings-secondary compact",role:"button",tabIndex:0,onClick:o=>{o.stopPropagation(),l(u)},onKeyDown:o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),o.stopPropagation(),l(u))},children:[e.jsx(xe,{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(),i(u)},onKeyDown:o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),o.stopPropagation(),i(u))},children:[e.jsx(Ce,{size:14}),e.jsx("span",{children:"Remove"})]})]})]},`${u.ref.source}:${u.ref.repositoryId}:${u.ref.profileId}`)})]})}function Na({busy:s,onClose:n,onSubmit:a}){const[t,i]=r.useState("blank"),[l,c]=r.useState(""),[d,u]=r.useState(""),[p,o]=r.useState("");function g(m){if(m.preventDefault(),s)return;if(t==="blank"){const f=p.trim();if(!f)return;a({source:t,path:l.trim()||null,profile:f});return}if(t==="local"){const f=l.trim();if(!f)return;a({source:t,path:f,profile:p.trim()||null});return}const h=d.trim();h&&a({source:t,repositoryId:h,profile:p.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:g,children:[e.jsx("button",{className:"git-dialog-close",disabled:s,type:"button","aria-label":"Close",onClick:n,children:e.jsx(ue,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(Me,{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:()=>i("blank")}),"New blank"]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t==="local",onChange:()=>i("local")}),"Local"]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t==="github",onChange:()=>i("github")}),"GitHub"]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t==="openpond_git",onChange:()=>i("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:l,placeholder:"Uses the default local Profile repository",onChange:m=>c(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:l,placeholder:"/path/to/profile-repo",onChange:m=>c(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:d,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:p,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"?p:t==="local"?l:d).trim(),type:"submit",children:t==="blank"?"Create Profile":"Add Profile"})]})]})})}function wa({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:i=>i.stopPropagation(),children:[e.jsx("button",{className:"git-dialog-close",disabled:s,type:"button","aria-label":"Close",onClick:a,children:e.jsx(ue,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(Ce,{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 Ts({connection:s,onAdd:n,onRefresh:a,presentation:t="toolbar",profile:i,profileBusy:l,profileCommitMessage:c,selectedDefaultTeamId:d,syncDisabledReason:u,setProfileCommitMessage:p,submitProfileCommit:o,submitProfilePush:g}){const[m,h]=r.useState(!1),[f,N]=r.useState(!1),[S,P]=r.useState(!1),C=!s||!!l;return e.jsxs(e.Fragment,{children:[t==="menu"&&n&&a?e.jsx(fa,{addDisabled:!!l,commitDisabled:C,commitLabel:l==="commit"?"Committing":"Commit",refreshDisabled:C,repoDisabled:!!l||!i,syncDisabled:C||!i,syncLabel:l==="push"?"Syncing":"Sync",syncStatus:i?Ye(i,d):null,onAdd:n,onCommit:()=>N(!0),onRefresh:a,onRepo:()=>h(!0),onSync:()=>P(!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:C,type:"button",onClick:()=>N(!0),children:[e.jsx(ze,{size:14}),e.jsx("span",{children:l==="commit"?"Committing":"Commit"})]}),e.jsxs("button",{className:"settings-secondary",disabled:C||!i,type:"button",onClick:()=>P(!0),children:[e.jsx(xe,{size:14}),e.jsx("span",{children:l==="push"?"Syncing":"Sync"})]}),e.jsxs("button",{className:"settings-secondary",disabled:!!l||!i,type:"button",onClick:()=>h(!0),children:[e.jsx(Me,{size:14}),e.jsx("span",{children:"Repo"})]}),i?e.jsxs("span",{className:"profile-hosted-status",title:`Profile sync status: ${Ye(i,d)}`,children:[e.jsx(xe,{size:14}),e.jsx("span",{children:"Profile sync"}),e.jsx("strong",{children:Ye(i,d)})]}):null]}),i?e.jsx("span",{className:`profile-local-status ${i.summary.state}`,title:i.summary.message,children:i.summary.message}):null]})}),m&&i?e.jsx(Ca,{profile:i,profileBusy:l,onClose:()=>h(!1)}):null,f?e.jsx(Sa,{disabled:C,profileBusy:l,profileCommitMessage:c,setProfileCommitMessage:p,submitProfileCommit:o,onClose:()=>N(!1)}):null,S&&i?e.jsx(ka,{disabled:C,profile:i,profileBusy:l,selectedDefaultTeamId:d,syncDisabledReason:u,submitProfilePush:g,onClose:()=>P(!1)}):null]})}function Sa({disabled:s,profileBusy:n,profileCommitMessage:a,setProfileCommitMessage:t,submitProfileCommit:i,onClose:l}){function c(d){d.preventDefault(),!s&&(i(),l())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:l,children:e.jsxs("form",{className:"git-dialog profile-commit-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-commit-dialog-title",onMouseDown:d=>d.stopPropagation(),onSubmit:c,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!n,type:"button",title:"Close","aria-label":"Close",onClick:l,children:e.jsx(ue,{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:d=>t(d.target.value)})]}),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:s,type:"submit",children:[e.jsx(ze,{size:14}),e.jsx("span",{children:n==="commit"?"Committing":"Commit"})]})]})]})})}function ka({disabled:s,profile:n,profileBusy:a,selectedDefaultTeamId:t,syncDisabledReason:i,submitProfilePush:l,onClose:c}){const d=Aa(n,t),u=d.reduce((g,m)=>g+m.count,0),p=!s&&!i;function o(g){g.preventDefault(),p&&(l(),c())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:c,children:e.jsxs("form",{className:"git-dialog profile-sync-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-sync-dialog-title",onMouseDown:g=>g.stopPropagation(),onSubmit:o,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!a,type:"button",title:"Close","aria-label":"Close",onClick:c,children:e.jsx(ue,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(xe,{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 ",Re(n.summary.localHead??n.git?.head)," - Last pushed"," ",Re(n.hosted?.lastPushedLocalHead)]})]}),d.length?e.jsx("div",{className:"profile-dialog-diff-list","aria-label":"Profile sync differences",children:d.map(g=>e.jsxs("div",{className:`profile-dialog-diff-row ${g.tone??""}`,children:[e.jsx("strong",{children:g.label}),e.jsx("span",{children:g.detail})]},g.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."})]})}),i?e.jsx("div",{className:"profile-dialog-warning",children:i}):null,e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:!!a,type:"button",onClick:c,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:!p,type:"submit",children:[e.jsx(xe,{size:14}),e.jsx("span",{children:a==="push"?"Syncing":"Confirm sync"})]})]})]})})}function Ca({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(ue,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(Me,{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"," · ",Re(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 Ra({onSkillCommand:s,onEvaluate:n,profile:a}){const t=a.skills.slice().sort((c,d)=>c.name.localeCompare(d.name)),i=!s;function l(c){s?.(c)}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:[a.skillCatalog.skillCount," tracked"]})})]}),t.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:t.map(c=>e.jsx(Pa,{commandDisabled:i,onSkillCommand:l,onEvaluate:n,skill:c},c.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 Pa({commandDisabled:s,onSkillCommand:n,onEvaluate:a,skill:t}){const i=t.validationStatus==="valid"?{state:"ready",label:"valid"}:{state:"warning",label:t.validationStatus};return e.jsxs("tr",{className:"profile-skill-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(Ue,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:t.name}),e.jsx("span",{title:t.path,children:t.path})]})]})}),e.jsx("td",{className:"profile-skill-description",title:t.description,children:t.description||"No description"}),e.jsx("td",{children:e.jsx(dn,{status:i})}),e.jsx("td",{children:e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{className:"profile-skill-source",title:t.sourcePath,children:t.sourcePath})})}),e.jsx("td",{children:e.jsxs("div",{className:"profile-skill-actions",children:[a?e.jsx("button",{className:"settings-secondary compact",type:"button",onClick:()=>a(t.path),children:"Evaluate"}):null,e.jsx("button",{className:"settings-secondary compact",disabled:s||!t.enabled,type:"button",title:`Use ${t.name}`,onClick:()=>n(`$${t.name} `),children:e.jsx("span",{children:"Use"})}),e.jsx("button",{className:"settings-secondary compact",disabled:s,type:"button",title:`Edit ${t.name}`,onClick:()=>n(`/skill edit ${t.name} `),children:e.jsx("span",{children:"Edit"})})]})})]})}function dn({status:s}){return e.jsx("span",{className:`profile-status-text ${s.state}`,children:s.label})}function Re(s){return s?s.slice(0,10):"None"}function Ye(s,n){return un(s,n)?"Sync this account":s.hosted?.sourceCommitSha?`${s.hosted.promotionStatus??"uploaded"} ${Re(s.hosted.sourceCommitSha)}`:"Not pushed"}function Us(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 Aa(s,n){const a=[],t=s.summary.localHead??s.git?.head??null,i=s.hosted?.lastPushedLocalHead??null,l=s.summary.hostedHead??s.hosted?.sourceCommitSha??null;if(un(s,n)&&a.push({label:"Account",detail:"Hosted profile metadata was synced under a different default team.",count:1,tone:"warning"}),!l&&!i?a.push({label:"Hosted source",detail:"No hosted profile commit has been recorded.",count:1}):t&&i&&t!==i&&a.push({label:"Commit",detail:`Local ${Re(t)} has not been pushed since ${Re(i)}.`,count:1}),s.git?.dirty){const d=(s.git.fileCount??s.git.files.length)||(s.diff.fileCount??s.diff.files.length)||1;a.push({label:"Uncommitted files",detail:`${d} local ${d===1?"file":"files"} changed.`,count:d,tone:"warning"})}const c=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 c>0&&a.push({label:"Profile changes",detail:Ia(s),count:c,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 Ia(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 un(s,n){const a=s.hosted?.teamId?.trim()??"";return!!(a&&n&&a!==n)}const Da=[{value:"local_secret",label:"Saved key",description:"Encrypted on this machine"},{value:"env",label:"Environment variable",description:"Read by the local server"}],$a=120,Ea=new Set(["openai","xai","zai"]),Ma=new Set(["chatgpt-subscription"]),La="https://api.z.ai/api/coding/paas/v4";function zs(s){return s.split(/[\n,]/).map(n=>n.trim()).filter(Boolean)}function hn(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 mn(s){return s?s.available?"ready":s.credential.connected?"configured":s.credential.lastError||s.lastError||s.id==="codex"?"warning":"muted":"unknown"}function Bs(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 Oa(s){return s?.trim().replace(/\/+$/,"")??""}function pn(s,n){return s.id==="zai"&&Oa(n.providers.zai?.baseUrl)===La}function Ta(s,n){return!s.credential.connected||!s.routing.localByok?"":s.credential.source==="chatgpt_subscription"?"Subscription":pn(s,n)?"Coding Plan key":"API key"}function Ua(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),i=s.defaultModel?ns(s.defaultModel,n,s.id):"",l=t===1?"1 model":`${t} models`,c=Ta(s,n);return[hn(s),c,a?l:"",i].filter(Boolean).join(" · ")}function za(s){return s!=="openpond"&&ss(s)}function cs(s){return s?Ea.has(s.id)||s.credentialModes.some(n=>Ma.has(n)):!1}function Ba(s){return cs(s)?["api","subscription"]:["api"]}function Hs(s,n){return!s||!n||!cs(s)?"api":s.credential.source==="chatgpt_subscription"||pn(s,n)?"subscription":"api"}function _s(s,n){const a=Wn.filter(t=>!!s?.statuses[t]);return n?a.filter(t=>cs(s?.statuses[t])):a}function Ha(s){if(!s)return"Never";const n=new Date(s);return Number.isNaN(n.getTime())?s:n.toLocaleString()}function _a(s,n,a=$a){const t=[],i=new Set,l=new Set(n.map(d=>d.trim()).filter(Boolean)),c=d=>{i.has(d.value)||t.length>=a||(i.add(d.value),t.push(d))};for(const d of s)l.has(d.value)&&c(d);for(const d of s)c(d);return t}function Fa({account:s,codex:n,providers:a,providerBusy:t,validationMessage:i,deleteProviderCredential:l,loadProviderModels:c,refreshProviderModels:d,saveProviderConfig:u,saveProviderCredential:p,startOpenAiSubscriptionAuth:o,validateProvider:g}){const[m,h]=r.useState(null),[f,N]=r.useState(!1),S=r.useMemo(()=>_s(a,!1),[a]),P=r.useMemo(()=>_s(a,f),[a,f]),C=m?a?.statuses[m]??null:null;function I(A,v){h(A),v&&c(A)}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:A=>N(A.currentTarget.checked)}),e.jsx("span",{children:"Subscriptions"})]})]}),e.jsxs("small",{children:[P.length," of ",S.length," presets"]})]}),P.length>0?e.jsx("div",{className:"provider-manager-scroll",role:"list",children:P.map(A=>{const v=a.statuses[A],k=a.modelCaches[A],L=v.modelIds.length>0&&(k?.models.length??0)<v.modelIds.length,R=t?.startsWith(`${A}:`)??!1,j=za(A),w=A==="openpond"||!!a.providers[A]?.enabled;return e.jsxs("div",{className:"provider-manager-row",role:"listitem",children:[e.jsxs("label",{className:"provider-toggle","aria-label":`Enable ${v.displayName}`,children:[e.jsx("input",{type:"checkbox",checked:w,disabled:!j||R,onChange:y=>{I(A,!1),u(A,{enabled:y.currentTarget.checked})}}),e.jsx("span",{})]}),e.jsx("div",{className:"provider-row-main",children:e.jsx("strong",{children:v.displayName})}),e.jsxs("div",{className:`provider-row-status ${mn(v)}`,children:[R?e.jsx(de,{size:13,className:"settings-spin"}):null,e.jsx("span",{children:Ua(v,a)})]}),e.jsx("button",{type:"button",className:"settings-secondary provider-details-button",onClick:()=>{I(A,L)},children:"Details"})]},A)})}):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,i?e.jsxs("div",{className:"settings-footnote provider-validation-message",children:[e.jsx("span",{children:"Last validation"}),e.jsx("strong",{children:i})]}):null,m&&C&&a?e.jsx(Ga,{account:s,codex:n,providerId:m,providerBusy:t,settings:a,status:C,onClose:()=>h(null),onDeleteCredential:l,onRefreshModels:d,onSaveConfig:u,onSaveCredential:p,onStartOpenAiSubscriptionAuth:o,onValidate:g}):null]})}function Ga({account:s,codex:n,providerId:a,providerBusy:t,settings:i,status:l,onClose:c,onDeleteCredential:d,onRefreshModels:u,onSaveConfig:p,onSaveCredential:o,onStartOpenAiSubscriptionAuth:g,onValidate:m}){const h=i.providers[a],f=i.modelCaches[a],N=r.useId(),S=r.useRef(a),P=Math.max(f?.models.length??0,l.modelIds.length),C=l.routing.localByok&&ss(a)&&a!=="codex",I=r.useMemo(()=>C?Ba(l):[],[C,l]),A=I.includes("subscription"),[v,k]=r.useState(()=>Hs(l,i)),L=C&&v==="subscription"&&A,R=w=>`${N}-${w}-panel`,j=a==="codex"?"Codex app server":h?.baseUrl??(a==="openpond"?s?.chatApiBaseUrl:null)??"Not set";return r.useEffect(()=>{if(S.current!==a){S.current=a,k(Hs(l,i));return}C&&!I.includes(v)&&k("api")},[v,I,C,a,i,l]),e.jsx("div",{className:"git-dialog-backdrop provider-dialog-backdrop",role:"presentation",onMouseDown:c,children:e.jsxs("section",{className:"git-dialog provider-details-dialog",role:"dialog","aria-modal":"true","aria-label":`${l.displayName} provider details`,onMouseDown:w=>w.stopPropagation(),children:[e.jsx("button",{className:"git-dialog-close",type:"button",title:"Close","aria-label":"Close",onClick:c,children:e.jsx(ue,{size:16})}),e.jsxs("div",{className:"provider-dialog-header",children:[e.jsxs("div",{children:[e.jsx("h2",{children:l.displayName}),e.jsx("span",{children:Te(a,i)})]}),e.jsx("div",{className:`provider-state-pill ${mn(l)}`,children:hn(l)})]}),C?e.jsx("div",{className:"surface-tabs provider-mode-tabs",role:"tablist","aria-label":`${l.displayName} mode`,children:I.map(w=>e.jsx("button",{type:"button",role:"tab",id:`${N}-${w}`,className:v===w?"active":void 0,"aria-selected":v===w,"aria-controls":R(w),onClick:()=>k(w),children:w==="api"?"API":"Subscription"},w))}):null,e.jsxs("dl",{className:"provider-dialog-stats",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Credential"}),e.jsx("dd",{title:Bs(l),children:Bs(l)})]}),L?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Base URL"}),e.jsx("dd",{title:j,children:j})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Model"}),e.jsx("dd",{title:h?.defaultModel??l.defaultModel??void 0,children:h?.defaultModel??l.defaultModel??"Not set"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Models"}),e.jsxs("dd",{title:f?.lastError??void 0,children:[P," cached · ",Ha(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,l.credential.lastError||f?.lastError||l.lastError?e.jsxs("div",{className:"provider-dialog-error",children:[e.jsx("dt",{children:"Error"}),e.jsx("dd",{title:l.credential.lastError??f?.lastError??l.lastError??void 0,children:l.credential.lastError??f?.lastError??l.lastError})]}):null]}),a==="codex"?e.jsx(qa,{providerBusy:t,status:l,onValidate:m}):C&&h&&f?e.jsx(Wa,{credentialTab:v,credentialTabsId:N,hasSubscriptionTab:A,providerId:a,providerBusy:t,settings:i,status:l,onDeleteCredential:d,onRefreshModels:u,onSaveConfig:p,onSaveCredential:o,onStartOpenAiSubscriptionAuth:g,onValidate:m}):l.routing.localByok&&!ss(a)?e.jsxs("div",{className:"provider-dialog-note",children:[e.jsx(Zs,{size:15}),e.jsx("span",{children:"Adapter pending"})]}):null]})})}function qa({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(pe,{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(de,{size:14,className:"settings-spin"}):e.jsx(Xs,{size:14}),e.jsx("span",{children:t?"Testing":"Test Codex login"})]})})]})}function Wa({credentialTab:s,credentialTabsId:n,hasSubscriptionTab:a,providerId:t,providerBusy:i,settings:l,status:c,onDeleteCredential:d,onRefreshModels:u,onSaveConfig:p,onSaveCredential:o,onStartOpenAiSubscriptionAuth:g,onValidate:m}){const h=l.providers[t],f=r.useMemo(()=>Be(t,l),[t,l]),N=`provider-models-${t}`,S=r.useRef(t),[P,C]=r.useState(h.baseUrl??""),[I,A]=r.useState(h.defaultModel??""),[v,k]=r.useState(h.modelOverrides.join(`
|
|
6
6
|
`)),[L,R]=r.useState({baseUrl:!1,defaultModel:!1,modelOverrides:!1}),[j,w]=r.useState("local_secret"),[y,x]=r.useState(""),[U,F]=r.useState(""),q=i===`${t}:config`,K=i===`${t}:credential`,X=i===`${t}:validate`,T=i===`${t}:models`,ee=i==="openai:credential",Z=t==="openai",H=t==="xai",V=t==="zai",W=(z=>`${n}-${z}-panel`)(s),G=s==="subscription"&&a,ne=s==="subscription"&&V?"coding-plan":"api",ae=ne==="coding-plan"?"Coding Plan key":"API key",ie=c.credential.connected?ne==="coding-plan"?"Replace saved plan key":"Replace saved key":ae,le=ne==="coding-plan"?"Save plan key":"Save key",b=r.useMemo(()=>_a(f,[I,...zs(v)]),[I,f,v]),$=Math.max(0,f.length-b.length);r.useEffect(()=>{if(S.current!==t){S.current=t,R({baseUrl:!1,defaultModel:!1,modelOverrides:!1}),C(h.baseUrl??""),A(h.defaultModel??""),k(h.modelOverrides.join(`
|
|
7
7
|
`));return}L.baseUrl||C(h.baseUrl??""),L.defaultModel||A(h.defaultModel??""),L.modelOverrides||k(h.modelOverrides.join(`
|
|
8
8
|
`))},[h.baseUrl,h.defaultModel,h.modelOverrides,L.baseUrl,L.defaultModel,L.modelOverrides,t]);const _=j==="env"?!!U.trim():!!y.trim();async function he(z){z.preventDefault(),await p(t,{enabled:!0,baseUrl:P.trim()||null,defaultModel:I.trim()||null,modelOverrides:zs(v)}),R({baseUrl:!1,defaultModel:!1,modelOverrides:!1})}async function ce(z){if(z.preventDefault(),!!_){if(j==="env"){await o(t,{source:"env",envVar:U.trim()});return}await o(t,{source:"local_secret",value:y}),x("")}}function O({panel:z=!0}={}){return e.jsxs("form",{className:"provider-credential-panel",id:z?W:void 0,role:z?"tabpanel":void 0,"aria-labelledby":z?`${n}-${s}`:void 0,onSubmit:B=>{ce(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:j,disabled:K,label:"Credential source",options:Da,onChange:B=>w(B)})]}),j==="env"?e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Environment variable"}),e.jsx("input",{value:U,disabled:K,placeholder:"PROVIDER_API_KEY",onChange:B=>F(B.currentTarget.value)})]}):e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:ae}),e.jsx("input",{type:"password",value:y,disabled:K,placeholder:ie,autoComplete:"off",onChange:B=>x(B.currentTarget.value)})]})]}),e.jsxs("div",{className:"settings-button-row",children:[e.jsxs("button",{className:"settings-secondary",disabled:K||!_,children:[K?e.jsx(de,{size:14,className:"settings-spin"}):e.jsx(pe,{size:14}),e.jsx("span",{children:K?"Saving":le})]}),e.jsx("button",{type:"button",className:"settings-icon-button ghost","aria-label":`Delete ${c.displayName} credential`,disabled:K||!c.credential.connected,onClick:()=>{d(t)},children:e.jsx(Ce,{size:15})})]})]})}function D(){return Z?e.jsxs("div",{className:"provider-subscription-panel",id:W,role:"tabpanel","aria-labelledby":`${n}-subscription`,children:[e.jsxs("div",{className:"provider-dialog-note codex-provider-note",children:[e.jsx(pe,{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:ee,onClick:()=>{g("browser")},children:[ee?e.jsx(de,{size:14,className:"settings-spin"}):e.jsx(pe,{size:14}),e.jsx("span",{children:ee?"Opening":"Connect ChatGPT"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:ee,onClick:()=>{g("device")},children:[ee?e.jsx(de,{size:14,className:"settings-spin"}):e.jsx(pe,{size:14}),e.jsx("span",{children:"Device code"})]}),e.jsx("button",{type:"button",className:"settings-icon-button ghost","aria-label":`Delete ${c.displayName} credential`,disabled:ee||!c.credential.connected,onClick:()=>{d(t)},children:e.jsx(Ce,{size:15})})]})]}):H?e.jsx("div",{className:"provider-subscription-panel",id:W,role:"tabpanel","aria-labelledby":`${n}-subscription`,children:e.jsxs("div",{className:"provider-dialog-note xai-provider-note",children:[e.jsx(pe,{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."})]})}):V?e.jsxs("div",{className:"provider-subscription-panel",id:W,role:"tabpanel","aria-labelledby":`${n}-subscription`,children:[e.jsxs("div",{className:"provider-dialog-note subscription-provider-note",children:[e.jsx(pe,{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."})]}),O({panel:!1})]}):null}return e.jsxs("div",{className:"provider-dialog-body",children:[G?null:e.jsxs("form",{className:"provider-card-form",onSubmit:z=>{he(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:P,disabled:q,placeholder:"https://api.example.com/v1",onChange:z=>{R(B=>({...B,baseUrl:!0})),C(z.currentTarget.value)}})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Default model"}),e.jsx("input",{list:N,value:I,disabled:q,placeholder:"Model id",onChange:z=>{R(B=>({...B,defaultModel:!0})),A(z.currentTarget.value)}}),e.jsx("datalist",{id:N,children:b.map(z=>e.jsx("option",{value:z.value,children:z.label},z.value))}),$>0?e.jsxs("small",{children:[$," more cached models hidden from suggestions"]}):null]})]}),e.jsxs("div",{className:"settings-button-row",children:[e.jsxs("button",{className:"settings-secondary",disabled:q,children:[q?e.jsx(de,{size:14,className:"settings-spin"}):e.jsx(os,{size:14}),e.jsx("span",{children:q?"Saving":"Save config"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:T,onClick:()=>{u(t)},children:[T?e.jsx(de,{size:14,className:"settings-spin"}):e.jsx(oe,{size:14}),e.jsx("span",{children:T?"Refreshing":"Refresh models"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:X||!I.trim(),onClick:()=>{m(t,{baseUrl:P.trim()||void 0,modelId:I.trim()||void 0})},children:[X?e.jsx(de,{size:14,className:"settings-spin"}):e.jsx(Xs,{size:14}),e.jsx("span",{children:X?"Testing":"Test"})]})]})]}),e.jsx("div",{className:"provider-card-form credential-form",children:G?D():O()})]})}function Va({status:s,busy:n,flashTailscaleUp:a,refresh:t,enableRemoteAccess:i,disableRemoteAccess:l,copyRemoteLink:c,copyTailscaleUpCommand:d,copyServeCommand:u,copyServeSetupUrl:p,copyOperatorCommand:o,createRemoteLink:g}){const m=s?.tailscale.installed??!1,h=s?.serve.enabled??!1,f=s?.serve.reachable??!1,N=!!(s?.webUiAvailable&&m),S=h?!!s?.remoteWebUrl:N,C=(s?.tailscale.peers??[]).filter(v=>!v.isSelf),I=!!s?.tailscale.error?.includes("set --operator"),A=!!(h&&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":h?"configured":""}`,children:m?e.jsx(on,{size:18}):e.jsx(mt,{size:18})}),e.jsxs("div",{children:[e.jsx("strong",{children:f?"Tailscale Serve is reachable":h?"Tailscale Serve is configured":"Tailscale Serve is off"}),e.jsx("small",{children:s?Ya(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(oe,{className:n==="refresh"?"settings-spin":"",size:15})}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:n!==null||!m||!h&&!N,onClick:()=>{h?l():i()},children:[e.jsx(Vn,{size:15}),e.jsx("span",{children:h?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:A?"Browser UI":"Tailscale + Serve"})]})}),A&&e.jsx(me,{label:"Remote URL",value:s?.remoteWebUrl??null,actionLabel:n==="copy-link"?"Copying":"Copy",disabled:!s?.remoteWebUrl||n!==null,onAction:c}),e.jsx(me,{label:"Tailscale up",value:s?.tailscaleUpCommand??null,flash:a,actionLabel:n==="copy-up-command"?"Copying":"Copy",disabled:!s?.tailscaleUpCommand||n!==null,onAction:d}),e.jsx(me,{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(me,{label:"Enable Serve",value:s.serve.setupUrl,actionLabel:n==="copy-serve-setup"?"Copying":"Copy",disabled:n!==null,onAction:p}),I&&e.jsx(me,{label:"One-time setup",value:s?.operatorCommand??null,actionLabel:n==="copy-operator"?"Copying":"Copy",disabled:!s?.operatorCommand||n!==null,onAction:o}),e.jsx(me,{label:"Local target",value:s?.localUrl??null}),s?.tailscale.authUrl&&e.jsx(me,{label:"Tailscale login",value:s.tailscale.authUrl}),e.jsx(me,{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:[C.length," devices"]})]}),e.jsx("button",{type:"button",className:"settings-secondary",disabled:n!==null||!S,onClick:()=>{g()},children:e.jsx("span",{children:h?"Copy link":"Create link"})})]}),s?C.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."})]}):C.map(v=>e.jsx(Ja,{peer:v},v.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 me({actionLabel:s,disabled:n,flash:a,label:t,onAction:i,value:l}){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:l??"Not available"})]}),i&&e.jsx("button",{type:"button",className:"settings-secondary",disabled:n,onClick:()=>{i()},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(Fs,{label:t.label,value:t.value},t.label))}),e.jsx("div",{className:"remote-access-environment-row two",children:a.map(t=>e.jsx(Fs,{label:t.label,value:t.value},t.label))})]})}function Fs({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 Ja({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 Ya(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 Za=[{items:[{section:"account",label:"Account",Icon:js},{section:"notifications",label:"Notifications",Icon:ln},{section:"providers",label:"Providers",Icon:en},{section:"usage",label:"Activity",Icon:Jn}]},{label:"Harness",items:[{section:"harness",label:"Overview",Icon:ct},{section:"harness-refiner",label:"Refiner",Icon:xs},{section:"harness-continuous-review",label:"Continuous Review",Icon:oe},{section:"harness-contents",label:"Contents",Icon:Yn},{section:"harness-releases",label:"Releases",Icon:dt}]},{label:"Customization",items:[{section:"configuration",label:"Configuration",Icon:It},{section:"personalization",label:"Personalization",Icon:xs},{section:"editor",label:"Editor",Icon:ut},{section:"skills",label:"Skills",Icon:Ue}]},{label:"Agents",items:[{section:"profile",label:"Profiles",Icon:js},{section:"subagents",label:"Agents",Icon:He}]},{label:"System",items:[{section:"dataset-storage",label:"Dataset Storage",Icon:St},{section:"remote",label:"Remote Access",Icon:on},{section:"diagnostics",label:"Diagnostics",Icon:pt}]}];function Qa({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(Kn,{size:15}),e.jsx("span",{children:"Back to app"})]}),e.jsx("nav",{className:"settings-nav","aria-label":"Settings",children:Za.map((t,i)=>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:l,label:c,Icon:d})=>e.jsxs("button",{className:`settings-nav-item ${s===l?"active":""}`,onClick:()=>a(l),children:[e.jsx(d,{size:16}),e.jsx("span",{children:c})]},l))]},t.label??`settings-${i}`))})]})}function Xa({catalog:s,connection:n,onCatalog:a,onError:t,onOpenExtension:i,onToast:l}){const[c,d]=r.useState(""),[u,p]=r.useState(""),[o,g]=r.useState(null),[m,h]=r.useState(null),[f,N]=r.useState(null),S=r.useCallback(j=>{const w=j instanceof Error?j.message:String(j);N(w),t(w),l?.(w,"error")},[t,l]),P=r.useCallback(()=>{N(null),t(null)},[t]),C=r.useCallback(async j=>{if(j?.preventDefault(),!(!n||!c.trim()||m)){P(),h("preview");try{const w=await E.extensionPreview(n,{source:c.trim(),...u.trim()?{ref:u.trim()}:{}});g(w)}catch(w){g(null),S(w)}finally{h(null)}}},[m,P,n,S,u,c]),I=r.useCallback(async()=>{if(!(!n||!o||m)){P(),h("install");try{const j=await E.extensionAdd(n,{source:o.repositoryUrl,ref:o.requestedRef});a(j.catalog),d(""),p(""),g(null),l?.(`Installed ${j.extension.owner}/${j.extension.repo}.`,"success")}catch(j){S(j)}finally{h(null)}}},[m,P,n,a,l,o,S]),A=r.useCallback(async j=>{if(!(!n||m)){P(),h(`update:${j.id}`);try{const w=await E.extensionUpdate(n,j);a(w.catalog);const y=w.extension.resolvedCommit===j.resolvedCommit&&w.extension.packageHash===j.packageHash;l?.(y?`${j.owner}/${j.repo} is already current.`:`Updated ${j.owner}/${j.repo}.`,"success")}catch(w){S(w)}finally{h(null)}}},[m,P,n,a,l,S]),v=r.useCallback(async()=>{if(!(!n||m||s.extensions.length===0)){P(),h("update-all");try{const j=await E.extensionUpdateAll(n);a(j.catalog);const w=`Updated ${j.updated.length}; ${j.unchanged.length} already current${j.failed.length?`; ${j.failed.length} failed`:""}.`;l?.(w,j.failed.length?"error":"success"),j.failed.length&&N(j.failed.map(y=>y.error).join(" "))}catch(j){S(j)}finally{h(null)}}},[m,s.extensions.length,P,n,a,l,S]),k=r.useCallback(async j=>{if(!(!n||m)&&window.confirm(`Remove ${j.owner}/${j.repo} and its ${j.skills.length} installed skill${j.skills.length===1?"":"s"}? Profile and built-in skills will not be changed.`)){P(),h(`remove:${j.id}`);try{const w=await E.extensionRemove(n,j);a(w.catalog),l?.(`Removed ${j.owner}/${j.repo}.`,"success")}catch(w){S(w)}finally{h(null)}}},[m,P,n,a,l,S]),L=r.useCallback(j=>{d(j),g(null),N(null)},[]),R=r.useCallback(j=>{p(j),g(null),N(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:()=>{v()},children:[m==="update-all"?e.jsx(de,{className:"settings-spin",size:13}):e.jsx(oe,{size:13}),"Update all"]})]})]}),e.jsxs("form",{className:"github-extension-add",onSubmit:j=>{C(j)},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:c,onChange:j=>L(j.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:j=>R(j.target.value)})]}),e.jsxs("button",{className:"settings-secondary",disabled:!n||!c.trim()||m!==null,type:"submit",children:[m==="preview"?e.jsx(de,{className:"settings-spin",size:14}):e.jsx(es,{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(j=>e.jsx("span",{children:j.name},j.relativePath))}),e.jsxs("button",{className:"settings-secondary",disabled:m!==null,type:"button",onClick:()=>{I()},children:[m==="install"?e.jsx(de,{className:"settings-spin",size:14}):e.jsx(fe,{size:14}),m==="install"?"Installing":"Install extension"]})]}):null,s.extensions.length?s.extensions.map(j=>{const w=m===`update:${j.id}`,y=m===`remove:${j.id}`;return e.jsxs("div",{className:"github-extension-row",children:[e.jsxs("button",{"aria-label":`Open ${j.owner}/${j.repo} extension source`,className:"github-extension-open",disabled:!n||m!==null,type:"button",onClick:()=>i(j),children:[e.jsx("span",{className:"native-skill-icon","aria-hidden":"true",children:e.jsx(es,{size:17})}),e.jsxs("span",{className:"native-skill-identity",children:[e.jsxs("strong",{children:[j.owner,"/",j.repo]}),e.jsx("span",{children:j.skills.map(x=>x.name).join(", ")})]}),e.jsxs("span",{className:"native-skill-provider",children:[e.jsxs("strong",{children:[j.skills.length," skill",j.skills.length===1?"":"s"]}),e.jsxs("span",{children:[j.requestedRef," · ",j.resolvedCommit.slice(0,12)]})]}),e.jsx("span",{className:`native-skill-status ${j.validationStatus==="valid"?"":"invalid"}`,children:j.validationStatus==="valid"?"Ready":"Needs attention"}),e.jsx(sn,{size:16,"aria-hidden":"true"})]}),e.jsxs("span",{className:"github-extension-row-actions",children:[e.jsx("button",{"aria-label":`Update ${j.owner}/${j.repo}`,className:"settings-icon-button ghost",disabled:m!==null,title:"Update extension",type:"button",onClick:()=>{A(j)},children:w?e.jsx(de,{className:"settings-spin",size:14}):e.jsx(oe,{size:14})}),e.jsx("button",{"aria-label":`Remove ${j.owner}/${j.repo}`,className:"settings-icon-button ghost danger",disabled:m!==null,title:"Remove extension",type:"button",onClick:()=>{k(j)},children:y?e.jsx(de,{className:"settings-spin",size:14}):e.jsx(Ce,{size:14})})]})]},j.id)}):e.jsx("div",{className:"skills-settings-empty",children:"No third-party extensions installed."})]})}function ei({onOpenSkill:s,onOpenExtension:n,personalSkills:a,extensionCatalog:t,connection:i,onExtensionCatalog:l,onError:c,onToast:d}){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(Xa,{catalog:t,connection:i,onCatalog:l,onError:c,onOpenExtension:n,onToast:d}),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(Ue,{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"})]}),Zn.map(u=>{const p=Qn(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(Ue,{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:p}),e.jsx("span",{children:u.path})]}),e.jsx("span",{className:"native-skill-status",children:"Built in"}),e.jsx(sn,{size:16,"aria-hidden":"true"})]},u.name)})]})]})}const ds="default";function si({connection:s,embedded:n=!1,onError:a,onPreferences:t,preferences:i,providers:l}){const c=i.training,[d,u]=r.useState(Ze(c.defaultModelRef)),[p,o]=r.useState(c.creationMode),[g,m]=r.useState(c.autoApproveEvidence),[h,f]=r.useState(!1),N=r.useMemo(()=>Qs(l,{includeUnavailable:!0}),[l]),S=r.useMemo(()=>N.map(v=>({provider:v,models:Be(v.value,l)})).filter(v=>v.models.length>0),[N,l]),P=ni(d),C=Xn(i.defaultChatProvider,i.defaultChatModel,l)?` · ${ti(i.codexReasoningEffort)} reasoning`:"",I=ai(P,c.defaultModelRef??null)&&p===c.creationMode&&g===c.autoApproveEvidence;r.useEffect(()=>{u(Ze(c.defaultModelRef)),o(c.creationMode),m(c.autoApproveEvidence)},[i.defaultChatModel,i.defaultChatProvider,c.autoApproveEvidence,c.creationMode,c.defaultModelRef]);async function A(v){if(v.preventDefault(),!!s){f(!0),a(null);try{t(await E.savePreferences(s,{training:{defaultModelRef:P,creationMode:p,autoApproveEvidence:g}}))}catch(k){a(k instanceof Error?k.message:String(k))}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:v=>{A(v)},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:d,disabled:h,onChange:v=>u(v.target.value),children:[e.jsxs("option",{value:ds,children:["Use chat default — ",Te(i.defaultChatProvider,l)," · ",ns(i.defaultChatModel,l,i.defaultChatProvider),C]}),S.map(v=>e.jsx("optgroup",{label:v.provider.label,children:v.models.map(k=>e.jsx("option",{value:Ze({providerId:v.provider.value,modelId:k.value}),children:k.label},k.value))},v.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:p,disabled:h,onChange:v=>o(v.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:g,disabled:h,onChange:v=>m(v.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:h||I,children:e.jsx("span",{children:h?"Saving":"Save training settings"})})]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:"Authoring model"}),e.jsx("strong",{children:P?`${Te(P.providerId,l)} / ${ns(P.modelId,l,P.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 Ze(s){return s?JSON.stringify([s.providerId,s.modelId]):ds}function ni(s){if(s===ds)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 ti(s){return`${s.slice(0,1).toUpperCase()}${s.slice(1)}`}function ai(s,n){return s?.providerId===n?.providerId&&s?.modelId===n?.modelId}function ii({disabled:s,onChange:n,storageRoots:a,value:t}){const i=r.useId(),[l,c]=r.useState(!1),d=Gs(t),u=g=>g.datasetStorePath,p="Dataset",o=a.find(g=>Gs(u(g))===d)??null;return e.jsxs("div",{className:"model-storage-picker",children:[e.jsxs("label",{className:"model-storage-label",htmlFor:i,children:[p," storage"]}),e.jsxs("div",{className:"model-storage-control-row",children:[e.jsxs("select",{"aria-label":`${p} storage drive`,className:"model-storage-select",disabled:s,id:i,title:t??"No Dataset storage configured",value:t??"",onChange:g=>n(g.target.value||null),children:[e.jsx("option",{value:"",children:"Not configured"}),t&&!o?e.jsx("option",{value:t,children:"Manual location"}):null,a.map(g=>e.jsxs("option",{disabled:!g.mounted||!g.writable,title:u(g),value:u(g),children:[g.label," · ",ci(g.kind)," · ",di(g)]},g.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:()=>c(!0),children:e.jsx(fe,{size:15})})]}),l?li(e.jsx(ri,{initialPath:t??"",purpose:"dataset",onClose:()=>c(!1),onUse:g=>{n(g),c(!1)}})):null]})}function li(s){return typeof document>"u"?s:et.createPortal(s,document.body)}function ri({initialPath:s,onClose:n,onUse:a,purpose:t="model"}){const i=r.useId(),[l,c]=r.useState(s),d=oi(l);r.useEffect(()=>{const p=o=>{o.key==="Escape"&&n()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[n]);function u(p){p.preventDefault(),p.stopPropagation(),!d&&a(l.trim())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:p=>{p.target===p.currentTarget&&n()},children:e.jsxs("form",{className:"git-dialog model-storage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":i,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(ue,{size:15})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(ft,{size:18})}),e.jsxs("h2",{id:i,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:l,placeholder:t==="dataset"?"/mnt/OpenPond/datasets":"/mnt/models or /run/user/…/gvfs/…",onChange:p=>c(p.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."}),l.trim()&&d?e.jsx("div",{className:"profile-dialog-warning",children:d}):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:!!d,type:"submit",children:"Use location"})]})]})})}function oi(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 ci(s){return s==="network"?"Network":s==="removable"?"Removable":s==="cache"?"Cache":"Local"}function di(s){return s.mounted?s.writable?`${ui(s.freeBytes)} free`:"Read only":"Not mounted"}function Gs(s){const n=(s??"").trim().replace(/[\\/]+$/,"");return/^(?:[a-z]:[\\/]|\\\\)/i.test(n)?n.toLowerCase():n}function ui(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 hi({state:s,catalog:n,busy:a,catalogLoading:t,onRefresh:i,onSave:l}){const[c,d]=r.useState(s?.settings.datasetStorePath??null);r.useEffect(()=>{d(s?.settings.datasetStorePath??null)},[s?.settings.datasetStorePath]);const u=r.useMemo(()=>s?.storageRoots.find(m=>qs(m.datasetStorePath)===qs(c))??null,[c,s?.storageRoots]),p=c===(s?.settings.datasetStorePath??null),o=n?.datasets??[];async function g(m){m.preventDefault(),await l(c)}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:()=>{i()},title:"Refresh Dataset storage",type:"button",children:e.jsx(oe,{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??(c?"Manual location":"Not configured")}),e.jsx("small",{children:c??"Choose a writable local or mounted location before importing a Dataset."}),u?e.jsxs("small",{children:[fi(u.kind)," · ",u.freeBytes==null?"Free space unknown":`${gn(u.freeBytes)} free`]}):null]})})}),e.jsxs("form",{className:"provider-settings-form",onSubmit:m=>{g(m)},children:[e.jsx("div",{className:"account-list-heading",children:e.jsx("span",{children:"Location"})}),e.jsx(ii,{disabled:a!==null,onChange:d,storageRoots:s?.storageRoots??[],value:c}),e.jsx("button",{className:"settings-primary",disabled:a!==null||p,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(mi,{dataset:m},m.tasksetId)):e.jsx("div",{className:"empty-account-list",children:e.jsx("span",{children:t?"Loading registered Datasets":"No registered Datasets"})})]})]})}function mi({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:[fn(s.rowCount)," rows"," · ",pi(s)," · ",n," · ",s.sizeBytes==null?"Size unavailable":gn(s.sizeBytes)]}),!s.available&&s.unavailableReason?e.jsx("small",{className:"dataset-storage-error",children:s.unavailableReason}):null]}),e.jsx("span",{children:s.available?gi(s.status):"Unavailable"})]})}function pi(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])=>`${fn(Number(t))} ${a}`).join(" · ")||"No split rows"}function gn(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 fn(s){return new Intl.NumberFormat().format(s)}function qs(s){return s?.replace(/[\\/]+$/,"")??""}function gi(s){return s.replaceAll("_"," ").replace(/^./,n=>n.toUpperCase())}function fi(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 ke(s){return s?s.slice(0,10):"none"}function ye(s){const n=s.replaceAll("_"," ");return`${n.charAt(0).toUpperCase()}${n.slice(1)}`}function xi(s){return s==="unresolved"?"Watching":s==="confirmed"?"Ready for Refiner":ye(s)}function ji({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?ke(t.contentHash):"Not created"})]},a))})}function vi({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:xi(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:ke(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:ye(n.kind)}),e.jsx("code",{children:ke(n.evidence.contentHash)}),e.jsx("time",{children:Ee(n.occurredAt)})]},`${n.evidence.id}:${n.evidence.contentHash}`))})]}):null]})]})}function bi({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:ye(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:ye(a.nextAuthority)})]})]}),e.jsx(ji,{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 yi({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:ye(s.decision)}),e.jsxs("strong",{children:[s.model.provider,"/",s.model.model]}),e.jsxs("small",{children:[ye(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:ke(s.review.contentHash)})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Taskset"}),e.jsx("dd",{children:e.jsx("code",{children:ke(s.tasksetRelease?.contentHash)})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Baseline"}),e.jsx("dd",{children:e.jsx("code",{children:ke(s.baselineEvaluation?.contentHash)})})]})]})]})]})}function Ni({acceptingReviewId:s,candidates:n,onAcceptTasksetReview:a,qualifications:t,reviews:i,schedule:l}){const c=l.activityEnabled||l.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 ${c?"harness-status-advanced":""}`,children:c?"On":"Off"})}),e.jsx("td",{children:l.activityEnabled?`${l.activityBatchSize} new outcomes`:"Manual only"}),e.jsx("td",{children:Ee(l.lastRunAt)}),e.jsx("td",{children:l.lastResult?ye(l.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(d=>e.jsx(vi,{candidate:d},`${d.id}:${d.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:i.length})]}),e.jsx("div",{className:"harness-disclosure-list",children:i.length?i.map(d=>e.jsx(bi,{accepting:s===d.id,onAcceptTasksetReview:a,review:d},`${d.id}:${d.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(d=>e.jsx(yi,{receipt:d},`${d.id}:${d.contentHash}`))})]}):null]})}const wi="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 Ws(s){const n=new Date(s);return Number.isNaN(n.valueOf())?s:n.toLocaleString()}function Se(s){return s?s.slice(0,10):"none"}function Si({busyReleaseHash:s,history:n,onRequestRelease:a,onStartAuthoring:t}){const i=r.useMemo(()=>{const l=new Map;for(const c of n.transitions)l.has(c.nextRelease.contentHash)||l.set(c.nextRelease.contentHash,c);return l},[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(wi),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:Se(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:Se(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(l=>e.jsx("section",{className:"harness-edit",children:e.jsxs("div",{children:[e.jsx("strong",{children:l.id}),e.jsx("span",{children:l.text})]})},l.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(l=>{const c=l.contentHash===n.binding.release.contentHash,d=!c&&i.get(l.contentHash)?.bindingChanged===!1,u=d?"activate":"rollback";return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("strong",{children:l.profile.name}),e.jsxs("small",{children:[l.profile.id,"@",l.profile.version," · ",l.profile.instructions.length," instructions"]})]}),e.jsx("td",{children:e.jsx("code",{children:Se(l.contentHash)})}),e.jsx("td",{children:Ws(l.createdAt)}),e.jsx("td",{children:e.jsx("span",{className:"harness-status",children:c?"active":d?"draft":"immutable"})}),e.jsx("td",{children:c?null:e.jsx("button",{"aria-label":`${d?"Activate":"Roll back"} Refiner release`,className:"harness-table-icon-action",disabled:s!==null,onClick:()=>a(l,u),title:`${d?"Activate":"Roll back"} Refiner release`,type:"button",children:d?e.jsx(rs,{size:14}):e.jsx(_e,{size:14})})})]},l.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(l=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsxs("span",{className:"harness-status",children:[l.operation,l.bindingChanged?" · active":" · draft"]})}),e.jsxs("td",{children:[e.jsx("strong",{children:l.reason}),e.jsx("small",{children:l.authoringSkillHash?`Skill ${Se(l.authoringSkillHash)}`:l.actor})]}),e.jsx("td",{children:e.jsxs("code",{children:[Se(l.previousRelease?.contentHash)," → ",Se(l.nextRelease.contentHash)]})}),e.jsx("td",{children:l.validation.valid?"Passed":l.validation.messages.join("; ")}),e.jsx("td",{children:Ws(l.createdAt)})]},l.contentHash))})]})})]})]})}const ki={enabled:!1,activityEnabled:!1,activityBatchSize:10,cadence:"manual",maxEstimatedCostUsd:.1,nextRunAt:null,lastRunAt:null,lastResult:null,lastError:null,updatedAt:null},Ci={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 Pe(s){if(!s)return"Not yet";const n=new Date(s);return Number.isNaN(n.valueOf())?s:n.toLocaleString()}function Ae(s){return s?s.slice(0,10):"none"}function Vs(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 ${Ae(a.contentHash)}`}}function Ri({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:Pe(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(ue,{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(rs,{size:13})," Approve and release"]})]})]})}function Pi({change:s,onClose:n}){const a=s.proposal;return e.jsxs(xt,{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(ue,{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 Ai({history:s,reviewingProposalId:n,onReviewProposal:a}){const t=r.useMemo(()=>[...s.changes.map(i=>({id:`change:${i.receipt.id}`,at:i.receipt.createdAt,kind:"Refiner",title:i.proposal?.expectedOutcome??i.receipt.reason,detail:i.receipt.decision.replaceAll("_"," ")})),...s.routes.map(i=>({id:`route:${i.decision.id}`,at:i.decision.createdAt,kind:"Routed",title:i.decision.reason,detail:i.decision.route})),...s.evaluationReviews.map(i=>({id:`review:${i.id}`,at:i.createdAt,kind:"Continuous Review",title:i.claim?.statement??i.reason,detail:i.classification.replaceAll("_"," ")}))].sort((i,l)=>l.at.localeCompare(i.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(i=>e.jsx(Ri,{busy:n!==null,onReview:a,review:i},`${i.proposal.id}:${i.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(i=>e.jsxs("article",{children:[e.jsx("span",{children:i.kind}),e.jsxs("div",{children:[e.jsx("strong",{children:i.title}),e.jsx("small",{children:i.detail})]}),e.jsx("time",{children:Pe(i.at)})]},i.id))}):e.jsx("div",{className:"harness-empty compact",children:"No Harness learning activity yet."})]})]})}function Ii({history:s,refiner:n,busyReleaseHash:a,onRequestRefinerRelease:t,onStartRefinerAuthoring:i,onOpenChangeDiff:l,onOpenSourceSession:c}){const[d,u]=r.useState(null);return e.jsxs("div",{className:"harness-page-sections",children:[e.jsx(Si,{busyReleaseHash:a,history:n,onRequestRelease:t,onStartAuthoring:i}),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(p=>{const o=p.trigger?.runRef??null,g=p.proposal;return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:g?.expectedOutcome??p.receipt.reason})}),e.jsx("td",{children:e.jsx("code",{children:g?.edits[0]?.target??g?.route??"workspace"})}),e.jsx("td",{children:e.jsx("code",{children:Ae(p.receipt.nextRelease?.contentHash)})}),e.jsx("td",{children:Pe(p.receipt.createdAt)}),e.jsx("td",{children:e.jsx("span",{className:`harness-status harness-status-${p.receipt.decision}`,children:p.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(p),title:"View evidence and exact edits",type:"button",children:e.jsx(Nt,{size:14})}),p.receipt.nextRelease?e.jsx("button",{"aria-label":"View release diff",className:"harness-table-icon-action",onClick:()=>l(p),title:"View release diff",type:"button",children:e.jsx(rn,{size:14})}):null,o&&c?e.jsx("button",{"aria-label":"Open source conversation",className:"harness-table-icon-action",onClick:()=>c(o),title:"Open source conversation",type:"button",children:e.jsx(en,{size:14})}):null]})})]},`${p.receipt.id}:${p.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(p=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("p",{children:p.decision.reason})}),e.jsx("td",{children:e.jsx("p",{children:p.trigger?.reason??"Completed work"})}),e.jsx("td",{children:Pe(p.decision.createdAt)}),e.jsx("td",{children:e.jsx("span",{className:"harness-status",children:p.decision.route})})]},`${p.decision.id}:${p.decision.contentHash}`))})]})}):e.jsx("div",{className:"harness-empty compact",children:"No recommendations have been routed."})]}),d?e.jsx(Pi,{change:d,onClose:()=>u(null)}):null]})}function Di(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 $i(s){return s<1024?`${s} B`:`${(s/1024).toFixed(s<10240?1:0)} KB`}function Ei({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:Di(t.path)})}),e.jsx("td",{children:e.jsx("code",{children:t.path})}),e.jsx("td",{children:$i(t.sizeBytes)}),e.jsx("td",{children:e.jsx("code",{children:Ae(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:Pe(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 Mi({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((i,l)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsxs("div",{className:"harness-release-identity",children:[e.jsx("strong",{children:i.id}),e.jsx("code",{children:Ae(i.contentHash)})]})}),e.jsxs("td",{children:[i.files.length," files"]}),e.jsx("td",{children:Pe(i.createdAt)}),e.jsx("td",{children:i.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[l+1]??null,i),title:"View release changes",type:"button",children:e.jsx(rn,{size:14})}),i.current?null:e.jsx("button",{"aria-label":"Roll back to release",className:"harness-table-icon-action",disabled:s,onClick:()=>t(i),title:"Roll back to release",type:"button",children:e.jsx(_e,{size:14})})]})})]},`${i.id}:${i.contentHash}`))})]})}):e.jsx("div",{className:"harness-empty compact",children:"No Harness releases exist yet."})]})}function Li({connection:s,enabled:n,onAcceptEvaluationReview:a,onError:t,onDefaultReleaseDiff:i,onOpenReleaseDiff:l,onOpenSourceSession:c,onStartRefinerAuthoring:d,onToast:u,page:p}){const[o,g]=r.useState(null),[m,h]=r.useState(null),[f,N]=r.useState(null),[S,P]=r.useState(!1),[C,I]=r.useState(null),[A,v]=r.useState(null),[k,L]=r.useState(!1),[R,j]=r.useState(!1),[w,y]=r.useState(null),{confirmAction:x,confirmDialog:U,resolveConfirmDialog:F}=Js(),q=!!(o?.evaluationReviewSchedule.activityEnabled||o?.evaluationReviewSchedule.enabled),[K,X]=r.useState(!1),[T,ee]=r.useState(!1);r.useEffect(()=>{o&&X(o.backgroundReview.enabled)},[o?.backgroundReview.enabled]),r.useEffect(()=>{ee(q)},[q]);const Z=r.useCallback(async()=>{if(s){P(!0);try{const[O,D]=await Promise.all([E.harnessHistory(s),E.refinerHistory(s)]);g(O),h(D);const z=O.releases.findIndex(se=>se.current),B=z>=0?O.releases[z]:null;O.workspace&&B&&i(Vs(O.workspace.id,O.releases[z+1]??null,B)),t(null)}catch(O){t(O instanceof Error?O.message:String(O))}finally{P(!1)}}},[s,i,t]);r.useEffect(()=>{n&&Z()},[n,p,Z]);const H=r.useCallback(async O=>{if(!(!s||!o?.workspace)){j(!0);try{const D=await E.reviewHarnessEvaluation(s,{workspaceId:o.workspace.id,maxEstimatedCostUsd:O});g(D.history),t(null),u?.(`Continuous Review completed: ${D.receipt.classification.replaceAll("_"," ")}.`,"success")}catch(D){t(D instanceof Error?D.message:String(D))}finally{j(!1)}}},[s,o,t,u]),V=r.useCallback(async(O,D,z)=>{if(!(!s||!o?.workspace)){L(!0);try{let B=o;O==="refiner"&&D!==o.backgroundReview.enabled&&(B=(await E.updateHarnessBackgroundReview(s,{workspaceId:o.workspace.id,enabled:D})).history);const se=o.evaluationReviewSchedule.activityEnabled||o.evaluationReviewSchedule.enabled;if(O==="continuous-review"&&(z!==se||o.evaluationReviewSchedule.enabled)){const Q=o.evaluationReviewSchedule;B=(await E.updateHarnessEvaluationReviewSchedule(s,{workspaceId:o.workspace.id,enabled:!1,activityEnabled:z,activityBatchSize:Q.activityBatchSize,cadence:"manual",maxEstimatedCostUsd:Q.maxEstimatedCostUsd})).history}g(B),t(null),u?.(`${O==="refiner"?"Refiner":"Continuous Review"} settings applied.`,"success")}catch(B){t(B instanceof Error?B.message:String(B))}finally{L(!1)}}},[s,o,t,u]),te=r.useCallback(async O=>{if(o?.workspace){y(O.id);try{await a(o.workspace.id,{id:O.id,contentHash:O.contentHash})&&(t(null),u?.("Taskset review opened in Models.","success"))}catch(D){t(D instanceof Error?D.message:String(D))}finally{y(null)}}},[o?.workspace,a,t,u]),W=r.useCallback((O,D)=>{o?.workspace&&l(Vs(o.workspace.id,O,D))},[o?.workspace,l]),G=r.useCallback(O=>{!o?.workspace||!O.receipt.nextRelease||l({workspaceId:o.workspace.id,baseRelease:O.receipt.previousRelease,targetRelease:O.receipt.nextRelease,title:O.proposal?.expectedOutcome??O.receipt.reason})},[o?.workspace,l]),ne=r.useCallback(async O=>{if(!(!s||!o?.workspace)){I(O.contentHash);try{const D=await E.rollbackHarness(s,{workspaceId:o.workspace.id,targetRelease:{id:O.id,contentHash:O.contentHash}});g(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{I(null)}}},[s,o?.workspace,t,u]),ae=r.useCallback(async O=>{await x({title:"Roll back Harness release?",body:`New work will use ${Ae(O.contentHash)}. Active runs remain pinned to their current release.`,confirmLabel:"Roll back"})&&await ne(O)},[x,ne]),ie=r.useCallback(async(O,D)=>{if(!(!s||!await x({title:D==="activate"?"Activate Refiner release?":"Roll back Refiner release?",body:`Future reviews will use ${O.profile.name} at ${Ae(O.contentHash)}. Existing work remains pinned.`,confirmLabel:D==="activate"?"Activate":"Roll back"}))){N(O.contentHash);try{const B={release:{id:O.id,contentHash:O.contentHash},reason:`${D==="activate"?"Activate":"Rollback"} from Settings to ${O.profile.id}@${O.profile.version}.`,actor:"settings-user"};h(await(D==="activate"?E.activateRefinerRelease(s,B):E.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{N(null)}}},[x,s,t,u]),le=r.useCallback(async(O,D)=>{if(!(!s||!o?.workspace)){v(O.proposal.id);try{const z=await E.reviewHarnessProposal(s,{workspaceId:o.workspace.id,proposal:{id:O.proposal.id,contentHash:O.proposal.contentHash},decision:D});g(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{v(null)}}},[s,o?.workspace,t,u]),b=o?.releases.find(O=>O.current)??o?.releases[0]??null,$=b?o?.releases.indexOf(b)??-1:-1,_=Ci[p],he=o?p==="refiner"?K!==o.backgroundReview.enabled:T!==q||o.evaluationReviewSchedule.enabled:!1,ce=p==="refiner"||p==="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:_.title}),e.jsx("p",{children:_.description})]}),o?.workspace&&ce?e.jsxs("div",{className:"harness-page-header-actions",children:[p==="continuous-review"?e.jsx("button",{className:"settings-secondary compact",disabled:R,onClick:()=>{H(o.evaluationReviewSchedule.maxEstimatedCostUsd)},type:"button",children:R?"Reviewing…":"Review now"}):null,e.jsxs("label",{className:"harness-page-toggle",children:[e.jsx("span",{children:p==="refiner"?K?"On":"Off":T?"On":"Off"}),e.jsxs("span",{className:"provider-toggle",children:[e.jsx("input",{"aria-label":p==="refiner"?"Enable Refiner":"Enable Continuous Review",checked:p==="refiner"?K:T,disabled:k,onChange:O=>p==="refiner"?X(O.target.checked):ee(O.target.checked),type:"checkbox"}),e.jsx("span",{"aria-hidden":"true"})]})]}),e.jsx("button",{className:"settings-primary compact",disabled:k||!he,onClick:()=>{V(p,K,T)},type:"button",children:k?"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&&p==="overview"?e.jsx(Ai,{history:o,onReviewProposal:le,reviewingProposalId:A}):null,o&&m&&p==="refiner"?e.jsx(Ii,{busyReleaseHash:f,history:o,refiner:m,onOpenChangeDiff:G,onOpenSourceSession:c,onRequestRefinerRelease:(O,D)=>{ie(O,D)},onStartRefinerAuthoring:d}):null,o?.workspace&&p==="continuous-review"?e.jsx(Ni,{acceptingReviewId:w,candidates:o.refinementCandidates,onAcceptTasksetReview:O=>{te(O)},qualifications:o.modelImprovementQualifications,reviews:o.evaluationReviews,schedule:o.evaluationReviewSchedule??ki}):null,o?.workspace&&p==="contents"?e.jsx(Ei,{history:o,onOpenCurrentRelease:()=>{b&&W($>=0?o.releases[$+1]??null:null,b)}}):null,o?.workspace&&p==="releases"?e.jsx(Mi,{busy:C!==null,history:o,onOpenDiff:W,onRequestRollback:O=>{ae(O)}}):null,e.jsx(Ys,{onResolve:F,state:U})]})}function Ks(s){return s?s.slice(0,10):"initial"}function Oi({connection:s,expanded:n,onResizeStart:a,onToggleExpanded:t,selection:i}){const[l,c]=r.useState(null),[d,u]=r.useState(null),[p,o]=r.useState(!0),g=r.useCallback(async()=>{u(null),o(!0);try{c(await E.harnessReleaseDiff(s,i))}catch(f){c(null),u(f instanceof Error?f.message:String(f))}finally{o(!1)}},[s,i]);r.useEffect(()=>{g()},[g]);const m=r.useMemo(()=>l?{appId:`harness:${i.workspaceId}`,repoPath:i.title,initialized:!0,dirty:l.filesChanged>0,filesChanged:l.filesChanged,additions:l.additions,deletions:l.deletions,repoFiles:l.files.map(f=>f.path),files:l.files,error:null,updatedAt:""}:null,[l,i.title,i.workspaceId]),h=`${i.title} · ${Ks(i.baseRelease?.contentHash)} → ${Ks(i.targetRelease.contentHash)}`;return e.jsx(jt,{appId:`harness:${i.workspaceId}`,workspaceId:`harness:${i.targetRelease.contentHash}`,workspaceKind:"local_project",connection:s,diff:m,editorPreferences:null,expanded:n,filesWithPreview:!0,loading:p,onOpenBrowserUrl:()=>{},onRefresh:g,onResizeStart:a,onToggleExpanded:t,readOnly:!0,workspaceError:d,workspaceInitialized:!0,workspaceName:h})}function Ti({connection:s,onError:n,onPayload:a}){const[t,i]=r.useState(!1),[l,c]=r.useState(!1);async function d(g,m){if(s){i(!0),n(null);try{const h=await E.switchOpenPondAccount(s,{handle:g,baseUrl:m??null}),f=await E.savePreferences(s,{defaultTeamId:null});a({...h,preferences:f.preferences})}catch(h){n(h instanceof Error?h.message:String(h))}finally{i(!1)}}}async function u(g,m,h=!1){if(!s)return!1;i(!0),n(null);try{const f=await E.removeOpenPondAccount(s,{handle:g,baseUrl:m??null});if(a(f),h)try{const N=await E.savePreferences(s,{defaultTeamId:null});a({...f,preferences:N.preferences})}catch(N){n(N instanceof Error?N.message:String(N))}return!0}catch(f){return n(f instanceof Error?f.message:String(f)),!1}finally{i(!1)}}async function p(g){if(!(!s||!g.apiKey.trim())){i(!0),n(null);try{const m=g.handle?.trim(),h=g.environment?.trim(),f=await E.saveOpenPondAccount(s,{apiKey:g.apiKey.trim(),handle:m||void 0,baseUrl:g.baseUrl,apiBaseUrl:g.apiBaseUrl,environment:h||"custom",setActive:!0}),N=await E.savePreferences(s,{defaultTeamId:null});a({...f,preferences:N.preferences})}catch(m){throw n(m instanceof Error?m.message:String(m)),m}finally{i(!1)}}}async function o(){if(s){c(!0),n(null);try{a(await E.refreshOpenPondAccounts(s))}catch(g){n(g instanceof Error?g.message:String(g))}finally{c(!1)}}}return{refreshingAccounts:l,saving:t,refreshAccounts:o,removeAccount:u,saveAccount:p,switchAccount:d}}function Ui({connection:s,onError:n,onPreferences:a,preferences:t,providers:i}){const[l,c]=r.useState(t.defaultBranchPrefix),[d,u]=r.useState(t.defaultNewProjectDirectory),[p,o]=r.useState(t.advancedWorkspaceControls),[g,m]=r.useState(t.steerActiveResponses),[h,f]=r.useState(t.contextCompaction.autoEnabled),[N,S]=r.useState(t.subagents.enabled),[P,C]=r.useState(t.subagents.delegationMode),[I,A]=r.useState(!t.subagents.defaultModelRef),[v,k]=r.useState(t.subagents.defaultModelRef?.providerId??t.defaultChatProvider),[L,R]=r.useState(t.subagents.defaultModelRef?.modelId??t.defaultChatModel),[j,w]=r.useState(t.subagents.roles),[y,x]=r.useState(t.subagents.maxConcurrentRuns),[U,F]=r.useState(t.subagents.maxConcurrentRunsPerProvider),[q,K]=r.useState(t.subagents.maxConcurrentRunsPerWorkspaceTarget),[X,T]=r.useState(!1),ee=I?null:{providerId:v,modelId:L.trim()},Z=N!==t.subagents.enabled||P!==t.subagents.delegationMode||!zi(ee,t.subagents.defaultModelRef)||y!==t.subagents.maxConcurrentRuns||U!==t.subagents.maxConcurrentRunsPerProvider||q!==t.subagents.maxConcurrentRunsPerWorkspaceTarget||JSON.stringify(j)!==JSON.stringify(t.subagents.roles);r.useEffect(()=>{c(t.defaultBranchPrefix),u(t.defaultNewProjectDirectory),o(t.advancedWorkspaceControls),m(t.steerActiveResponses),f(t.contextCompaction.autoEnabled),S(t.subagents.enabled),C(t.subagents.delegationMode),A(!t.subagents.defaultModelRef),k(t.subagents.defaultModelRef?.providerId??t.defaultChatProvider),R(t.subagents.defaultModelRef?.modelId??t.defaultChatModel),w(t.subagents.roles),x(t.subagents.maxConcurrentRuns),F(t.subagents.maxConcurrentRunsPerProvider),K(t.subagents.maxConcurrentRunsPerWorkspaceTarget)},[t.defaultChatProvider,t.defaultChatModel,t.defaultBranchPrefix,t.defaultNewProjectDirectory,t.advancedWorkspaceControls,t.steerActiveResponses,t.contextCompaction.autoEnabled,t.subagents]);function H(D){k(D),R(z=>ts(D,z,i))}function V(){return I?t.defaultChatProvider:v}function te(){return I?t.defaultChatModel:L}function W(D,z){w(B=>B.map(se=>se.id===D?z(se):se))}function G(D,z){W(D,B=>({...B,enabled:z}))}function ne(D,z){W(D,B=>({...B,background:z}))}function ae(D,z){W(D,B=>{if(z)return{...B,modelRef:null};const se=B.modelRef?.providerId??V(),Q=B.modelRef?.modelId??te();return{...B,modelRef:We(se,Q,i)??null}})}function ie(D,z){W(D,B=>({...B,modelRef:We(z,B.modelRef?.modelId??te(),i)??null}))}function le(D,z){W(D,B=>{const se=B.modelRef?.providerId??V(),Q=z.trim();return{...B,modelRef:Q?{providerId:se,modelId:Q}:null}})}function b(D,z){W(D,B=>({...B,isolationMode:z}))}function $(D,z){W(D,B=>({...B,toolPolicy:z}))}function _(D,z){W(D,B=>({...B,peerMessages:z}))}function he(D,z){W(D,B=>({...B,maxConcurrentRuns:be(z,1,16)}))}async function ce(){let D=null;if(window.openpond?.selectFolder){const z=await window.openpond.selectFolder();if(z.canceled)return;D=z.path}else D=window.prompt("Default new project directory",d);D?.trim()&&u(D.trim())}async function O(D){if(D.preventDefault(),!!s){T(!0),n(null);try{a(await E.savePreferences(s,{defaultBranchPrefix:Qe(l),defaultNewProjectDirectory:d.trim(),advancedWorkspaceControls:p,steerActiveResponses:g,contextCompaction:{...t.contextCompaction,autoEnabled:h},subagents:{enabled:N,workspaceDefaultsVersion:t.subagents.workspaceDefaultsVersion,toolDefaultsVersion:t.subagents.toolDefaultsVersion,delegationMode:P,defaultModelRef:I?null:We(v,L,i)??null,roles:j,maxConcurrentRuns:be(y,1,32),maxConcurrentRunsPerProvider:U===null?null:be(U,1,32),maxConcurrentRunsPerWorkspaceTarget:q===null?null:be(q,1,32)}}))}catch(z){n(z instanceof Error?z.message:String(z))}finally{T(!1)}}}return{advancedWorkspaceControls:p,steerActiveResponses:g,contextCompactionAutoEnabled:h,defaultBranchPrefix:l,defaultNewProjectDirectory:d,subagentsEnabled:N,subagentDelegationMode:P,subagentsUseDefaultModel:I,subagentsProvider:v,subagentsModel:L,subagentRoles:j,subagentsMaxConcurrentRuns:y,subagentsMaxConcurrentRunsPerProvider:U,subagentsMaxConcurrentRunsPerWorkspaceTarget:q,subagentsDirty:Z,saving:X,chooseDefaultProjectDirectory:ce,saveDefaults:O,changeSubagentsProvider:H,changeSubagentRoleProvider:ie,setAdvancedWorkspaceControls:o,setSteerActiveResponses:m,setContextCompactionAutoEnabled:f,setDefaultBranchPrefix:c,setDefaultNewProjectDirectory:u,setSubagentsUseDefaultModel:A,setSubagentsModel:R,setSubagentsEnabled:S,setSubagentDelegationMode:D=>C(D),setSubagentsMaxConcurrentRuns:D=>x(be(D,1,32)),setSubagentsMaxConcurrentRunsPerProvider:D=>F(D===null?null:be(D,1,32)),setSubagentsMaxConcurrentRunsPerWorkspaceTarget:D=>K(D===null?null:be(D,1,32)),setSubagentRoleBackground:ne,setSubagentRoleEnabled:G,setSubagentRoleIsolationMode:b,setSubagentRoleMaxConcurrentRuns:he,setSubagentRoleModel:le,setSubagentRolePeerMessages:_,setSubagentRoleToolPolicy:$,setSubagentRoleUseDefaultModel:ae}}function be(s,n,a){return Number.isFinite(s)?Math.min(a,Math.max(n,Math.trunc(s))):n}function zi(s,n){return(s?.providerId??null)===(n?.providerId??null)&&(s?.modelId??null)===(n?.modelId??null)}const Bi=15e3,Hi=100,_i=100,Fi=2500;function Gi({onError:s,section:n}){const[a,t]=r.useState(null),[i,l]=r.useState(null),[c,d]=r.useState(Hi),[u,p]=r.useState([]),[o,g]=r.useState(null),[m,h]=r.useState(!0),f=r.useRef(null),[N,S]=r.useState(null),P=!!(window.openpond?.openLogsFolder||window.openpond?.readRecentLogs||window.openpond?.copyRecentLogs||window.openpond?.exportDiagnostics),I=!!window.openpond?.readRecentLogs?`${u.length} of ${c} line${c===1?"":"s"}${m?" tailing":""}`:"Unavailable";r.useEffect(()=>{n==="diagnostics"&&A(c,"refresh",{quiet:!0})},[n]),r.useEffect(()=>{if(n!=="diagnostics"||!m||!window.openpond?.readRecentLogs)return;let w=!1;const y=window.setInterval(()=>{w||(w=!0,A(c,"refresh",{quiet:!0}).finally(()=>{w=!1}))},Fi);return()=>window.clearInterval(y)},[n,m,c]),r.useEffect(()=>{if(n!=="diagnostics"||!m)return;const w=f.current;w&&(w.scrollTop=w.scrollHeight)},[n,m,u]);async function A(w=c,y="refresh",x={}){const U=window.openpond?.readRecentLogs;if(!U){const F="Log view is not available in this runtime.";x.quiet||(S({label:"Logs",value:F,warning:!0}),s(F));return}x.quiet||l(y);try{const F=await Le(U(w),"Read logs");if(!F.ok)throw new Error(F.error);d(F.lineLimit),g(F.logDir),p(F.lines),x.quiet?S(q=>q?.label==="Logs"?null:q):S(null)}catch(F){const q=F instanceof Error?F.message:String(F);S({label:"Logs",value:q,warning:!0}),x.quiet||s(q)}finally{x.quiet||l(null)}}function v(){h(!1),A(c+_i,"older")}function k(){const w=!m;h(w),w&&A(c,"refresh",{quiet:!0})}async function L(){const w=window.openpond?.openLogsFolder;if(!w){const y="Desktop logs are not available in this runtime.";S({label:"Logs",value:y,warning:!0}),s(y);return}t("logs"),s(null);try{const y=await Le(w(),"Open logs");if(!y.ok)throw new Error(y.error??"Could not open the logs folder.");S(null)}catch(y){const x=y instanceof Error?y.message:String(y);S({label:"Logs",value:x,warning:!0}),s(x)}finally{t(null)}}async function R(){const w=window.openpond?.copyRecentLogs;if(!w){const y="Recent log copy is not available in this runtime.";S({label:"Copy",value:y,warning:!0}),s(y);return}t("copy"),s(null);try{const y=await Le(w(1e3),"Copy recent logs");if(!y.ok)throw new Error(y.error??"Could not copy recent logs.");S({label:"Copy",value:y.lines?`Copied ${y.lines} recent log lines.`:"Copied recent logs."})}catch(y){const x=y instanceof Error?y.message:String(y);S({label:"Copy",value:x,warning:!0}),s(x)}finally{t(null)}}async function j(){const w=window.openpond?.exportDiagnostics;if(!w){const y="Diagnostics export is not available in this runtime.";S({label:"Export",value:y,warning:!0}),s(y);return}t("export"),s(null);try{const y=await Le(w(),"Export diagnostics");if(!y.ok)throw new Error(y.error??"Could not export diagnostics.");S({label:"Export",value:y.path?`Saved to ${y.path}`:"Diagnostics exported."})}catch(y){const x=y instanceof Error?y.message:String(y);S({label:"Export",value:x,warning:!0}),s(x)}finally{t(null)}}return{diagnosticsAvailable:P,diagnosticsBusy:a,diagnosticsStatus:N,logDir:o,logLineLimit:c,logLines:u,logViewBusy:i,logViewSummary:I,logViewportRef:f,tailLogs:m,copyRecentLogs:R,exportDiagnosticsBundle:j,loadOlderLogs:v,openLogsFolder:L,refreshLogView:A,toggleTailLogs:k}}async function Le(s,n){let a;try{return await Promise.race([s,new Promise((t,i)=>{a=window.setTimeout(()=>{i(new Error(`${n} did not receive a desktop response.`))},Bi)})])}finally{a!==void 0&&window.clearTimeout(a)}}function qi({connection:s,enabled:n,onError:a,onPreferences:t,onToast:i,preferences:l}){const[c,d]=r.useState(l.editor),[u,p]=r.useState(null),[o,g]=r.useState(!1),[m,h]=r.useState(!1),[f,N]=r.useState(!1);r.useEffect(()=>{d(l.editor)},[l.editor]);const S=r.useCallback(async()=>{if(s){h(!0);try{p(await E.workspaceLspSettingsStatus(s))}catch(v){a(v instanceof Error?v.message:String(v))}finally{h(!1)}}},[s,a]);r.useEffect(()=>{!n||!s||S()},[s,n,S]);function P(v,k){d(L=>({...L,languages:{...L.languages,[v]:{...L.languages[v],mode:k}}}))}function C(v,k){d(L=>({...L,languages:{...L.languages,[v]:{...L.languages[v],customCommand:k}}}))}async function I(v){if(v.preventDefault(),!!s){g(!0),a(null);try{const k=await E.savePreferences(s,{editor:c});t(k),p(await E.workspaceLspSettingsStatus(s))}catch(k){a(k instanceof Error?k.message:String(k))}finally{g(!1)}}}async function A(){if(s){N(!0),a(null);try{await E.restartWorkspaceLsp(s),p(await E.workspaceLspSettingsStatus(s)),i?.("Language servers restarted.","success")}catch(v){a(v instanceof Error?v.message:String(v))}finally{N(!1)}}}return{editorPreferences:c,lspStatus:u,restarting:f,saving:o,statusLoading:m,refreshLspStatus:S,restartLanguageServers:A,saveEditorSettings:I,setEditorPreferences:d,setLanguageCustomCommand:C,setLanguageMode:P}}function Wi({connection:s,onError:n,onPayload:a,personalization:t}){const i=r.useMemo(()=>t.templates.map(j=>({value:j.id,label:j.name,description:j.id===t.activeTemplateId?"Selected":j.source==="built_in"?j.description:void 0})),[t.activeTemplateId,t.templates]),[l,c]=r.useState(t.activeTemplateId),[d,u]=r.useState(t.soul),[p,o]=r.useState(""),[g,m]=r.useState(!1),[h,f]=r.useState(!1),N=t.templates.find(j=>j.id===l)??t.templates[0],S=N?.source==="custom",P=N?d!==N.content:!0,C=l!==t.activeTemplateId||d!==t.soul||P,I=!!(S&&d.trim()&&N&&C);r.useEffect(()=>{c(t.activeTemplateId),u(t.soul);const j=t.templates.find(w=>w.id===t.activeTemplateId);o(j?`${j.name} Copy`:""),m(!1)},[t.activeTemplateId,t.soul,t.templates]);async function A(j=!1){if(!j&&!S)return;const w=j?p:N?.name;if(!(!s||!d.trim()||!w?.trim())){f(!0),n(null);try{a(await E.savePersonalization(s,{activeTemplateId:l,templateName:w,soul:d,saveAsNew:j})),m(!1)}catch(y){n(y instanceof Error?y.message:String(y))}finally{f(!1)}}}async function v(j){const w=t.templates.find(y=>y.id===j);if(w&&(c(w.id),o(`${w.name} Copy`),u(w.content),m(!1),!!s)){f(!0),n(null);try{a(await E.savePersonalization(s,{activeTemplateId:w.id,templateName:w.name,soul:w.content,saveAsNew:!1}))}catch(y){n(y instanceof Error?y.message:String(y))}finally{f(!1)}}}function k(){N&&(o(`${N.name} Copy`),u(N.content),m(!1))}function L(j){u(j),N&&!S&&j!==N.content&&m(!0)}function R(){N&&(o(`${N.name} Copy`),m(!0))}return{canSaveCurrentTemplate:I,personalizationTemplateId:l,personalizationTemplateOptions:i,saveAsNewOpen:g,saving:h,selectedPersonalizationTemplate:N,selectedTemplateIsCustom:S,soulDraft:d,templateNameDraft:p,changePersonalizationTemplate:v,changeSoulDraft:L,openSaveAsNew:R,resetPersonalizationDraft:k,savePersonalization:A,setSaveAsNewOpen:m,setTemplateNameDraft:o}}function Vi({connection:s,onError:n,onPreferences:a,onProviders:t,preferences:i,providers:l}){const[c,d]=r.useState(i.defaultChatProvider),[u,p]=r.useState(i.defaultChatModel),[o,g]=r.useState(!1),[m,h]=r.useState(null),[f,N]=r.useState(null);r.useEffect(()=>{d(i.defaultChatProvider),p(i.defaultChatModel)},[i.defaultChatProvider,i.defaultChatModel]);async function S(y){if(y.preventDefault(),!!s){g(!0),n(null);try{a(await E.savePreferences(s,{defaultChatProvider:c,defaultChatModel:ts(c,u,l)}))}catch(x){n(x instanceof Error?x.message:String(x))}finally{g(!1)}}}function P(y){d(y),p(x=>ts(y,x,l))}async function C(y,x,U){if(!s)return null;h(`${y}:${x}`),N(null),n(null);try{return await U()}catch(F){return n(F instanceof Error?F.message:String(F)),null}finally{h(null)}}async function I(y,x){await C(y,"config",async()=>{const U=await E.saveProviderSettings(s,{providers:{[y]:x}});return t(U),U})}async function A(y,x){await C(y,"credential",async()=>{const U=await E.saveProviderCredential(s,y,x);return t(U),U})}async function v(y){await C(y,"credential",async()=>{const x=await E.deleteProviderCredential(s,y,{});return t(x),x})}async function k(y){return C("openai","credential",async()=>{const x=await E.startOpenAiSubscriptionAuth(s,{method:y});return x.method==="browser"?(window.open(x.url,"_blank","noopener,noreferrer"),N("OpenAI ChatGPT login opened in your browser. Return here after authorization.")):(window.open(x.url,"_blank","noopener,noreferrer"),N(`OpenAI device login started. Enter code ${x.userCode}.`)),L(x.expiresAt),x})}async function L(y){if(s)for(;Date.now()<y;){await new Promise(x=>setTimeout(x,2500));try{const x=await E.providerSettings(s);t(x);const U=x.statuses.openai?.credential;if(U?.connected&&U.source==="chatgpt_subscription"){N("OpenAI ChatGPT subscription connected.");return}}catch{}}}async function R(y){await C(y,"models",async()=>{const x=await E.refreshProviderModels(s,y,{force:!0});return t(x.providers),x})}async function j(y){await C(y,"models",async()=>{const x=await E.loadProviderModels(s,y,{limit:500});return t(x.providers),x})}async function w(y,x={}){await C(y,"validate",async()=>{const U=await E.validateProviderCredential(s,y,x);return N(U.ok?`${y} validated${U.modelId?` with ${U.modelId}`:""}.`:U.errors.join(`
|
|
9
|
-
`)||`${y} validation failed.`),t(U.providers),U})}return{defaultModel:u,defaultProvider:c,providerBusy:m,saving:o,validationMessage:f,changeDefaultProvider:P,deleteProviderCredential:v,loadProviderModels:j,refreshProviderModels:R,saveProviderConfig:I,saveProviderCredential:A,saveProviders:S,setDefaultModel:p,startOpenAiSubscriptionAuth:k,validateProvider:w}}function Ki({connection:s,enabled:n,onError:a,onToast:t}){const[i,l]=r.useState(null),[c,d]=r.useState(null),[u,p]=r.useState(!1),o=r.useRef(null),g=r.useCallback(async(k={})=>{if(s){k.quiet||d("refresh");try{const L=await E.remoteAccess(s);l(L),a(null)}catch(L){a(L instanceof Error?L.message:String(L))}finally{k.quiet||d(null)}}},[s,a]);r.useEffect(()=>{!n||!s||g({quiet:!0})},[s,n,g]),r.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);function m(){o.current!==null&&window.clearTimeout(o.current),p(!1),window.setTimeout(()=>{p(!0),o.current=window.setTimeout(()=>{p(!1),o.current=null},1500)},0)}async function h(){if(a(null),!!s)try{l(await E.remoteAccess(s))}catch{}}async function f(){if(!s)return null;i&&!i.tailscale.running&&m(),d("enable");try{const k=await E.enableRemoteAccess(s);return l(k.status),a(null),k.status.tailscale.running?!k.status.serve.enabled&&k.status.serve.error&&t?.(k.status.serve.setupUrl?"Tailscale Serve needs to be enabled for this tailnet. Copy the Enable Serve link.":k.message||k.status.serve.error,"error"):(m(),t?.(k.message||"Tailscale is not running. Run Tailscale up first.","error")),k.status}catch{return await h(),m(),t?.("Unable to turn on remote access. Run Tailscale up first.","error"),null}finally{d(null)}}async function N(){if(s&&window.confirm("Turn off remote access? This runs tailscale serve reset and clears Tailscale Serve config on this device.")){d("disable");try{const k=await E.disableRemoteAccess(s);l(k.status),a(null)}catch{await h()}finally{d(null)}}}async function S(){i?.remoteWebUrl&&(d("copy-link"),await Ne(i.remoteWebUrl),d(null))}async function P(){i?.serveCommand&&(d("copy-command"),await Ne(i.serveCommand),d(null))}async function C(){i?.serve.setupUrl&&(d("copy-serve-setup"),await Ne(i.serve.setupUrl),d(null))}async function I(){i?.tailscaleUpCommand&&(d("copy-up-command"),await Ne(i.tailscaleUpCommand),d(null))}async function A(){i?.operatorCommand&&(d("copy-operator"),await Ne(i.operatorCommand),d(null))}async function v(){if(!i?.serve.enabled){const k=await f();k?.serve.enabled&&k.remoteWebUrl&&await Ne(k.remoteWebUrl);return}await S()}return{status:i,busy:c,flashTailscaleUp:u,refresh:g,enableRemoteAccess:f,disableRemoteAccess:N,copyRemoteLink:S,copyTailscaleUpCommand:I,copyServeCommand:P,copyServeSetupUrl:C,copyOperatorCommand:A,createRemoteLink:v}}function Ji(s){const[n,a]=r.useState(null),[t,i]=r.useState(null),l=r.useCallback(async()=>{if(s.connection){i("load");try{a(await E.datasetStorageState(s.connection)),s.onError(null)}catch(d){s.onError(d instanceof Error?d.message:String(d))}finally{i(null)}}},[s.connection,s.onError]),c=r.useCallback(async d=>{if(!s.connection||!d)return!1;i("save");try{return a(await E.updateDatasetStorage(s.connection,d)),s.onError(null),!0}catch(u){return s.onError(u instanceof Error?u.message:String(u)),!1}finally{i(null)}},[s.connection,s.onError]);return r.useEffect(()=>{s.enabled&&l()},[s.enabled,l]),{state:n,busy:t,refresh:l,save:c}}function Yi(s){const{connection:n,enabled:a,onError:t,profileId:i}=s,[l,c]=r.useState(null),[d,u]=r.useState(!1),p=r.useCallback(async()=>{if(n){u(!0);try{c(await E.datasetCatalog(n,i)),t(null)}catch(o){t(Zi(o))}finally{u(!1)}}},[n,t,i]);return r.useEffect(()=>{a&&p()},[a,p]),{catalog:l,loading:d,refresh:p}}function Zi(s){return s instanceof Error?s.message:String(s)}const Qi=new Set(["harness","harness-refiner","harness-continuous-review","harness-contents","harness-releases"]);function Xi(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(()=>Rn(()=>import("./UsageSettingsSection-
|
|
9
|
+
`)||`${y} validation failed.`),t(U.providers),U})}return{defaultModel:u,defaultProvider:c,providerBusy:m,saving:o,validationMessage:f,changeDefaultProvider:P,deleteProviderCredential:v,loadProviderModels:j,refreshProviderModels:R,saveProviderConfig:I,saveProviderCredential:A,saveProviders:S,setDefaultModel:p,startOpenAiSubscriptionAuth:k,validateProvider:w}}function Ki({connection:s,enabled:n,onError:a,onToast:t}){const[i,l]=r.useState(null),[c,d]=r.useState(null),[u,p]=r.useState(!1),o=r.useRef(null),g=r.useCallback(async(k={})=>{if(s){k.quiet||d("refresh");try{const L=await E.remoteAccess(s);l(L),a(null)}catch(L){a(L instanceof Error?L.message:String(L))}finally{k.quiet||d(null)}}},[s,a]);r.useEffect(()=>{!n||!s||g({quiet:!0})},[s,n,g]),r.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);function m(){o.current!==null&&window.clearTimeout(o.current),p(!1),window.setTimeout(()=>{p(!0),o.current=window.setTimeout(()=>{p(!1),o.current=null},1500)},0)}async function h(){if(a(null),!!s)try{l(await E.remoteAccess(s))}catch{}}async function f(){if(!s)return null;i&&!i.tailscale.running&&m(),d("enable");try{const k=await E.enableRemoteAccess(s);return l(k.status),a(null),k.status.tailscale.running?!k.status.serve.enabled&&k.status.serve.error&&t?.(k.status.serve.setupUrl?"Tailscale Serve needs to be enabled for this tailnet. Copy the Enable Serve link.":k.message||k.status.serve.error,"error"):(m(),t?.(k.message||"Tailscale is not running. Run Tailscale up first.","error")),k.status}catch{return await h(),m(),t?.("Unable to turn on remote access. Run Tailscale up first.","error"),null}finally{d(null)}}async function N(){if(s&&window.confirm("Turn off remote access? This runs tailscale serve reset and clears Tailscale Serve config on this device.")){d("disable");try{const k=await E.disableRemoteAccess(s);l(k.status),a(null)}catch{await h()}finally{d(null)}}}async function S(){i?.remoteWebUrl&&(d("copy-link"),await Ne(i.remoteWebUrl),d(null))}async function P(){i?.serveCommand&&(d("copy-command"),await Ne(i.serveCommand),d(null))}async function C(){i?.serve.setupUrl&&(d("copy-serve-setup"),await Ne(i.serve.setupUrl),d(null))}async function I(){i?.tailscaleUpCommand&&(d("copy-up-command"),await Ne(i.tailscaleUpCommand),d(null))}async function A(){i?.operatorCommand&&(d("copy-operator"),await Ne(i.operatorCommand),d(null))}async function v(){if(!i?.serve.enabled){const k=await f();k?.serve.enabled&&k.remoteWebUrl&&await Ne(k.remoteWebUrl);return}await S()}return{status:i,busy:c,flashTailscaleUp:u,refresh:g,enableRemoteAccess:f,disableRemoteAccess:N,copyRemoteLink:S,copyTailscaleUpCommand:I,copyServeCommand:P,copyServeSetupUrl:C,copyOperatorCommand:A,createRemoteLink:v}}function Ji(s){const[n,a]=r.useState(null),[t,i]=r.useState(null),l=r.useCallback(async()=>{if(s.connection){i("load");try{a(await E.datasetStorageState(s.connection)),s.onError(null)}catch(d){s.onError(d instanceof Error?d.message:String(d))}finally{i(null)}}},[s.connection,s.onError]),c=r.useCallback(async d=>{if(!s.connection||!d)return!1;i("save");try{return a(await E.updateDatasetStorage(s.connection,d)),s.onError(null),!0}catch(u){return s.onError(u instanceof Error?u.message:String(u)),!1}finally{i(null)}},[s.connection,s.onError]);return r.useEffect(()=>{s.enabled&&l()},[s.enabled,l]),{state:n,busy:t,refresh:l,save:c}}function Yi(s){const{connection:n,enabled:a,onError:t,profileId:i}=s,[l,c]=r.useState(null),[d,u]=r.useState(!1),p=r.useCallback(async()=>{if(n){u(!0);try{c(await E.datasetCatalog(n,i)),t(null)}catch(o){t(Zi(o))}finally{u(!1)}}},[n,t,i]);return r.useEffect(()=>{a&&p()},[a,p]),{catalog:l,loading:d,refresh:p}}function Zi(s){return s instanceof Error?s.message:String(s)}const Qi=new Set(["harness","harness-refiner","harness-continuous-review","harness-contents","harness-releases"]);function Xi(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(()=>Rn(()=>import("./UsageSettingsSection-Dm8bsNIT.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url).then(s=>({default:s.UsageSettingsSection})));function vl({payload:s,connection:n,diagnostics:a,onPayload:t,onError:i,onToast:l,onBack:c,onOpenSourceSession:d,onStartRefinerAuthoring:u,onAcceptEvaluationReview:p,onOpenSkill:o,onOpenExtension:g,teamChatCurrentUserId:m,teamChatEnabled:h,teamChatNotificationMode:f,teamChatThreads:N,onTeamChatNotificationModeChange:S,onTeamChatThreadMuteChange:P,diffPanelWidth:C,diffPanelResizing:I,diffPanelExpanded:A,onDiffPanelResizeStart:v,onDiffPanelExpandedChange:k,initialSection:L="account"}){const[R,j]=r.useState(L),[w,y]=r.useState(null),[x,U]=r.useState(!1),F=s?.codex??null,q=r.useMemo(()=>st(s?.preferences),[s?.preferences]),K=s?.personalization??nt,X=a??s?.diagnostics??[],T=tt()&&at(n?.platform),ee=r.useCallback(Q=>{s&&t({...s,providers:Q})},[t,s]),Z=r.useCallback(Q=>{s&&t({...s,preferences:Q.preferences})},[t,s]),H=r.useCallback(Q=>{s&&t({...s,extensionCatalog:Q})},[t,s]),V=Ti({connection:n,onError:i,onPayload:t}),te=Vi({connection:n,onError:i,onPayload:t,onPreferences:Z,onProviders:ee,preferences:q,providers:s?.providers??null}),W=Ui({connection:n,onError:i,onPayload:t,onPreferences:Z,preferences:q,providers:s?.providers??null}),G=qi({connection:n,enabled:R==="editor",onError:i,onPayload:t,onPreferences:Z,onToast:l,preferences:q}),ne=Wi({connection:n,onError:i,onPayload:t,personalization:K}),ae=Gi({onError:i,section:R}),ie=Ki({connection:n,enabled:R==="remote",onError:i,onToast:l}),le=R==="dataset-storage",b=Ji({connection:n,enabled:le,onError:i}),$=Yi({connection:n,enabled:le,onError:i,profileId:s?.profile.activeProfile??"default"}),_=b.save,he=r.useCallback(async()=>{await Promise.all([b.refresh(),$.refresh()])},[b.refresh,$.refresh]),ce=r.useCallback(()=>R!=="subagents"||!W.subagentsDirty?!0:window.confirm("You have unsaved changes. Leave Subagents without saving?"),[W.subagentsDirty,R]),O=r.useCallback(Q=>{Q!==R&&ce()&&(U(!1),k(!1),j(Q),it({kind:"settings",section:Q}))},[ce,k,R]),D=r.useCallback(()=>{ce()&&(U(!1),k(!1),c())},[ce,c,k]);r.useEffect(()=>{j(L)},[L]),r.useEffect(()=>{if(R!=="subagents"||!W.subagentsDirty)return;const Q=Ie=>{Ie.preventDefault(),Ie.returnValue="You have unsaved changes."};return window.addEventListener("beforeunload",Q),()=>window.removeEventListener("beforeunload",Q)},[W.subagentsDirty,R]);const z={"--diff-panel-width":`${C}px`},B=Qi.has(R),se=B&&x&&w;return e.jsxs("div",{className:`settings-shell ${T?"platform-macos":""} ${se?"harness-diff-open":""} ${A?"harness-diff-expanded":""} ${I?"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 ${se?"active":""}`,title:`${se?"Hide":"Show"} sidebar`,"aria-label":`${se?"Hide":"Show"} sidebar`,"aria-pressed":!!se,disabled:!w,onClick:()=>U(Q=>!Q),children:e.jsx(lt,{size:16})}):null,e.jsx(rt,{platform:n?.platform})]}),e.jsx(Qa,{section:R,onBack:D,onSectionChange:O}),e.jsxs("main",{className:`settings-content ${R==="profile"||B?"settings-content-wide":""}`,children:[R!=="configuration"?e.jsx(vs,{connection:n,bannerOnly:!0,onOpen:()=>O("configuration")}):null,R==="account"?e.jsx(Lt,{payload:s,connection:n,onPayload:t,onPreferences:Z,onError:i,onToast:l,...V}):R==="notifications"?e.jsx(ea,{currentUserId:m,enabled:h,mode:f,threads:N,onModeChange:S,onThreadMuteChange:P}):B?e.jsx(Li,{connection:n,enabled:B,onAcceptEvaluationReview:p,onError:i,onDefaultReleaseDiff:y,onOpenSourceSession:d,onStartRefinerAuthoring:u,onOpenReleaseDiff:Q=>{y(Q),U(!0)},onToast:l,page:Xi(R)}):R==="profile"?e.jsx(ba,{payload:s,connection:n,onPayload:t,onError:i,onToast:l,onOpenSession:d}):R==="skills"?e.jsx(ei,{personalSkills:s?.codexPersonalSkills??[],extensionCatalog:s?.extensionCatalog??{rootPath:"",registryPath:"",extensions:[],error:null},connection:n,onExtensionCatalog:H,onError:i,onToast:l,onOpenSkill:o,onOpenExtension:g}):R==="providers"?e.jsx(Fa,{account:s?.account??null,codex:F,providers:s?.providers??null,...te}):R==="dataset-storage"?e.jsx(hi,{state:b.state,catalog:$.catalog,busy:b.busy,catalogLoading:$.loading,onRefresh:he,onSave:_}):R==="configuration"?e.jsxs("div",{className:"settings-stacked-sections configuration-page",children:[e.jsx(vs,{connection:n,onSaved:async()=>{n&&t(await E.bootstrap(n))}}),e.jsx(Bt,{preferences:q,...W}),e.jsx(As,{embedded:!0,preferences:q,...W})]}):R==="context"?e.jsx(As,{preferences:q,...W}):R==="training"?e.jsx(si,{connection:n,onError:i,onPreferences:Z,preferences:q,providers:s?.providers??null}):R==="subagents"?e.jsx(Wt,{preferences:q,providers:s?.providers??null,...W}):R==="editor"?e.jsx(qt,{preferences:q,...G}):R==="remote"?e.jsx(Va,{...ie}):R==="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:R==="usage",onError:i,onOpenSourceSession:d})}):R==="personalization"?e.jsx(na,{...ne}):e.jsx(Ht,{diagnostics:X,...ae})]}),B&&n&&se?e.jsx(Oi,{connection:n,expanded:A,onResizeStart:v,onToggleExpanded:()=>k(!A),selection:se}):null]})}export{vl as SettingsView};
|