openpond 0.0.60 → 0.0.61
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/chunks/{actions-command-BNVIILSL.js → actions-command-QVYIPEN5.js} +2 -2
- package/dist/chunks/{app-layer-RNQXXM6L.js → app-layer-GCNXR4F3.js} +5 -5
- package/dist/chunks/{app-server-runtime-7LGK37P6.js → app-server-runtime-737DBOSH.js} +8 -8
- package/dist/chunks/{apps-LV3CSMLT.js → apps-JB3POF6Z.js} +5 -5
- package/dist/chunks/{chunk-LMQ4MPQI.js → chunk-32R4GQD3.js} +51 -57
- package/dist/chunks/{chunk-AHILPQXV.js → chunk-5HMXXGWZ.js} +3 -3
- package/dist/chunks/{chunk-TOCZQEPW.js → chunk-6RMGHEFF.js} +1 -1
- package/dist/chunks/{chunk-I23UKEYS.js → chunk-B3WVCPXG.js} +46 -14
- package/dist/chunks/{chunk-XFZYNYRI.js → chunk-BQQS5RRI.js} +5903 -3813
- package/dist/chunks/{chunk-SKUS4NPW.js → chunk-IZ3XGRAG.js} +154 -5
- package/dist/chunks/{chunk-PVGJXCAK.js → chunk-L5JTI6LQ.js} +52 -52
- package/dist/chunks/{chunk-RC3N77IV.js → chunk-LBIVEX6V.js} +33 -33
- package/dist/chunks/{chunk-LDRWEAOB.js → chunk-NPEWMLRH.js} +1 -1
- package/dist/chunks/{chunk-NFNEENNR.js → chunk-OYWTQABY.js} +1 -1
- package/dist/chunks/{chunk-VG4H4TQG.js → chunk-TOMMZN6V.js} +1757 -55
- package/dist/chunks/{chunk-FHP7OMEI.js → chunk-XIUCBUUQ.js} +1 -1
- package/dist/chunks/{chunk-DXSHQ6TO.js → chunk-XSHMPOQV.js} +10 -5
- package/dist/chunks/{chunk-63N6442Q.js → chunk-YSVY4O42.js} +1 -1
- package/dist/chunks/{chunk-7QLVLGDM.js → chunk-ZAX7MLQJ.js} +1 -1
- package/dist/chunks/{chunk-2J3LG4U7.js → chunk-ZJPLJP2Q.js} +2 -2
- package/dist/chunks/{cli-DBZ7S6ZF.js → cli-MFFCFH3P.js} +7 -7
- package/dist/chunks/{core-commands-H2UC3LHG.js → core-commands-KCFU7U5Y.js} +6 -6
- package/dist/chunks/{desktop-test-TV64EY5A.js → desktop-test-FEQVX4N4.js} +5 -5
- package/dist/chunks/{extension-XMWCG6YG.js → extension-M4DH25KH.js} +16 -51
- package/dist/chunks/{help-NEYFMHWQ.js → help-ZUIE4EPY.js} +1 -1
- package/dist/chunks/{opchat-ZL5JJQ5L.js → opchat-7KRZIFFD.js} +5 -5
- package/dist/chunks/{organizations-4IEC35QB.js → organizations-ZWPFNM6K.js} +7 -7
- package/dist/chunks/{profile-EVASCDIN.js → profile-GF57OWI6.js} +6 -6
- package/dist/chunks/{project-agent-DMN64RZJ.js → project-agent-65MXZHGM.js} +6 -6
- package/dist/chunks/{sandbox-command-WKGVO32R.js → sandbox-command-WH2OQRHP.js} +6 -6
- package/dist/chunks/{sandbox-template-BJUS4KJM.js → sandbox-template-W5HU24TF.js} +7 -7
- package/dist/chunks/{src-E2UCLY54.js → src-O5QXOQ5H.js} +1221 -417
- package/dist/chunks/{src-KLQEJ6RO.js → src-YUIJKNIC.js} +4 -4
- package/dist/chunks/{teams-bot-HUXYJ6XA.js → teams-bot-5ATLXSHC.js} +5 -5
- package/dist/chunks/{workspaces-4OKABHI3.js → workspaces-4XJ3GXL4.js} +2 -2
- package/dist/cli.js +13 -13
- package/dist/index.js +10 -5
- package/dist/sandbox/sandbox-instance-client.d.ts +2 -1
- package/dist/sandbox/types/org-project-agent.d.ts +10 -1
- package/dist/web/assets/{AppDialog-CxLYXiI1.js → AppDialog-BvdkukM_.js} +1 -1
- package/dist/web/assets/{AppsView-CVTUkahv.js → AppsView-9h3-BQbk.js} +1 -1
- package/dist/web/assets/BrowserSidebar-C6WJ5wIu.js +1 -0
- package/dist/web/assets/CommandMenu-C7en9zgQ.js +1 -0
- package/dist/web/assets/CommunityView-CoqI6Dks.js +1 -0
- package/dist/web/assets/ComposerCreateImproveStrip-DMq6A2Ba.js +1 -0
- package/dist/web/assets/{GetStartedView-l9MUYMYH.js → GetStartedView-B-zgx1jI.js} +1 -1
- package/dist/web/assets/LabModelVersionDetailPage-CkNOBygO.js +1 -0
- package/dist/web/assets/LabSkillSidebar-CmRHuu78.js +1 -0
- package/dist/web/assets/LabsRoute-DLPZqEev.js +3 -0
- package/dist/web/assets/MainChatThread-CFGsODmc.js +2 -0
- package/dist/web/assets/MainPane-B2kcZpM0.js +6 -0
- package/dist/web/assets/MarkdownText-C4Ixpl-i.js +9 -0
- package/dist/web/assets/Messages-DmEk_BWS.js +10 -0
- package/dist/web/assets/NativeSkillSidebar-Cn824hrX.js +1 -0
- package/dist/web/assets/{NewProjectDialog-CiGPfI5s.js → NewProjectDialog-BFEDv4Ga.js} +1 -1
- package/dist/web/assets/OutputsPage-hfQyqQzx.js +1 -0
- package/dist/web/assets/RightChatPanelStack-CiPKX3Ea.js +1 -0
- package/dist/web/assets/ScheduledWorkPage-CyoZsUCe.js +1 -0
- package/dist/web/assets/SettingsView-BZkrIOc0.css +1 -0
- package/dist/web/assets/SettingsView-DWWs9gel.js +6 -0
- package/dist/web/assets/TeamChatView-C4RWAO8c.js +3 -0
- package/dist/web/assets/{TerminalOverlay-Bb0RJR04.js → TerminalOverlay-CpsPuPIM.js} +1 -1
- package/dist/web/assets/TrainingCreationPanel-DMLpUVbJ.js +1 -0
- package/dist/web/assets/TrainingDraftPanel-gAhpwkYs.js +1 -0
- package/dist/web/assets/{UsageSettingsSection-Cdc_jGFX.js → UsageSettingsSection-WBtxLhBx.js} +1 -1
- package/dist/web/assets/WorkspaceDiffPanel-CUpwqvzZ.js +14 -0
- package/dist/web/assets/WorkspaceEnvironmentMenu-LIbOBT4f.js +32 -0
- package/dist/web/assets/{WorkspaceGitDialogs-CK6ahRty.js → WorkspaceGitDialogs-8y7rRSou.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-BQoN7jWa.js → WorkspaceMonacoEditor-BpHmWrCD.js} +3 -3
- package/dist/web/assets/{arrow-up-right-CzBZuWNj.js → arrow-up-right-3TbyK1ec.js} +1 -1
- package/dist/web/assets/{chevron-up-DW-qEVSP.js → chevron-up-C4tTuxXs.js} +1 -1
- package/dist/web/assets/{cloud-upload-CjLR-8-r.js → cloud-upload-ZGHLWEn3.js} +1 -1
- package/dist/web/assets/{cssMode-CQQJhS7v.js → cssMode-kfZCOm_r.js} +1 -1
- package/dist/web/assets/{folder-open-BpUcIJHn.js → folder-open-C4WG_lDr.js} +1 -1
- package/dist/web/assets/{folder-plus-8NHsIAxQ.js → folder-plus-CKRaDeR3.js} +1 -1
- package/dist/web/assets/{git-branch-DO3iP_fL.js → git-branch-yLi5tff8.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-BSWa2I3g.js → git-commit-horizontal-BPyGYak3.js} +1 -1
- package/dist/web/assets/{htmlMode-DaAKO9wk.js → htmlMode-DT--Et9k.js} +1 -1
- package/dist/web/assets/index--lwjVZXT.js +178 -0
- package/dist/web/assets/index-B_HvNtwl.css +1 -0
- package/dist/web/assets/index-C9-OtZl8.js +1 -0
- package/dist/web/assets/{info-DiEvrUda.js → info-CzzHwSUb.js} +1 -1
- package/dist/web/assets/{jsonMode-Biu1ZTZ7.js → jsonMode-CKg1GzqC.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-lwoDxGgl.js → lspLanguageFeatures-B76Yo6xo.js} +1 -1
- package/dist/web/assets/{monaco.contribution-DzHhgeLy.js → monaco.contribution-BRuQU-2A.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BqQSY5-t.js → monaco.contribution-CLpGfCSS.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Ic8LKME8.js → monaco.contribution-CS3H8RrD.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Ce2MS2Nv.js → monaco.contribution-DqeexNAI.js} +2 -2
- package/dist/web/assets/{play-D9F3t5Cx.js → play-EDFh3BPS.js} +1 -1
- package/dist/web/assets/{python-BhVCwr-K.js → python-De_Vr_hD.js} +1 -1
- package/dist/web/assets/{refresh-cw-DRN17xPU.js → refresh-cw-DRJJ-X1U.js} +1 -1
- package/dist/web/assets/{save-CDZwpzlG.js → save-BSxqIWP6.js} +1 -1
- package/dist/web/assets/{square-Cf_AXs4a.js → square-BV-Vgh5a.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-Bb_m9pXM.js → toggleHighContrast-1Suz4cxo.js} +1 -1
- package/dist/web/assets/{tsMode-BaWkaSHN.js → tsMode-DMyzpvFI.js} +1 -1
- package/dist/web/assets/{upload-Cef29aCP.js → upload-jVxCW0dO.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-CAAqoZ0V.js → useLocalAgentSchedules-DNpnOBA8.js} +1 -1
- package/dist/web/assets/{wifi-off-C8cC22F6.js → wifi-off-IzGGiOX_.js} +1 -1
- package/dist/web/assets/{workers-GOdHtcZt.js → workers-Crdnk6Zy.js} +1 -1
- package/dist/web/assets/{yaml-jBIxwMeR.js → yaml-CF3tmjgW.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/BrowserSidebar-oHniLA05.js +0 -1
- package/dist/web/assets/CommandMenu-Db_5OiKs.js +0 -1
- package/dist/web/assets/CommunityView-HTwMEO-T.js +0 -1
- package/dist/web/assets/ComposerCreateImproveStrip-ER26yFe-.js +0 -1
- package/dist/web/assets/LabModelVersionDetailPage-Dgf-DlJi.js +0 -1
- package/dist/web/assets/LabSkillSidebar-CyX8sVm1.js +0 -1
- package/dist/web/assets/LabsRoute-BC1ST9qT.js +0 -3
- package/dist/web/assets/MainChatThread-BfW92Rv1.js +0 -2
- package/dist/web/assets/MainPane-DlciH8yR.js +0 -6
- package/dist/web/assets/MarkdownText-CyOeCVjf.js +0 -9
- package/dist/web/assets/Messages-BDtEbIKv.js +0 -9
- package/dist/web/assets/NativeSkillSidebar-D0BlvEtE.js +0 -1
- package/dist/web/assets/OutputsPage-DNU2yD7q.js +0 -1
- package/dist/web/assets/RightChatPanelStack-Cs63fQwk.js +0 -1
- package/dist/web/assets/ScheduledWorkPage-DMKHFbeE.js +0 -1
- package/dist/web/assets/SettingsView-C39BqlSI.css +0 -1
- package/dist/web/assets/SettingsView-L0g-g2fL.js +0 -6
- package/dist/web/assets/TeamChatView-CSVMTUAE.js +0 -3
- package/dist/web/assets/TrainingCreationPanel-VIWlpVV2.js +0 -1
- package/dist/web/assets/TrainingDraftPanel-MTYsR-Ry.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-BgIbxMMu.js +0 -14
- package/dist/web/assets/WorkspaceEnvironmentMenu-C97GqYn9.js +0 -32
- package/dist/web/assets/circle-alert-B_xROoPY.js +0 -1
- package/dist/web/assets/folder-git-2-ktXin28y.js +0 -1
- package/dist/web/assets/folder-tLv6TMN2.js +0 -1
- package/dist/web/assets/index-BtiK52K1.js +0 -1
- package/dist/web/assets/index-CE2hroF6.css +0 -1
- package/dist/web/assets/index-DHxBMQIJ.js +0 -174
- package/dist/web/assets/square-pen-ChJgNiDm.js +0 -1
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./UsageSettingsSection-Cdc_jGFX.js","./index-DHxBMQIJ.js","./index-CE2hroF6.css","./arrow-up-right-CzBZuWNj.js","./index-BtiK52K1.js","./UsageSettingsSection-O8VK0qBL.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as ge,j as e,r,at as ls,X as le,au as la,av as ia,aw as ra,ax as oa,ay as ca,az as da,P as me,aA as ua,aB as ha,n as E,aC as ma,aD as Je,aE as pa,aF as ga,aG as fa,J as Es,s as Te,aH as xa,t as ja,K as De,b as Ms,aI as Ye,aJ as Be,ac as ba,C as va,aK as ya,G as Qe,$ as Na,F as Ie,aL as ae,aM as wa,aN as Ze,aO as Xe,a2 as Os,A as Sa,a0 as Ca,a1 as ka,B as Pa,a as Ts,aP as Ra,aQ as Aa,p as Da,H as es,a6 as _e,aR as je,ag as Ia,aS as $a,aT as Ea,aU as Ma,Y as Oa,aV as Ta,_ as La}from"./index-DHxBMQIJ.js";import{R as ne}from"./refresh-cw-DRN17xPU.js";import{D as we,T as be,P as Ls,B as Le,W as He,C as Ua}from"./MarkdownText-CyOeCVjf.js";/* empty css */import{S as is}from"./save-CDZwpzlG.js";import{F as Us}from"./folder-open-BpUcIJHn.js";import{C as za}from"./chevron-up-DW-qEVSP.js";import{C as zs}from"./circle-alert-B_xROoPY.js";import{P as Bs}from"./play-D9F3t5Cx.js";import{B as Ba,a as _s,W as _a,S as Ha}from"./wifi-off-C8cC22F6.js";import{R as $e,u as Fa}from"./useLocalAgentSchedules-CAAqoZ0V.js";import{C as pe}from"./cloud-upload-CjLR-8-r.js";import{F as Ce}from"./folder-git-2-ktXin28y.js";import{G as Ee}from"./git-commit-horizontal-BSWa2I3g.js";import{S as Ga}from"./square-pen-ChJgNiDm.js";import{r as qa}from"./index-BtiK52K1.js";import{F as Wa}from"./folder-plus-8NHsIAxQ.js";import{WorkspaceDiffPanel as Va}from"./WorkspaceDiffPanel-BgIbxMMu.js";import"./training-model-data-V8276E5q.js";import"./folder-tLv6TMN2.js";import"./info-DiEvrUda.js";const Ka=[["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"}]],Ja=ge("clipboard-copy",Ka);const Ya=[["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"}]],Qa=ge("hard-drive",Ya);const Za=[["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"}]],ue=ge("key-round",Za);const Xa=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],en=ge("power",Xa);const sn=[["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"}]],Hs=ge("radio-tower",sn);const an=[["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"}]],nn=ge("rotate-cw",an);const tn=[["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"}]],Fs=ge("sliders-horizontal",tn);const ln=[["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"}]],rn=ge("circle-user",ln);function ds({handle:s,image:a}){const t=s?.trim().slice(0,1).toUpperCase()||"+";return e.jsx("div",{className:"account-avatar",children:a?e.jsx("img",{src:a,alt:""}):e.jsx("span",{children:t})})}function Fe({state:s,label:a}){return e.jsx("span",{className:`account-state ${s}`,children:a??s.replace("_"," ")})}const ss="https://openpond.ai",as="https://api.openpond.ai";function on(s,a){return s==="connect"?{handle:void 0,currentBaseUrl:null}:{handle:a?.handle,currentBaseUrl:a?.baseUrl??null}}function us(s,a){const t=a.trim().replace(/\/+$/,"");if(!t)throw new Error(`${s} is required.`);try{const n=new URL(t);if(n.protocol!=="http:"&&n.protocol!=="https:")throw new Error("unsupported protocol")}catch{throw new Error(`${s} must be an absolute http or https URL.`)}return t}function hs({account:s,busy:a,initialApiKey:t="",mode:n="update",onClose:l,onSave:i}){const d=r.useId(),c=n==="connect",[o,j]=r.useState(t),[g,u]=r.useState(!1),[h,m]=r.useState(s?.baseUrl??ss),[f,v]=r.useState(s?.apiBaseUrl??as),[y,C]=r.useState(null),[P,A]=r.useState(null);ls(P),r.useEffect(()=>{j(t),u(!1),m(s?.baseUrl??ss),v(s?.apiBaseUrl??as),C(null),A(null)},[s?.apiBaseUrl,s?.baseUrl,s?.handle,t]);async function D(b){b.preventDefault(),C(null),A(null);const I=o.trim();if(c&&!I){C("API key is required.");return}let k,U;try{k=us("Base URL",h),U=us("API base URL",f)}catch(p){C(p instanceof Error?p.message:String(p));return}try{const p=on(n,s);await i({...p,baseUrl:k,apiBaseUrl:U,apiKey:c?I:void 0,environment:c?cn(k,U):s?.environment??null})}catch(p){A(p instanceof Error?p.message:String(p))}}return e.jsx("div",{className:"git-dialog-backdrop account-endpoint-dialog-backdrop",role:"presentation",onMouseDown:b=>{b.target===b.currentTarget&&!a&&l()},children:e.jsxs("form",{className:"git-dialog account-endpoint-dialog",role:"dialog","aria-modal":"true","aria-labelledby":d,onSubmit:b=>{D(b)},children:[e.jsx("button",{className:"git-dialog-close",disabled:a,type:"button",title:"Close","aria-label":"Close",onClick:l,children:e.jsx(le,{size:16})}),e.jsx("div",{className:"git-dialog-icon",children:c?e.jsx(ue,{size:18}):e.jsx(Fs,{size:18})}),e.jsx("h2",{id:d,children:c?"Add account":"Account endpoints"}),c?e.jsx("p",{children:"Enter your OpenPond API key to connect another account."}):null,c?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"API key"}),e.jsx("input",{autoFocus:!0,disabled:a,placeholder:"opk_...",type:"password",value:o,onChange:b=>j(b.target.value)})]}):null,c?e.jsxs("label",{className:"git-dialog-toggle account-dialog-advanced-toggle",children:[e.jsx("input",{checked:g,disabled:a,type:"checkbox",onChange:b=>u(b.target.checked)}),e.jsx("span",{}),"Advanced"]}):null,!c||g?e.jsxs("div",{className:"account-dialog-advanced-fields",children:[e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Base URL"}),e.jsx("input",{autoFocus:!c,disabled:a,inputMode:"url",value:h,onChange:b=>m(b.target.value)})]}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"API base URL"}),e.jsx("input",{disabled:a,inputMode:"url",value:f,onChange:b=>v(b.target.value)})]})]}):null,y?e.jsx("div",{className:"profile-dialog-warning",children:y}):null,e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:a,type:"button",onClick:l,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:a,type:"submit",children:[e.jsx(is,{size:14}),e.jsx("span",{children:a?"Saving":c?"Connect account":"Update account"})]})]})]})})}function cn(s,a){return s===ss&&a===as?"production":"custom"}const dn="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 un({payload:s,connection:a,saving:t,refreshingAccounts:n,saveAccount:l,refreshAccounts:i,switchAccount:d,removeAccount:c,onPayload:o,onPreferences:j,onError:g,onToast:u}){const h=s?.account,m=h?.state??"loading",f=m==="signed_in",v=m==="signed_out",y=m==="auth_error",C=h?.email?.trim()||null,P=h?.accounts??[],[A,D]=r.useState([]),[,b]=r.useState(!1),[I,k]=r.useState(null),[U,p]=r.useState(null),[w,N]=r.useState(null),[x,M]=r.useState(null),[T,q]=r.useState(!1),[V,R]=r.useState(null),{confirmAction:S,confirmDialog:O,resolveConfirmDialog:Q}=la(),J=P.find($=>$.isActive)??P[0]??null,W=s?.preferences.defaultTeamId?.trim()||null,Z=w??W,K=ia(h),z=s?.accountMeta.asOf??"",se=Ne(h?.environment,J?.environment),ie=f?Ne(J?.displayLabel,J?.handle,h?.label,h?.activeProfile?.handle,"Signed in"):y?"Account needs attention":v?"No account connected":"Loading account",ce=f?C??ms(se):y?"Not connected":v?"Cloud projects, hosted agents, and team defaults are disabled until you sign in.":"Checking account status.",re=P.length>0,te=y?hn(h?.error):null,ee=r.useMemo(()=>A.filter($=>$.status==="active"),[A]),L=(r.useMemo(()=>Z?ee.find($=>$.teamId===Z)??null:null,[ee,Z])??ra(ee))?.teamId??"",_=r.useMemo(()=>ee.map($=>({value:$.teamId,label:Ne($.displayName,$.name,$.slug,"Team"),description:oa($.role)})),[ee]),F=L||_[0]?.value||"",B=_.length>0,H=!a||!!U||!!I||ee.length===0,ye=x?Ge(x):null,cs=!!(ye&&V===ye),Zs=f||y;r.useEffect(()=>{if(!a||!K){D([]),k(null),b(!1);return}let $=!1;const Y=ca(K);return Y?(D(Y),b(!1)):(D([]),b(!0)),k(null),da({accountKey:K,force:!!z,fetchOrganizations:async()=>(await E.organizations(a)).organizations.map(ma).filter(X=>!!X).filter(X=>X.status==="active")}).then(G=>{$||D(G)}).catch(G=>{$||(Y||D([]),k(G instanceof Error?G.message:String(G)))}).finally(()=>{$||b(!1)}),()=>{$=!0}},[z,a,K]),r.useEffect(()=>{w&&W===w&&N(null)},[W,w]);async function Xs($,Y={notify:!0}){const G=ee.find(X=>X.teamId===$)??null;if(!(!a||!G||U||(w??W)===G.teamId)){N(G.teamId),p(G.teamId),g(null),ha({teamId:G.teamId,accountKey:K,force:!0,fetchAgents:async X=>(await E.listSandboxAgents(a,{teamId:X})).agents}).catch(()=>{});try{j(await E.savePreferences(a,{defaultTeamId:G.teamId})),Y.notify&&u?.("Default team updated","success")}catch(X){N(null),g(X instanceof Error?X.message:String(X))}finally{p(null)}}}async function Ue($="Continue"){return Zs?S({title:"Change active OpenPond account?",body:dn,confirmLabel:$,cancelLabel:"Cancel"}):!0}async function ea($){await Ue("Save account")&&(await l({apiKey:$.apiKey??"",handle:$.handle,baseUrl:$.baseUrl,apiBaseUrl:$.apiBaseUrl,environment:$.environment}),q(!1))}async function sa($){if(!a||!x)throw new Error("OpenPond server connection is not ready.");if(x.isActive&&!await Ue("Save endpoints"))return;const Y=Ge(x);R(Y),g(null);try{const G=await E.updateOpenPondAccountConfig(a,{handle:$.handle??x.handle,currentBaseUrl:$.currentBaseUrl,baseUrl:$.baseUrl,apiBaseUrl:$.apiBaseUrl,chatApiBaseUrl:null,environment:mn($.environment),setActive:x.isActive});o(G),u?.("Account endpoints updated","success"),M(null)}catch(G){throw g(G instanceof Error?G.message:String(G)),G}finally{R(null)}}async function aa($){const Y=$.handle?.trim()||"";Y&&await Ue("Switch account")&&await d(Y,$.baseUrl)}async function na($){const Y=$.handle?.trim()||"";if(!Y||$.isActive)return;const G=Ne($.displayLabel,$.email,$.handle,"this account");await S({title:"Remove saved account?",body:`Remove ${G} from this device? Its saved credential and endpoint settings will be deleted. This does not delete any OpenPond cloud data.`,confirmLabel:"Remove account",cancelLabel:"Cancel",tone:"danger"})&&await c(Y,$.baseUrl)&&u?.("Account removed","success")}return e.jsxs("section",{className:"account-settings",children:[e.jsxs("div",{className:"account-settings-title",children:[e.jsx("h1",{children:"Account"}),e.jsxs("div",{className:"account-settings-title-actions",children:[e.jsxs("button",{className:"settings-secondary compact account-add-action",disabled:!a||t,type:"button",onClick:()=>q(!0),children:[e.jsx(me,{size:14}),e.jsx("span",{children:"Add account"})]}),e.jsx("button",{className:"settings-icon-button ghost",disabled:!a||t||n,title:"Refresh accounts and team data","aria-label":"Refresh accounts and team data",type:"button",onClick:()=>{i()},children:e.jsx(ne,{size:15,className:n?"settings-spin":void 0})})]})]}),e.jsxs("div",{className:"account-summary",children:[e.jsxs("div",{className:"account-summary-main",children:[e.jsx(ds,{handle:ie,image:f?h?.avatarUrl??J?.avatarUrl??null:null}),e.jsxs("div",{children:[e.jsx("span",{children:"Active account"}),e.jsx("strong",{children:ie}),e.jsxs("div",{className:"account-summary-meta",children:[e.jsx("small",{className:f&&C?"private-account-email":f?void 0:"account-summary-copy",tabIndex:f&&C?0:void 0,children:ce}),f&&B?e.jsx(we,{className:"account-team-dropdown",compact:!0,disabled:H,label:"Default team",options:_,value:F,onChange:$=>{Xs($)}}):null]})]})]}),e.jsx("div",{className:"account-summary-actions",children:e.jsx(Fe,{state:m,label:v?"not signed in":void 0})})]}),re?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:[P.length," account",P.length===1?"":"s"]})]}),e.jsx("p",{className:"account-list-note",children:"Switch to another account before removing the active account."}),P.map($=>{const Y=$.handle?.trim()||"",G=Ne($.displayLabel,$.handle,"Unknown account"),X=$.email?.trim()||null,ze=pn($.environment),ta=Ge($);return e.jsxs("div",{className:"account-row",children:[e.jsx(ds,{handle:G,image:$.avatarUrl??null}),e.jsxs("div",{className:"account-details",children:[e.jsx("strong",{children:G}),X?e.jsx("span",{className:"private-account-email",tabIndex:0,children:X}):null,e.jsx("span",{children:ms($.environment??"production")})]}),e.jsxs("div",{className:"account-row-actions",children:[e.jsx(Fe,{state:$.authHealth}),$.isActive?e.jsx("span",{className:"active-pill",children:"Active"}):null,e.jsx("button",{className:`account-env-toggle ${ze?"active":""}`,disabled:!a||t||!!V||!Y,type:"button","aria-label":`Configure ${G} environment endpoints`,"aria-pressed":ze,title:"Configure environment endpoints",onClick:()=>M($),children:e.jsx("span",{className:"account-env-toggle-switch","aria-hidden":"true"})}),$.isActive?null:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"inline-action",disabled:t||!Y,type:"button",onClick:()=>{aa($)},children:"Use"}),e.jsx("button",{className:"inline-action danger account-remove-action",disabled:t||!Y,type:"button","aria-label":`Remove ${G}`,title:`Remove ${G}`,onClick:()=>{na($)},children:e.jsx(be,{size:13})})]})]})]},ta)})]}):null,h?.products&&h.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:[h.products.length," active"]})]}),h.products.map($=>e.jsxs("div",{className:"product-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:$.name}),e.jsx("span",{children:$.type})]}),e.jsx(Fe,{state:$.status})]},$.id))]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:s?.server.runtimeVersion??"Runtime loading"}),e.jsx("strong",{children:a?.serverUrl??"loading"})]}),te?e.jsxs("div",{className:"settings-footnote warning account-error-footnote",children:[e.jsx("span",{children:"Account error"}),e.jsx("strong",{children:te})]}):null,x?e.jsx(hs,{account:x,busy:cs,onClose:()=>{cs||M(null)},onSave:sa}):null,T?e.jsx(hs,{busy:t,mode:"connect",onClose:()=>{t||q(!1)},onSave:ea}):null,e.jsx(ua,{state:O,onResolve:Q})]})}function Ge(s){return`${s.handle.trim().toLowerCase()}|${s.baseUrl??"default"}`}function Ne(...s){for(const a of s){const t=a?.trim();if(t)return t}return""}function hn(s){const a=s?.trim();if(!a)return null;const t=a.toLowerCase();return t.includes("protected deployment")||t.includes("vercel_auth_enabled")?"Staging is protected by Vercel. Restart OpenPond after signing in to Vercel, then try again.":t.includes("unexpected token '<'")||t.includes("<!doctype")||t.includes("vercel.com/sso-api")?"OpenPond received a web login page instead of account data. Restart after signing in to Vercel, then try again.":t.includes("401")||t.includes("unauthorized")||t.includes("could not authenticate")?"The API key could not authenticate. Check the key and account environment, then try again.":a.length>220?`${a.slice(0,217)}...`:a}function ms(s){const a=s.trim().toLowerCase();return!a||a==="production"?"Production":"Environment"}function mn(s){const a=s?.trim();return!a||a.toLowerCase()==="production"?"custom":a}function pn(s){const a=s?.trim().toLowerCase();return!!(a&&a!=="production")}function gn({advancedWorkspaceControls:s,defaultBranchPrefix:a,defaultNewProjectDirectory:t,preferences:n,saving:l,chooseDefaultProjectDirectory:i,saveDefaults:d,setAdvancedWorkspaceControls:c,setDefaultBranchPrefix:o,setDefaultNewProjectDirectory:j}){const g=Je(a)===n.defaultBranchPrefix&&t.trim()===n.defaultNewProjectDirectory&&s===n.advancedWorkspaceControls;return e.jsxs("section",{className:"account-settings",children:[e.jsx("h1",{children:"Defaults"}),e.jsxs("form",{className:"provider-settings-form",onSubmit:u=>{d(u)},children:[e.jsxs("label",{className:"settings-check-row",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:l,onChange:u=>c(u.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:a,disabled:l,placeholder:"feat/",onChange:u=>o(u.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:t,disabled:l,placeholder:"~/Documents/OpenPond Projects",onChange:u=>j(u.target.value)})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:l,onClick:()=>{i()},children:[e.jsx(Us,{size:14}),e.jsx("span",{children:"Browse"})]})]}),e.jsx("button",{className:"settings-primary",disabled:l||g,children:e.jsx("span",{children:l?"Saving":"Save defaults"})})]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:"Initial branch name"}),e.jsxs("strong",{children:[Je(a),"example-project"]})]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:"New projects"}),e.jsx("strong",{children:t||n.defaultNewProjectDirectory})]})]})}function fn({diagnostics:s,diagnosticsAvailable:a,diagnosticsBusy:t,diagnosticsStatus:n,logDir:l,logLineLimit:i,logLines:d,logViewBusy:c,logViewSummary:o,logViewportRef:j,tailLogs:g,copyRecentLogs:u,exportDiagnosticsBundle:h,loadOlderLogs:m,openLogsFolder:f,refreshLogView:v,toggleTailLogs:y}){const C=s.filter(A=>A.name==="diagnostic"&&A.status==="failed").slice().reverse().map(xn),P=typeof window>"u"?void 0:window.openpond;return e.jsxs("section",{className:"account-settings",children:[e.jsx("h1",{children:"Diagnostics"}),e.jsxs("div",{className:"diagnostics-log-panel",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Recent errors"}),e.jsxs("small",{children:[C.length," saved"]})]}),e.jsx("div",{className:"diagnostics-error-list",role:"list",children:C.length===0?e.jsx("div",{className:"diagnostics-error-empty",children:"No saved errors"}):C.map(A=>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:A.message}),e.jsx("time",{dateTime:A.timestamp,children:A.timeLabel})]}),e.jsxs("div",{className:"diagnostics-error-meta",children:[e.jsx("span",{children:A.surface}),A.status?e.jsx("span",{children:A.status}):null,A.sequence?e.jsxs("span",{children:["#",A.sequence]}):null]}),A.detail?e.jsxs("details",{className:"diagnostics-error-detail",children:[e.jsx("summary",{children:"Details"}),e.jsx("pre",{children:A.detail})]}):null]})]},A.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:a?"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:t!==null||!P?.openLogsFolder,onClick:()=>{f()},children:[e.jsx(Us,{size:15}),e.jsx("span",{children:t==="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:t!==null||!P?.exportDiagnostics,onClick:()=>{h()},children:[e.jsx(pa,{size:15}),e.jsx("span",{children:t==="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:t!==null||!P?.copyRecentLogs,onClick:()=>{u()},children:[e.jsx(Ja,{size:15}),e.jsx("span",{children:t==="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:o}),e.jsx("button",{type:"button",className:`settings-icon-button ${g?"active":""}`,title:g?"Pause tail":"Tail logs","aria-label":g?"Pause tail":"Tail logs",disabled:!P?.readRecentLogs,onClick:y,children:g?e.jsx(Ls,{size:15}):e.jsx(Bs,{size:15})}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Refresh logs","aria-label":"Refresh logs",disabled:c!==null||!P?.readRecentLogs,onClick:()=>{v(i,"refresh")},children:e.jsx(ne,{size:15})}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:c!==null||!P?.readRecentLogs,onClick:m,children:[e.jsx(za,{size:15}),e.jsx("span",{children:c==="older"?"Loading":"Older"})]})]})]}),e.jsx("div",{ref:j,className:"diagnostics-log-viewer",role:"log","aria-live":g?"polite":"off",children:d.length===0?e.jsx("div",{className:"diagnostics-log-empty",children:c?"Loading logs":"No log lines"}):d.map((A,D)=>e.jsxs("div",{className:"diagnostics-log-entry",children:[e.jsx("span",{className:"diagnostics-log-source",children:A.file}),e.jsx("code",{children:A.line})]},`${A.file}:${A.timestamp}:${A.index}:${D}`))}),l&&e.jsxs("div",{className:"diagnostics-log-dir",children:[e.jsx("span",{children:"Source"}),e.jsx("strong",{children:l})]})]}),n&&e.jsxs("div",{className:`settings-footnote ${n.warning?"warning":""}`,children:[e.jsx("span",{children:n.label}),e.jsx("strong",{children:n.value})]})]})}function xn(s){const a=ps(s.data),t=ps(a.context),l=he(a.stack)??he(a.detail)??he(t.detail)??null;return{id:s.id,timestamp:s.timestamp,timeLabel:bn(s.timestamp),message:jn(s,a),surface:he(a.surface)??s.source??"diagnostic",status:s.status??null,sequence:s.sequence??null,detail:l}}function jn(s,a){return he(s.error)??he(s.output)??he(a.message)??he(a.error)??"Diagnostic event"}function bn(s){const a=new Date(s);return Number.isNaN(a.getTime())?s:a.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function ps(s){return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}function he(s){return typeof s=="string"&&s.trim()?s.trim():null}const gs=[{id:"typescript",label:"TypeScript",placeholder:"typescript-language-server"},{id:"python",label:"Python",placeholder:"pyright-langserver"},{id:"rust",label:"Rust",placeholder:"rust-analyzer"}];function vn({editorPreferences:s,lspStatus:a,preferences:t,restarting:n,saving:l,statusLoading:i,refreshLspStatus:d,restartLanguageServers:c,saveEditorSettings:o,setEditorPreferences:j,setLanguageCustomCommand:g,setLanguageMode:u}){const h=JSON.stringify(s)!==JSON.stringify(t.editor),m=new Map(a?.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=>{o(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(we,{value:s.languageServers,disabled:l,label:"Language servers",options:ga,onChange:f=>j(v=>({...v,languageServers:f}))})]})}),e.jsxs("label",{className:"settings-check-row",children:[e.jsx("input",{type:"checkbox",checked:s.diagnosticsWhileEditing,disabled:l||s.languageServers==="off",onChange:f=>j(v=>({...v,diagnosticsWhileEditing:f.target.checked}))}),e.jsxs("span",{children:[e.jsx("strong",{children:"Diagnostics while editing"}),e.jsx("small",{children:"Update Monaco markers as the local buffer changes."})]})]}),e.jsxs("label",{className:"settings-check-row",children:[e.jsx("input",{type:"checkbox",checked:s.checkOnSave,disabled:l||s.languageServers==="off",onChange:f=>j(v=>({...v,checkOnSave:f.target.checked}))}),e.jsxs("span",{children:[e.jsx("strong",{children:"Check on save"}),e.jsx("small",{children:"Refresh diagnostics after writing a file."})]})]}),e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Languages"}),e.jsx("small",{children:"Auto, disabled, or custom executable"})]}),e.jsx("div",{className:"lsp-language-list",children:gs.map(f=>{const v=s.languages[f.id];return e.jsxs("div",{className:"lsp-language-row",children:[e.jsxs("div",{className:"lsp-language-label",children:[e.jsx("strong",{children:f.label}),e.jsx("span",{children:fs(m.get(f.id),i)})]}),e.jsxs("div",{className:"settings-select-field",children:[e.jsx("span",{children:"Mode"}),e.jsx(we,{value:v.mode,disabled:l||s.languageServers==="off",label:`${f.label} language server mode`,options:fa,onChange:y=>u(f.id,y)})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Custom executable"}),e.jsx("input",{value:v.customCommand,disabled:l||s.languageServers==="off"||v.mode!=="custom",placeholder:f.placeholder,onChange:y=>g(f.id,y.target.value)})]})]},f.id)})}),e.jsx("button",{className:"settings-primary",disabled:l||!h,children:e.jsx("span",{children:l?"Saving":"Save editor settings"})})]}),e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"LSP status"}),e.jsxs("div",{className:"settings-heading-actions",children:[e.jsx("small",{children:i?"Checking":a?"Current":"Not checked"}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Refresh LSP status","aria-label":"Refresh LSP status",disabled:i||n,onClick:()=>{d()},children:e.jsx(ne,{className:i?"settings-spin":void 0,size:15})}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:i||n,onClick:()=>{c()},children:[e.jsx(nn,{className:n?"settings-spin":void 0,size:15}),e.jsx("span",{children:n?"Restarting":"Restart"})]})]})]}),gs.map(f=>{const v=m.get(f.id);return e.jsxs("div",{className:"product-row lsp-status-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:f.label}),e.jsx("span",{title:v?.command??v?.message??void 0,children:v?.command??v?.message??"Not checked"})]}),e.jsx("span",{className:`lsp-status-pill ${v?.status??"missing"}`,children:fs(v,i)})]},f.id)})]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:"Project config"}),e.jsx("strong",{children:"Uses tsconfig, pyrightconfig, pyproject, and Cargo files when present"})]})]})}function fs(s,a){return a&&!s?"Checking":s?s.status==="found"?"Found":s.status==="disabled"?"Disabled":s.status==="error"?"Error":"Missing":"Not checked"}function yn({contextCompactionAutoEnabled:s,preferences:a,saving:t,saveDefaults:n,setContextCompactionAutoEnabled:l}){return e.jsxs("section",{className:"account-settings",children:[e.jsx("h1",{children:"Context"}),e.jsxs("form",{className:"provider-settings-form",onSubmit:i=>{n(i)},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:i=>l(i.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 Nn({subagentsEnabled:s,subagentDelegationMode:a,subagentsUseDefaultModel:t,subagentsProvider:n,subagentsModel:l,subagentRoles:i,subagentsMaxConcurrentRuns:d,subagentsMaxConcurrentRunsPerProvider:c,subagentsMaxConcurrentRunsPerWorkspaceTarget:o,preferences:j,providers:g,saving:u,saveDefaults:h,changeSubagentsProvider:m,setSubagentsEnabled:f,setSubagentDelegationMode:v,setSubagentsUseDefaultModel:y,setSubagentsModel:C,setSubagentsMaxConcurrentRuns:P,setSubagentsMaxConcurrentRunsPerProvider:A,setSubagentsMaxConcurrentRunsPerWorkspaceTarget:D,setSubagentRoleEnabled:b,setSubagentRoleIsolationMode:I,setSubagentRoleMaxConcurrentRuns:k,setSubagentRoleModel:U,setSubagentRolePeerMessages:p,setSubagentRoleToolPolicy:w,changeSubagentRoleProvider:N}){const x=Es(g,{enabledOnly:!0}),M=t?j.defaultChatProvider:n,T=t?j.defaultChatModel:l,q=Gs(Te(M,g),T),V=t?null:{providerId:n,modelId:l.trim()},R=Pn({enabled:s,delegationMode:a,defaultModelRef:V,roles:i,maxConcurrentRuns:d,maxConcurrentRunsPerProvider:c,maxConcurrentRunsPerWorkspaceTarget:o},j);return e.jsx("section",{className:"account-settings subagents-settings",children:e.jsxs("form",{className:"subagent-settings-form",onSubmit:S=>{h(S)},children:[e.jsxs("div",{className:"subagent-settings-title-row",children:[e.jsx("h1",{children:"Subagents"}),e.jsxs("div",{className:"subagent-settings-actions",children:[e.jsx("button",{className:`settings-primary subagent-save-button${R?"":" dirty"}`,disabled:u||R,children:e.jsx("span",{children:u?"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:u,onChange:S=>f(S.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:a,disabled:u||!s,onChange:S=>v(S.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:M,disabled:u||!s,onChange:S=>{y(!1),m(S.target.value)},children:x.map(S=>e.jsx("option",{value:S.value,children:S.label},S.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Model"}),e.jsx("select",{value:T,disabled:u||!s,onChange:S=>{y(!1),C(S.target.value)},children:q.map(S=>e.jsx("option",{value:S.value,children:S.label},S.value))})]})]})]}),e.jsx("div",{className:"subagent-role-list",children:i.map(S=>{const O=xa.find(z=>z.id===S.id),Q=S.modelRef?.providerId??M,J=S.modelRef?.modelId||ja(Q,g)||T,W=kn(x,g,{providerId:Q,modelId:J}),Z=Re(Q,J),K=u||!s||!S.enabled;return e.jsxs("section",{className:`subagent-role-row${S.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:O?.label??S.id}),e.jsx("small",{children:O?.description??"Custom subagent role."})]}),e.jsxs("label",{className:"provider-toggle subagent-card-toggle","aria-label":`${O?.label??S.id} enabled`,children:[e.jsx("input",{type:"checkbox",checked:S.enabled,disabled:u||!s,onChange:z=>b(S.id,z.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:Z,disabled:K,onChange:z=>{const se=W.find(ie=>ie.value===z.target.value);se&&(N(S.id,se.providerId),U(S.id,se.modelId))},children:W.map(z=>e.jsx("option",{value:z.value,children:z.label},z.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Isolation"}),e.jsx("select",{value:S.isolationMode,disabled:K,onChange:z=>I(S.id,z.target.value),children:wn.map(z=>e.jsx("option",{value:z.value,children:z.label},z.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Tools"}),e.jsx("select",{value:S.toolPolicy,disabled:K,onChange:z=>w(S.id,z.target.value),children:Sn.map(z=>e.jsx("option",{value:z.value,children:z.label},z.value))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Peer messages"}),e.jsx("select",{value:S.peerMessages,disabled:K,onChange:z=>p(S.id,z.target.value),children:Cn.map(z=>e.jsx("option",{value:z.value,children:z.label},z.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:S.maxConcurrentRuns,disabled:K,onChange:z=>k(S.id,xs(z.target.value,1))})]})})]},S.id)})}),e.jsxs("section",{className:"subagent-settings-section",children:[e.jsx("div",{className:"subagent-settings-card-header",children:e.jsxs("div",{children:[e.jsx("span",{children:"Limits"}),e.jsx("small",{children:"Controls child worker concurrency."})]})}),e.jsxs("div",{className:"subagent-field-grid four",children:[e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Total concurrency"}),e.jsx("input",{type:"number",min:1,max:32,value:d,disabled:u||!s,onChange:S=>P(xs(S.target.value,1))})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Per provider"}),e.jsx("input",{type:"number",min:1,max:32,value:c??"",placeholder:"No cap",disabled:u||!s,onChange:S=>A(ns(S.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:o??"",placeholder:"No cap",disabled:u||!s,onChange:S=>D(ns(S.target.value))})]})]})]})]})})}const wn=[{value:"none",label:"Direct workspace"},{value:"copy_on_write",label:"Copy-on-write"},{value:"worktree",label:"Worktree"}],Sn=[{value:"read_only",label:"Read only"},{value:"workspace_write",label:"Workspace write"},{value:"full_tools",label:"Full tools"}],Cn=[{value:"parent_scoped",label:"Parent-scoped handoffs"},{value:"disabled",label:"Disabled"}];function Gs(s,a){const t=a.trim();return!t||s.some(n=>n.value===t)?s:[{value:t,label:t},...s]}function Re(s,a){return JSON.stringify([s,a])}function kn(s,a,t){const n=[];for(const l of s){const i=Gs(Te(l.value,a),l.value===t.providerId?t.modelId:"");for(const d of i)n.push({value:Re(l.value,d.value),label:`${l.label} / ${d.label}`,providerId:l.value,modelId:d.value})}return t.modelId&&!n.some(l=>l.value===Re(t.providerId,t.modelId))&&n.unshift({value:Re(t.providerId,t.modelId),label:`${De(t.providerId,a)} / ${t.modelId}`,providerId:t.providerId,modelId:t.modelId}),n}function ns(s){const a=s.trim();if(!a)return null;const t=Number(a);return Number.isFinite(t)?t:null}function xs(s,a){return ns(s)??a}function Pn(s,a){const t=a.subagents;return s.enabled===t.enabled&&s.delegationMode===t.delegationMode&&Rn(s.defaultModelRef,t.defaultModelRef)&&s.maxConcurrentRuns===t.maxConcurrentRuns&&s.maxConcurrentRunsPerProvider===t.maxConcurrentRunsPerProvider&&s.maxConcurrentRunsPerWorkspaceTarget===t.maxConcurrentRunsPerWorkspaceTarget&&JSON.stringify(s.roles)===JSON.stringify(t.roles)}function Rn(s,a){return(s?.providerId??null)===(a?.providerId??null)&&(s?.modelId??null)===(a?.modelId??null)}const An=[{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 Dn({currentUserId:s,enabled:a,mode:t,threads:n,onModeChange:l,onThreadMuteChange:i}){const[d,c]=r.useState(null),[o,j]=r.useState(null);ls(o);const g=r.useMemo(()=>n.filter(m=>m.archivedAt===null).map(m=>({thread:m,label:In(m,s)})).sort((m,f)=>{const v=+!!f.thread.mutedAt-+!!m.thread.mutedAt;return v!==0?v:m.label.localeCompare(f.label)}),[s,n]),u=g.filter(({thread:m})=>!!m.mutedAt).length,h=r.useCallback(async m=>{c(m.id),j(null),await i(m.id,!m.mutedAt)||j("Could not update this conversation. Try again."),c(null)},[i]);return e.jsxs("section",{className:"account-settings notifications-settings",children:[e.jsx("h1",{children:"Notifications"}),e.jsxs("div",{className:"account-list notification-settings-card",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Team chat notifications"}),e.jsx("small",{children:"In-app alerts"})]}),e.jsx("div",{className:"notification-mode-list",role:"radiogroup","aria-label":"Notify me about",children:An.map(m=>e.jsxs("label",{className:`notification-mode-option${t===m.mode?" selected":""}`,children:[e.jsx("input",{type:"radio",name:"team-chat-notification-mode",checked:t===m.mode,onChange:()=>l(m.mode)}),e.jsxs("span",{children:[e.jsx("strong",{children:m.label}),e.jsx("small",{children:m.detail})]})]},m.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:u===1?"1 muted":`${u} muted`})]}),a?g.length===0?e.jsx("div",{className:"empty-account-list",children:e.jsx("span",{children:"Open a Team Chat conversation to manage it here."})}):g.map(({thread:m,label:f})=>{const v=!!m.mutedAt,y=d===m.id;return e.jsxs("div",{className:"notification-thread-row",children:[e.jsx("span",{className:`notification-thread-icon${v?" muted":""}`,children:v?e.jsx(Ba,{size:15}):e.jsx(_s,{size:15})}),e.jsxs("span",{className:"notification-thread-copy",children:[e.jsx("strong",{children:f}),e.jsx("small",{children:v?"Muted":"Uses the team chat setting"})]}),e.jsx("button",{type:"button",className:"settings-secondary",disabled:d!==null,onClick:()=>{h(m)},children:y?"Saving":v?"Unmute":"Mute"})]},m.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 In(s,a){return s.kind==="general"||s.kind==="channel"?`#${s.title?.trim()||"general"}`:s.kind==="dm"?s.participants.find(t=>t.userId!==a)?.name??s.title?.trim()??"Direct message":s.title?.trim()||s.participants.filter(t=>t.userId!==a).map(t=>t.name).join(", ")||"Group conversation"}function $n({canSaveCurrentTemplate:s,personalizationTemplateId:a,personalizationTemplateOptions:t,saveAsNewOpen:n,saving:l,selectedPersonalizationTemplate:i,selectedTemplateIsCustom:d,soulDraft:c,templateNameDraft:o,changePersonalizationTemplate:j,changeSoulDraft:g,openSaveAsNew:u,resetPersonalizationDraft:h,savePersonalization:m,setSaveAsNewOpen:f,setTemplateNameDraft:v}){function y(C){C.preventDefault(),m(n)}return e.jsxs("section",{className:"account-settings",children:[e.jsx("h1",{children:"Personalization"}),e.jsxs("form",{className:"provider-settings-form personalization-form",onSubmit:y,children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Agent style"}),e.jsx("div",{className:"settings-heading-actions",children:n?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"settings-heading-input",value:o,onChange:C=>v(C.target.value),placeholder:"Name","aria-label":"Template name"}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Cancel","aria-label":"Cancel",disabled:l,onClick:()=>f(!1),children:e.jsx(le,{size:15})}),e.jsx("button",{type:"button",className:"settings-icon-button primary",title:"Save new template","aria-label":"Save new template",disabled:l||!c.trim()||!o.trim(),onClick:()=>{m(!0)},children:e.jsx(Ms,{size:15})})]}):e.jsxs(e.Fragment,{children:[e.jsx("small",{children:d?"Custom template":"Built-in template"}),e.jsx("button",{type:"button",className:"settings-icon-button",title:"Save as new","aria-label":"Save as new",disabled:l||!i||!c.trim(),onClick:u,children:e.jsx(me,{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(we,{value:a,disabled:l||t.length===0,label:"Personalization template",options:t,onChange:C=>{j(C)}})]})}),e.jsxs("label",{className:"settings-select-field personalization-editor",children:[e.jsx("span",{children:"SOUL.md"}),e.jsx("textarea",{value:c,onChange:C=>g(C.target.value),spellCheck:!1})]}),e.jsxs("div",{className:"settings-button-row",children:[e.jsx("button",{type:"button",className:"settings-icon-button",title:"Reset to template","aria-label":"Reset to template",disabled:l||!i,onClick:h,children:e.jsx($e,{size:15})}),d&&e.jsx("button",{className:"settings-icon-button primary",title:"Save template","aria-label":"Save template",disabled:l||!s,children:e.jsx(is,{size:15})})]})]})]})}function En({connection:s,profile:a,selectedDefaultTeamId:t}){const n=Fa(s),l=Tn(n.schedules);return ls(n.error,{prefix:"Local schedules"}),e.jsxs("div",{className:"account-list profile-agent-list","aria-label":"Profile agents",children:[e.jsx("div",{className:"account-list-heading profile-agent-list-heading",children:e.jsx("span",{children:"Agents"})}),e.jsx("div",{className:"profile-table-frame",children:e.jsxs("table",{className:"profile-data-table profile-agent-table","aria-label":"Profile agents table",children:[e.jsxs("colgroup",{children:[e.jsx("col",{className:"profile-agent-column"}),e.jsx("col",{className:"profile-action-column"}),e.jsx("col",{className:"profile-check-column"}),e.jsx("col",{className:"profile-sync-column"})]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Agent"}),e.jsx("th",{scope:"col",children:"Action"}),e.jsx("th",{scope:"col",children:"Check"}),e.jsx("th",{scope:"col",children:"Sync"})]})}),e.jsxs("tbody",{children:[l.active.map(i=>e.jsx(js,{pending:n.pendingScheduleIds.has(i.id),schedule:i,refreshing:n.loading,onRefresh:()=>{n.refresh()},onRun:()=>{n.run(i)},onToggle:()=>{n.toggle(i)}},i.id)),e.jsx(Mn,{}),a.agents.map(i=>e.jsx(On,{agent:i,defaultAction:a.summary.defaultAction,profile:a,selectedDefaultTeamId:t},i.id)),l.paused.map(i=>e.jsx(js,{pending:n.pendingScheduleIds.has(i.id),schedule:i,refreshing:n.loading,onRefresh:()=>{n.refresh()},onRun:()=>{n.run(i)},onToggle:()=>{n.toggle(i)}},i.id))]})]})})]})}function Mn(){return e.jsxs("tr",{className:"profile-agent-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(Le,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:"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(Se,{status:{state:"ready",label:"Ready"}})}),e.jsx("td",{children:e.jsx(Se,{status:{state:"ready",label:"Built in"}})})]})}function On({agent:s,defaultAction:a,profile:t,selectedDefaultTeamId:n}){const l=zn(t,s,n);return e.jsxs("tr",{className:"profile-agent-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(Le,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children: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:a??"None"})})}),e.jsx("td",{children:e.jsx(Se,{status:l.check})}),e.jsx("td",{children:e.jsx(Se,{status:l.sync})})]})}function js({pending:s,refreshing:a,schedule:t,onRefresh:n,onRun:l,onToggle:i}){const d=Ln(t),c=t.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(Le,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:t.localProjectName}),e.jsxs("span",{title:t.scheduleName,children:["schedule: ",t.scheduleName]})]})]})}),e.jsx("td",{children:e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{title:t.targetAction,children:t.targetAction})})}),e.jsx("td",{children:e.jsx(Se,{status:d})}),e.jsx("td",{children:e.jsxs("div",{className:"profile-schedule-actions",children:[e.jsx("span",{className:"profile-schedule-expression",title:Un(t),children:t.enabled?t.scheduleExpression:"Paused"}),e.jsxs("div",{className:"profile-schedule-controls","aria-label":`${t.scheduleName} schedule controls`,children:[e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:a,type:"button",title:"Refresh local schedules","aria-label":"Refresh local schedules",onClick:n,children:e.jsx(ne,{size:14,className:a?"settings-spin":void 0})}),e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:s,type:"button",title:"Run now","aria-label":`Run ${t.scheduleName} now`,onClick:l,children:e.jsx($e,{size:14})}),e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:s,type:"button",title:c,"aria-label":`${c}: ${t.scheduleName}`,onClick:i,children:t.enabled?e.jsx(Ls,{size:14}):e.jsx(Bs,{size:14})})]})]})})]})}function Se({status:s}){return e.jsx("span",{className:`profile-status-text ${s.state}`,children:s.label})}function Tn(s){const a=[],t=[];for(const n of s)n.enabled?a.push(n):t.push(n);return a.sort((n,l)=>bs(n)-bs(l)),{active:a,paused:t}}function bs(s){return s.lastRunStatus==="running"?0:s.lastRunStatus==="queued"?1:2}function Ln(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 Un(s){const a=[`${s.scheduleType}: ${s.scheduleExpression}`];return s.nextRunAt&&a.push(`next ${vs(s.nextRunAt)}`),s.lastRunAt&&a.push(`last ${vs(s.lastRunAt)}`),a.join(" - ")}function vs(s){const a=new Date(s);return Number.isFinite(a.getTime())?a.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):s}function zn(s,a,t){if(!a.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||_n(s,a)>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(Bn(s,t))return{check:{state:"ready",label:"Passed"},sync:{state:"warning",label:"Sync acct"}};const n=s.summary.localHead??s.git?.head??null,l=s.hosted?.lastPushedLocalHead??null;return!(s.summary.hostedHead??s.hosted?.sourceCommitSha??null)&&!l?{check:{state:"ready",label:"Passed"},sync:{state:"loading",label:"Not synced"}}:n&&l&&n!==l?{check:{state:"ready",label:"Passed"},sync:{state:"loading",label:"Needed"}}:{check:{state:"ready",label:"Passed"},sync:{state:"ready",label:"Synced"}}}function Bn(s,a){const t=s.hosted?.teamId?.trim()??"";return!!(t&&a&&t!==a)}function _n(s,a){let t=0;s.diff.changedAgents.includes(a.id)&&(t+=1),s.diff.newAgents.includes(a.id)&&(t+=1),s.diff.deletedAgents.includes(a.id)&&(t+=1);const n=a.path.replace(/^profiles\/[^/]+\//,"");for(const l of s.diff.files){const i=l.path.replace(/^profiles\/[^/]+\//,"");(i===n||i.startsWith(`${n}/`)||i.startsWith(`agents/${a.id}/`))&&(t+=1)}return t}function Hn({actions:s,busy:a,library:t,onSelect:n}){const l=t.profiles.find(d=>Ye(d.ref,t.lastUsed))??t.profiles[0]??null,i=l?Be(l.ref):"";return e.jsxs("div",{className:"profile-selector-bar",children:[e.jsxs("label",{className:"profile-selector-control",children:[e.jsx("select",{"aria-label":"Active profile",disabled:a||t.profiles.length===0,value:i,onChange:d=>{const c=ba(t,d.currentTarget.value),o=t.profiles.find(j=>Ye(j.ref,c));o&&n(o)},children:t.profiles.length?t.profiles.map(d=>e.jsx("option",{value:Be(d.ref),children:d.name},Be(d.ref))):e.jsx("option",{value:"",children:"No profiles"})}),e.jsx(va,{"aria-hidden":"true",size:14})]}),s]})}function Fn({addDisabled:s,commitDisabled:a,commitLabel:t,refreshDisabled:n,repoDisabled:l,syncDisabled:i,syncLabel:d,syncStatus:c,onAdd:o,onCommit:j,onRefresh:g,onRepo:u,onSync:h}){const[m,f]=r.useState(!1),v=r.useRef(null);r.useEffect(()=>{if(!m)return;function C(A){v.current?.contains(A.target)||f(!1)}function P(A){A.key==="Escape"&&f(!1)}return document.addEventListener("pointerdown",C),document.addEventListener("keydown",P),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",P)}},[m]);function y(C){f(!1),C()}return e.jsx("div",{className:"profile-selector-actions",children:e.jsxs("div",{className:"profile-settings-menu-root",ref:v,children:[e.jsx("button",{"aria-expanded":m,"aria-haspopup":"menu","aria-label":"Profile settings",className:"settings-icon-button ghost profile-settings-menu-trigger",type:"button",onClick:()=>f(C=>!C),children:e.jsx(ya,{size:15})}),m?e.jsxs("div",{className:"profile-settings-menu",role:"menu",children:[e.jsxs("button",{disabled:a,role:"menuitem",type:"button",onClick:()=>y(j),children:[e.jsx(Ee,{size:14}),e.jsx("span",{children:t})]}),e.jsxs("button",{disabled:i,role:"menuitem",type:"button",onClick:()=>y(h),children:[e.jsx(pe,{size:14}),e.jsxs("span",{children:[e.jsx("strong",{children:d}),c?e.jsx("small",{children:c}):null]})]}),e.jsxs("button",{disabled:l,role:"menuitem",type:"button",onClick:()=>y(u),children:[e.jsx(Ce,{size:14}),e.jsx("span",{children:"Repository"})]}),e.jsx("div",{className:"profile-settings-menu-separator",role:"separator"}),e.jsxs("button",{disabled:n,role:"menuitem",type:"button",onClick:()=>y(g),children:[e.jsx(ne,{size:14}),e.jsx("span",{children:"Refresh profiles"})]}),e.jsxs("button",{disabled:s,role:"menuitem",type:"button",onClick:()=>y(o),children:[e.jsx(me,{size:14}),e.jsx("span",{children:"Add profile"})]})]}):null]})})}const Gn=[{id:"actions",label:"Actions",detail:"Profile-level reusable actions"},{id:"prompts",label:"Prompts",detail:"Shared prompt files"},{id:"goals",label:"Goals",detail:"Goal definitions; never started automatically"},{id:"evals",label:"Evals",detail:"Evaluation definitions and fixtures"},{id:"examples",label:"Examples",detail:"Example inputs and usage"},{id:"tasksets",label:"Tasksets",detail:"Training and evaluation tasksets"},{id:"extensions",label:"Extension declarations",detail:"Third-party extension metadata"}];function qn({connection:s,entry:a,onClose:t,onPublished:n}){const[l,i]=r.useState("github"),[d,c]=r.useState(""),[o,j]=r.useState(`${a.name}-profile`),[g,u]=r.useState("public"),[h,m]=r.useState(()=>a.state.agents.filter(x=>x.enabled).map(x=>x.id)),[f,v]=r.useState(()=>a.state.skills.filter(x=>x.enabled).map(x=>x.name)),[y,C]=r.useState([]),[P,A]=r.useState(null),[D,b]=r.useState(null),[I,k]=r.useState(null),U=r.useMemo(()=>({ref:a.ref,selection:{agentIds:h,skillNames:f,optionalContent:y},target:{provider:l,owner:d.trim()||null,repository:o.trim(),visibility:l==="github"?"public":g}}),[h,a.ref,y,d,l,o,f,g]);function p(x,M,T){return T?[...new Set([...x,M])]:x.filter(q=>q!==M)}async function w(x){if(x.preventDefault(),!(!o.trim()||D)){b("preview"),k(null);try{A(await E.profilePublicationPreview(s,U))}catch(M){k(M instanceof Error?M.message:String(M))}finally{b(null)}}}async function N(){if(!(!P||P.blockedReasons.length>0||D)){b("publish"),k(null);try{const x=await E.profilePublicationPublish(s,{...U,expectedSourceHash:P.sourceHash,confirmed:!0});n(`Published ${a.name} to ${x.owner}/${x.repository}`),t()}catch(x){k(x instanceof Error?x.message:String(x))}finally{b(null)}}}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:t,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:!!D,type:"button","aria-label":"Close",onClick:t,children:e.jsx(le,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(pe,{size:18})}),e.jsxs("h2",{id:"profile-publication-title",children:["Publish ",a.name]}),e.jsx("p",{children:"Choose the exact Agents, Skills, and optional files to share. OpenPond will show the complete file list before it pushes anything."}),P?e.jsx(Wn,{preview:P}):e.jsxs(e.Fragment,{children:[e.jsxs("fieldset",{className:"profile-publication-fieldset",children:[e.jsx("legend",{children:"Destination"}),e.jsxs("label",{className:"profile-publication-provider",children:[e.jsx("input",{type:"radio",checked:l==="github",onChange:()=>{i("github"),u("public")}}),e.jsx(Qe,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:"GitHub"}),e.jsx("small",{children:"Published publicly with your signed-in gh CLI"})]})]}),e.jsxs("label",{className:"profile-publication-provider",children:[e.jsx("input",{type:"radio",checked:l==="openpond_git",onChange:()=>{i("openpond_git"),u("private")}}),e.jsx(Na,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:"OpenPond Git"}),e.jsx("small",{children:"Private by default; uses the same repository format"})]})]})]}),e.jsxs("div",{className:"profile-publication-target-fields",children:[l==="github"?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"GitHub owner (optional)"}),e.jsx("input",{value:d,placeholder:"Uses gh account",onChange:x=>c(x.currentTarget.value)})]}):null,e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Repository"}),e.jsx("input",{value:o,onChange:x=>j(x.currentTarget.value)})]}),l==="openpond_git"?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Visibility"}),e.jsxs("select",{value:g,onChange:x=>u(x.currentTarget.value),children:[e.jsx("option",{value:"private",children:"Private"}),e.jsx("option",{value:"public",children:"Public"})]})]}):null]}),e.jsx(qe,{title:"Agents",empty:"No Agents in this Profile",children:a.state.agents.map(x=>e.jsx(We,{checked:h.includes(x.id),label:x.name,detail:x.path,onChange:M=>m(T=>p(T,x.id,M))},x.id))}),e.jsx(qe,{title:"Skills",empty:"No Skills in this Profile",children:a.state.skills.map(x=>e.jsx(We,{checked:f.includes(x.name),label:x.name,detail:x.description||x.path,onChange:M=>v(T=>p(T,x.name,M))},x.name))}),e.jsx(qe,{title:"Optional content",empty:"",children:Gn.map(x=>e.jsx(We,{checked:y.includes(x.id),label:x.label,detail:x.detail,onChange:M=>C(T=>p(T,x.id,M))},x.id))})]}),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:!!D,type:"button",onClick:P?()=>A(null):t,children:P?"Back":"Cancel"}),P?e.jsxs("button",{className:"git-dialog-primary",disabled:!!D||P.blockedReasons.length>0,type:"button",onClick:()=>{N()},children:[e.jsx(pe,{size:14}),e.jsx("span",{children:D==="publish"?"Publishing":P.replacesExisting?"Confirm and replace":"Confirm and publish"})]}):e.jsx("button",{className:"git-dialog-primary",disabled:!!D||!o.trim(),type:"submit",children:D==="preview"?"Building preview":"Review exact files"})]})]})})}function qe({title:s,empty:a,children:t}){const n=Array.isArray(t)?t.length:t?1:0;return e.jsxs("fieldset",{className:"profile-publication-fieldset",children:[e.jsx("legend",{children:s}),n?t:e.jsx("span",{className:"profile-publication-empty",children:a})]})}function We({checked:s,label:a,detail:t,onChange:n}){return e.jsxs("label",{className:"profile-publication-selection",children:[e.jsx("input",{type:"checkbox",checked:s,onChange:l=>n(l.currentTarget.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:a}),e.jsx("small",{children:t})]})]})}function Wn({preview:s}){const a=s.files.reduce((t,n)=>t+n.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 · ",ys(a)]}),e.jsx("span",{children:s.sourceRevision?.slice(0,10)??"No source revision"})]}),s.blockedReasons.map(t=>e.jsx("div",{className:"profile-dialog-warning",children:t},t)),s.warnings.map(t=>e.jsx("div",{className:"profile-publication-warning",children:t},t)),e.jsx("div",{className:"profile-publication-file-list","aria-label":"Exact files to publish",children:s.files.map(t=>e.jsxs("div",{children:[e.jsx("span",{title:t.path,children:t.path}),e.jsxs("small",{children:[t.category," · ",ys(t.sizeBytes)]})]},t.path))}),s.excludedFiles.length?e.jsxs("details",{children:[e.jsxs("summary",{children:[s.excludedFiles.length," excluded sensitive/runtime files"]}),s.excludedFiles.map(t=>e.jsx("code",{children:t},t))]}):null]})}function ys(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Vn({section:s="all",catalogPresentation:a="list",payload:t,connection:n,onPayload:l,onError:i,onToast:d,onSkillCommand:c,overviewContent:o}){const[j,g]=r.useState(""),[u,h]=r.useState(null),[m,f]=r.useState(!1),[v,y]=r.useState(null),[C,P]=r.useState(null),A=t?.profile??null,D=t?.preferences.defaultTeamId?.trim()||"",b=s==="all"||s==="profile"||s==="controls",I=s==="all"||s==="profile",k=s==="all"||s==="agents",U=s==="all"||s==="profile";async function p(O){n&&(l(await E.bootstrap(n)),d?.(O,"success"))}async function w(O,Q){if(!(!n||u)){h(O),i(null);try{await Q()}catch(J){i(J instanceof Error?J.message:String(J))}finally{h(null)}}}function N(){w("init",async()=>{await E.profileInit(n,{}),await p("Profile initialized")})}function x(){w("commit",async()=>{await E.profileCommit(n,{message:j.trim()||null}),g(""),await p("Profile commit complete")})}function M(){w("push",async()=>{if(!D)throw new Error("Select a default team before syncing a hosted profile.");await E.profileCheck(n,{kind:"all"}),await E.profilePush(n,{teamId:D,ensureHosted:!0,message:null}),await p("Profile synced to hosted profile repo")})}function T(O){w(`select:${O.ref.profileId}`,async()=>{await E.profileSelect(n,O.ref),await p(`Using ${O.name}`)})}function q(O){w("add",async()=>{O.source==="blank"?await E.profileInit(n,{path:O.path,profile:O.profile,template:"blank-profile"}):O.source==="local"?await E.profileLoad(n,O):await E.profileInstall(n,O),f(!1),await p(O.source==="blank"?`${O.profile} created`:"Profile added")})}function V(O){w("update",async()=>{await E.profileUpdate(n,O.ref),await p(`${O.name} updated`)})}function R(O){w("remove",async()=>{await E.profileRemove(n,O.ref),y(null),await p("Profile removed from this device")})}function S(){w("refresh",async()=>{await p("Profiles refreshed")})}return e.jsxs("section",{className:"account-settings profile-settings",children:[A?.mode==="local"?e.jsxs(e.Fragment,{children:[b?e.jsxs(e.Fragment,{children:[I&&a==="select"?e.jsx(Hn,{actions:e.jsx(Ns,{connection:n,onAdd:()=>f(!0),onRefresh:S,presentation:"menu",profile:A,profileBusy:u,profileCommitMessage:j,selectedDefaultTeamId:D,syncDisabledReason:ws(A,D),setProfileCommitMessage:g,submitProfileCommit:x,submitProfilePush:M}),busy:!!u,library:t?.profileLibrary??{lastUsed:null,profiles:[]},onSelect:T}):e.jsxs(e.Fragment,{children:[I?e.jsx(Kn,{busy:!!u,library:t?.profileLibrary??{lastUsed:null,profiles:[]},onAdd:()=>f(!0),onRefresh:S,onRemove:y,onPublish:P,onUpdate:V,onSelect:T}):null,e.jsx(Ns,{connection:n,profile:A,profileBusy:u,profileCommitMessage:j,selectedDefaultTeamId:D,syncDisabledReason:ws(A,D),setProfileCommitMessage:g,submitProfileCommit:x,submitProfilePush:M})]}),o]}):null,k?e.jsx(En,{connection:n,profile:A,selectedDefaultTeamId:D}):null,U?e.jsx(et,{onSkillCommand:c,profile:A}):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:!n||!!u,type:"button",onClick:()=>f(!0),children:[e.jsx(me,{size:14}),e.jsx("span",{children:"Create or add Profile"})]}),e.jsxs("button",{className:"settings-secondary",disabled:!n||!!u,type:"button",onClick:N,children:[e.jsx(me,{size:14}),e.jsx("span",{children:u==="init"?"Creating":"Create starter Profile"})]})]})]}),m?e.jsx(Jn,{busy:!!u,onClose:()=>f(!1),onSubmit:q}):null,v?e.jsx(Yn,{busy:!!u,entry:v,onClose:()=>y(null),onConfirm:()=>R(v)}):null,C&&n?e.jsx(qn,{connection:n,entry:C,onClose:()=>P(null),onPublished:O=>d?.(O,"success")}):null]})}function Kn({busy:s,library:a,onAdd:t,onRefresh:n,onRemove:l,onPublish:i,onSelect:d,onUpdate:c}){return e.jsxs("div",{className:"account-list profile-catalog-list",children:[e.jsxs("div",{className:"account-list-heading profile-agent-list-heading",children:[e.jsx("span",{children:"Profiles"}),e.jsxs("div",{className:"profile-skill-heading-actions",children:[e.jsxs("small",{children:[a.profiles.length," installed"]}),e.jsxs("button",{className:"settings-secondary",disabled:s,type:"button",onClick:n,children:[e.jsx(ne,{size:14}),e.jsx("span",{children:"Refresh"})]}),e.jsxs("button",{className:"settings-secondary",disabled:s,type:"button",onClick:t,children:[e.jsx(me,{size:14}),e.jsx("span",{children:"Add"})]})]})]}),a.profiles.map(o=>{const j=Ye(o.ref,a.lastUsed);return e.jsxs("div",{className:`product-row profile-catalog-row ${j?"selected":""}`,role:"button",tabIndex:s?-1:0,"aria-disabled":s,onClick:()=>{s||d(o)},onKeyDown:g=>{s||g.key!=="Enter"&&g.key!==" "||(g.preventDefault(),d(o))},children:[e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(Ce,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:o.name}),e.jsx("span",{title:o.repoPath,children:o.repoPath})]})]}),e.jsx(qs,{status:{state:o.state.error?"warning":"ready",label:o.state.error?"error":j?"current":"ready"}}),e.jsx("span",{className:"profile-catalog-source",children:o.ref.source.replace("_"," ")}),e.jsx("span",{className:"profile-catalog-summary",children:o.state.summary.message}),e.jsxs("span",{className:"profile-catalog-actions",children:[o.ref.source!=="local"?e.jsxs("span",{className:"settings-secondary compact",role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),c(o)},onKeyDown:g=>{g.key!=="Enter"&&g.key!==" "||(g.preventDefault(),g.stopPropagation(),c(o))},children:[e.jsx(ne,{size:14}),e.jsx("span",{children:"Update"})]}):null,e.jsxs("span",{className:"settings-secondary compact",role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),i(o)},onKeyDown:g=>{g.key!=="Enter"&&g.key!==" "||(g.preventDefault(),g.stopPropagation(),i(o))},children:[e.jsx(pe,{size:14}),e.jsx("span",{children:"Publish"})]}),e.jsxs("span",{className:"settings-secondary compact profile-remove-button",role:"button",tabIndex:0,"aria-label":`Remove ${o.name}`,onClick:g=>{g.stopPropagation(),l(o)},onKeyDown:g=>{g.key!=="Enter"&&g.key!==" "||(g.preventDefault(),g.stopPropagation(),l(o))},children:[e.jsx(be,{size:14}),e.jsx("span",{children:"Remove"})]})]})]},`${o.ref.source}:${o.ref.repositoryId}:${o.ref.profileId}`)})]})}function Jn({busy:s,onClose:a,onSubmit:t}){const[n,l]=r.useState("blank"),[i,d]=r.useState(""),[c,o]=r.useState(""),[j,g]=r.useState("");function u(h){if(h.preventDefault(),s)return;if(n==="blank"){const f=j.trim();if(!f)return;t({source:n,path:i.trim()||null,profile:f});return}if(n==="local"){const f=i.trim();if(!f)return;t({source:n,path:f,profile:j.trim()||null});return}const m=c.trim();m&&t({source:n,repositoryId:m,profile:j.trim()||null})}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:a,children:e.jsxs("form",{className:"git-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"add-profile-title",onMouseDown:h=>h.stopPropagation(),onSubmit:u,children:[e.jsx("button",{className:"git-dialog-close",disabled:s,type:"button","aria-label":"Close",onClick:a,children:e.jsx(le,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(Ce,{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:n==="blank",onChange:()=>l("blank")}),"New blank"]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:n==="local",onChange:()=>l("local")}),"Local"]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:n==="github",onChange:()=>l("github")}),"GitHub"]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:n==="openpond_git",onChange:()=>l("openpond_git")}),"OpenPond Git"]})]}),n==="blank"?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Repository path (optional)"}),e.jsx("input",{disabled:s,value:i,placeholder:"Uses the default local Profile repository",onChange:h=>d(h.currentTarget.value)})]}):n==="local"?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Repository path"}),e.jsx("input",{autoFocus:!0,disabled:s,value:i,placeholder:"/path/to/profile-repo",onChange:h=>d(h.currentTarget.value)})]}):e.jsxs("label",{className:"git-dialog-field",children:[e.jsxs("span",{children:[n==="github"?"GitHub":"OpenPond Git"," repository"]}),e.jsx("input",{autoFocus:!0,disabled:s,value:c,placeholder:"owner/repository",onChange:h=>o(h.currentTarget.value)})]}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:n==="blank"?"Profile name":"Profile name (optional)"}),e.jsx("input",{autoFocus:n==="blank",disabled:s,value:j,placeholder:n==="blank"?"research":"Uses repository default",onChange:h=>g(h.currentTarget.value)})]}),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",disabled:s||!(n==="blank"?j:n==="local"?i:c).trim(),type:"submit",children:n==="blank"?"Create Profile":"Add Profile"})]})]})})}function Yn({busy:s,entry:a,onClose:t,onConfirm:n}){return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:t,children:e.jsxs("div",{className:"git-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"remove-profile-title",onMouseDown:l=>l.stopPropagation(),children:[e.jsx("button",{className:"git-dialog-close",disabled:s,type:"button","aria-label":"Close",onClick:t,children:e.jsx(le,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(be,{size:18})}),e.jsxs("h2",{id:"remove-profile-title",children:["Remove ",a.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:a.name}),e.jsx("span",{children:a.repoPath})]}),e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:s,type:"button",onClick:t,children:"Cancel"}),e.jsx("button",{className:"git-dialog-primary danger",disabled:s,type:"button",onClick:n,children:"Remove"})]})]})})}function Ns({connection:s,onAdd:a,onRefresh:t,presentation:n="toolbar",profile:l,profileBusy:i,profileCommitMessage:d,selectedDefaultTeamId:c,syncDisabledReason:o,setProfileCommitMessage:j,submitProfileCommit:g,submitProfilePush:u}){const[h,m]=r.useState(!1),[f,v]=r.useState(!1),[y,C]=r.useState(!1),P=!s||!!i;return e.jsxs(e.Fragment,{children:[n==="menu"&&a&&t?e.jsx(Fn,{addDisabled:!!i,commitDisabled:P,commitLabel:i==="commit"?"Committing":"Commit",refreshDisabled:P,repoDisabled:!!i||!l,syncDisabled:P||!l,syncLabel:i==="push"?"Syncing":"Sync",syncStatus:l?Ve(l,c):null,onAdd:a,onCommit:()=>v(!0),onRefresh:t,onRepo:()=>m(!0),onSync:()=>C(!0)}):e.jsx("div",{className:"profile-control-panel",children:e.jsxs("div",{className:"profile-control-toolbar",children:[e.jsxs("div",{className:"profile-control-actions",children:[e.jsxs("button",{className:"settings-secondary",disabled:P,type:"button",onClick:()=>v(!0),children:[e.jsx(Ee,{size:14}),e.jsx("span",{children:i==="commit"?"Committing":"Commit"})]}),e.jsxs("button",{className:"settings-secondary",disabled:P||!l,type:"button",onClick:()=>C(!0),children:[e.jsx(pe,{size:14}),e.jsx("span",{children:i==="push"?"Syncing":"Sync"})]}),e.jsxs("button",{className:"settings-secondary",disabled:!!i||!l,type:"button",onClick:()=>m(!0),children:[e.jsx(Ce,{size:14}),e.jsx("span",{children:"Repo"})]}),l?e.jsxs("span",{className:"profile-hosted-status",title:`Profile sync status: ${Ve(l,c)}`,children:[e.jsx(pe,{size:14}),e.jsx("span",{children:"Profile sync"}),e.jsx("strong",{children:Ve(l,c)})]}):null]}),l?e.jsx("span",{className:`profile-local-status ${l.summary.state}`,title:l.summary.message,children:l.summary.message}):null]})}),h&&l?e.jsx(Xn,{profile:l,profileBusy:i,onClose:()=>m(!1)}):null,f?e.jsx(Qn,{disabled:P,profileBusy:i,profileCommitMessage:d,setProfileCommitMessage:j,submitProfileCommit:g,onClose:()=>v(!1)}):null,y&&l?e.jsx(Zn,{disabled:P,profile:l,profileBusy:i,selectedDefaultTeamId:c,syncDisabledReason:o,submitProfilePush:u,onClose:()=>C(!1)}):null]})}function Qn({disabled:s,profileBusy:a,profileCommitMessage:t,setProfileCommitMessage:n,submitProfileCommit:l,onClose:i}){function d(c){c.preventDefault(),!s&&(l(),i())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:i,children:e.jsxs("form",{className:"git-dialog profile-commit-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-commit-dialog-title",onMouseDown:c=>c.stopPropagation(),onSubmit:d,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!a,type:"button",title:"Close","aria-label":"Close",onClick:i,children:e.jsx(le,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(Ee,{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:t,disabled:!!a,placeholder:"Update OpenPond profile",onChange:c=>n(c.target.value)})]}),e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:!!a,type:"button",onClick:i,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:s,type:"submit",children:[e.jsx(Ee,{size:14}),e.jsx("span",{children:a==="commit"?"Committing":"Commit"})]})]})]})})}function Zn({disabled:s,profile:a,profileBusy:t,selectedDefaultTeamId:n,syncDisabledReason:l,submitProfilePush:i,onClose:d}){const c=at(a,n),o=c.reduce((u,h)=>u+h.count,0),j=!s&&!l;function g(u){u.preventDefault(),j&&(i(),d())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:d,children:e.jsxs("form",{className:"git-dialog profile-sync-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-sync-dialog-title",onMouseDown:u=>u.stopPropagation(),onSubmit:g,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!t,type:"button",title:"Close","aria-label":"Close",onClick:d,children:e.jsx(le,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(pe,{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:[o," ",o===1?"item":"items"," out of sync"]}),e.jsxs("span",{children:["Local ",ve(a.summary.localHead??a.git?.head)," - Last pushed"," ",ve(a.hosted?.lastPushedLocalHead)]})]}),c.length?e.jsx("div",{className:"profile-dialog-diff-list","aria-label":"Profile sync differences",children:c.map(u=>e.jsxs("div",{className:`profile-dialog-diff-row ${u.tone??""}`,children:[e.jsx("strong",{children:u.label}),e.jsx("span",{children:u.detail})]},u.label))}):e.jsx("div",{className:"profile-dialog-diff-list","aria-label":"Profile sync differences",children:e.jsxs("div",{className:"profile-dialog-diff-row",children:[e.jsx("strong",{children:"Aligned"}),e.jsx("span",{children:"Current local profile source has already been pushed."})]})}),l?e.jsx("div",{className:"profile-dialog-warning",children:l}):null,e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:!!t,type:"button",onClick:d,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:!j,type:"submit",children:[e.jsx(pe,{size:14}),e.jsx("span",{children:t==="push"?"Syncing":"Confirm sync"})]})]})]})})}function Xn({profile:s,profileBusy:a,onClose:t}){return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:t,children:e.jsxs("div",{className:"git-dialog profile-path-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-path-dialog-title",onMouseDown:n=>n.stopPropagation(),children:[e.jsx("button",{className:"git-dialog-close",disabled:!!a,type:"button",title:"Close","aria-label":"Close",onClick:t,children:e.jsx(le,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(Ce,{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"," · ",ve(s.git?.head)]})]}),e.jsx("div",{className:"git-dialog-footer",children:e.jsx("button",{className:"git-dialog-secondary",disabled:!!a,type:"button",onClick:t,children:"Close"})})]})})}function et({onSkillCommand:s,profile:a}){const t=a.skills.slice().sort((i,d)=>i.name.localeCompare(d.name)),n=!s;function l(i){s?.(i)}return e.jsxs("div",{className:"account-list profile-skill-list",children:[e.jsxs("div",{className:"account-list-heading profile-agent-list-heading",children:[e.jsx("span",{children:"Skills"}),e.jsx("div",{className:"profile-skill-heading-actions",children:e.jsxs("small",{children:[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(i=>e.jsx(st,{commandDisabled:n,onSkillCommand:l,skill:i},i.name))})]})}):e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No profile skills found"}),e.jsx("span",{children:"Use /skill create to add reusable profile instructions."})]})]})}function st({commandDisabled:s,onSkillCommand:a,skill:t}){const n=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(Ie,{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(qs,{status:n})}),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:[e.jsx("button",{className:"settings-secondary compact",disabled:s||!t.enabled,type:"button",title:`Use ${t.name}`,onClick:()=>a(`$${t.name} `),children:e.jsx("span",{children:"Use"})}),e.jsx("button",{className:"settings-secondary compact",disabled:s,type:"button",title:`Edit ${t.name}`,onClick:()=>a(`/skill edit ${t.name} `),children:e.jsx("span",{children:"Edit"})})]})})]})}function qs({status:s}){return e.jsx("span",{className:`profile-status-text ${s.state}`,children:s.label})}function ve(s){return s?s.slice(0,10):"None"}function Ve(s,a){return Ws(s,a)?"Sync this account":s.hosted?.sourceCommitSha?`${s.hosted.promotionStatus??"uploaded"} ${ve(s.hosted.sourceCommitSha)}`:"Not pushed"}function ws(s,a){return a?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 at(s,a){const t=[],n=s.summary.localHead??s.git?.head??null,l=s.hosted?.lastPushedLocalHead??null,i=s.summary.hostedHead??s.hosted?.sourceCommitSha??null;if(Ws(s,a)&&t.push({label:"Account",detail:"Hosted profile metadata was synced under a different default team.",count:1,tone:"warning"}),!i&&!l?t.push({label:"Hosted source",detail:"No hosted profile commit has been recorded.",count:1}):n&&l&&n!==l&&t.push({label:"Commit",detail:`Local ${ve(n)} has not been pushed since ${ve(l)}.`,count:1}),s.git?.dirty){const c=s.git.files.length||s.diff.files.length||1;t.push({label:"Uncommitted files",detail:`${c} local ${c===1?"file":"files"} changed.`,count:c,tone:"warning"})}const d=s.diff.changedAgents.length+s.diff.newAgents.length+s.diff.deletedAgents.length+s.diff.changedSkills.length+s.diff.changedActions.length+s.diff.changedExtensions.length+s.diff.setupChanges.length+s.diff.envRequirementChanges.length;return d>0&&t.push({label:"Profile changes",detail:nt(s),count:d,tone:s.git?.dirty?"warning":void 0}),s.catalog.stale&&t.push({label:"Catalog",detail:"Action catalog artifacts are stale or missing.",count:1,tone:"warning"}),s.setupGate.blockingCount>0&&t.push({label:"Setup",detail:`${s.setupGate.blockingCount} blocking setup ${s.setupGate.blockingCount===1?"requirement":"requirements"}.`,count:s.setupGate.blockingCount,tone:"warning"}),t}function nt(s){const a=[],t=s.diff.changedAgents.length+s.diff.newAgents.length+s.diff.deletedAgents.length;return t&&a.push(`${t} agent ${t===1?"change":"changes"}`),s.diff.changedActions.length&&a.push(`${s.diff.changedActions.length} action ${s.diff.changedActions.length===1?"change":"changes"}`),s.diff.changedSkills.length&&a.push(`${s.diff.changedSkills.length} skill ${s.diff.changedSkills.length===1?"change":"changes"}`),s.diff.changedExtensions.length&&a.push(`${s.diff.changedExtensions.length} extension ${s.diff.changedExtensions.length===1?"change":"changes"}`),s.diff.setupChanges.length&&a.push(`${s.diff.setupChanges.length} setup ${s.diff.setupChanges.length===1?"change":"changes"}`),s.diff.envRequirementChanges.length&&a.push(`${s.diff.envRequirementChanges.length} env ${s.diff.envRequirementChanges.length===1?"change":"changes"}`),a.join(", ")||"Profile source has local changes."}function Ws(s,a){const t=s.hosted?.teamId?.trim()??"";return!!(t&&a&&t!==a)}const tt=[{value:"local_secret",label:"Saved key",description:"Encrypted on this machine"},{value:"env",label:"Environment variable",description:"Read by the local server"}],lt=120,it=new Set(["openai","xai","zai"]),rt=new Set(["chatgpt-subscription"]),ot="https://api.z.ai/api/coding/paas/v4";function Ss(s){return s.split(/[\n,]/).map(a=>a.trim()).filter(Boolean)}function Vs(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 Ks(s){return s?s.available?"ready":s.credential.connected?"configured":s.credential.lastError||s.lastError||s.id==="codex"?"warning":"muted":"unknown"}function Cs(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 ct(s){return s?.trim().replace(/\/+$/,"")??""}function Js(s,a){return s.id==="zai"&&ct(a.providers.zai?.baseUrl)===ot}function dt(s,a){return!s.credential.connected||!s.routing.localByok?"":s.credential.source==="chatgpt_subscription"?"Subscription":Js(s,a)?"Coding Plan key":"API key"}function ut(s,a){const t=a.modelCaches[s.id];if(s.routing.localByok&&s.enabled&&!s.credential.connected||!s.enabled&&s.id!=="openpond")return"";const n=Math.max(t?.models.length??0,s.modelIds.length),l=s.defaultModel?Xe(s.defaultModel,a,s.id):"",i=n===1?"1 model":`${n} models`,d=dt(s,a);return[Vs(s),d,t?i:"",l].filter(Boolean).join(" · ")}function ht(s){return s!=="openpond"&&Ze(s)}function rs(s){return s?it.has(s.id)||s.credentialModes.some(a=>rt.has(a)):!1}function mt(s){return rs(s)?["api","subscription"]:["api"]}function ks(s,a){return!s||!a||!rs(s)?"api":s.credential.source==="chatgpt_subscription"||Js(s,a)?"subscription":"api"}function Ps(s,a){const t=wa.filter(n=>!!s?.statuses[n]);return a?t.filter(n=>rs(s?.statuses[n])):t}function pt(s){if(!s)return"Never";const a=new Date(s);return Number.isNaN(a.getTime())?s:a.toLocaleString()}function gt(s,a,t=lt){const n=[],l=new Set,i=new Set(a.map(c=>c.trim()).filter(Boolean)),d=c=>{l.has(c.value)||n.length>=t||(l.add(c.value),n.push(c))};for(const c of s)i.has(c.value)&&d(c);for(const c of s)d(c);return n}function ft({account:s,codex:a,providers:t,providerBusy:n,validationMessage:l,deleteProviderCredential:i,loadProviderModels:d,refreshProviderModels:c,saveProviderConfig:o,saveProviderCredential:j,startOpenAiSubscriptionAuth:g,validateProvider:u}){const[h,m]=r.useState(null),[f,v]=r.useState(!1),y=r.useMemo(()=>Ps(t,!1),[t]),C=r.useMemo(()=>Ps(t,f),[t,f]),P=h?t?.statuses[h]??null:null;function A(D,b){m(D),b&&d(D)}return e.jsxs("section",{className:"account-settings",children:[e.jsx("h1",{children:"Providers"}),t?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:D=>v(D.currentTarget.checked)}),e.jsx("span",{children:"Subscriptions"})]})]}),e.jsxs("small",{children:[C.length," of ",y.length," presets"]})]}),C.length>0?e.jsx("div",{className:"provider-manager-scroll",role:"list",children:C.map(D=>{const b=t.statuses[D],I=t.modelCaches[D],k=b.modelIds.length>0&&(I?.models.length??0)<b.modelIds.length,U=n?.startsWith(`${D}:`)??!1,p=ht(D),w=D==="openpond"||!!t.providers[D]?.enabled;return e.jsxs("div",{className:"provider-manager-row",role:"listitem",children:[e.jsxs("label",{className:"provider-toggle","aria-label":`Enable ${b.displayName}`,children:[e.jsx("input",{type:"checkbox",checked:w,disabled:!p||U,onChange:N=>{A(D,!1),o(D,{enabled:N.currentTarget.checked})}}),e.jsx("span",{})]}),e.jsx("div",{className:"provider-row-main",children:e.jsx("strong",{children:b.displayName})}),e.jsxs("div",{className:`provider-row-status ${Ks(b)}`,children:[U?e.jsx(ae,{size:13,className:"settings-spin"}):null,e.jsx("span",{children:ut(b,t)})]}),e.jsx("button",{type:"button",className:"settings-secondary provider-details-button",onClick:()=>{A(D,k)},children:"Details"})]},D)})}):e.jsxs("div",{className:"empty-account-list provider-manager-empty",children:[e.jsx("strong",{children:"No subscription providers"}),e.jsx("span",{children:"Turn off the filter to show API-key providers."})]})]}):null,l?e.jsxs("div",{className:"settings-footnote provider-validation-message",children:[e.jsx("span",{children:"Last validation"}),e.jsx("strong",{children:l})]}):null,h&&P&&t?e.jsx(xt,{account:s,codex:a,providerId:h,providerBusy:n,settings:t,status:P,onClose:()=>m(null),onDeleteCredential:i,onRefreshModels:c,onSaveConfig:o,onSaveCredential:j,onStartOpenAiSubscriptionAuth:g,onValidate:u}):null]})}function xt({account:s,codex:a,providerId:t,providerBusy:n,settings:l,status:i,onClose:d,onDeleteCredential:c,onRefreshModels:o,onSaveConfig:j,onSaveCredential:g,onStartOpenAiSubscriptionAuth:u,onValidate:h}){const m=l.providers[t],f=l.modelCaches[t],v=r.useId(),y=r.useRef(t),C=Math.max(f?.models.length??0,i.modelIds.length),P=i.routing.localByok&&Ze(t)&&t!=="codex",A=r.useMemo(()=>P?mt(i):[],[P,i]),D=A.includes("subscription"),[b,I]=r.useState(()=>ks(i,l)),k=P&&b==="subscription"&&D,U=w=>`${v}-${w}-panel`,p=t==="codex"?"Codex app server":m?.baseUrl??(t==="openpond"?s?.chatApiBaseUrl:null)??"Not set";return r.useEffect(()=>{if(y.current!==t){y.current=t,I(ks(i,l));return}P&&!A.includes(b)&&I("api")},[b,A,P,t,l,i]),e.jsx("div",{className:"git-dialog-backdrop provider-dialog-backdrop",role:"presentation",onMouseDown:d,children:e.jsxs("section",{className:"git-dialog provider-details-dialog",role:"dialog","aria-modal":"true","aria-label":`${i.displayName} provider details`,onMouseDown:w=>w.stopPropagation(),children:[e.jsx("button",{className:"git-dialog-close",type:"button",title:"Close","aria-label":"Close",onClick:d,children:e.jsx(le,{size:16})}),e.jsxs("div",{className:"provider-dialog-header",children:[e.jsxs("div",{children:[e.jsx("h2",{children:i.displayName}),e.jsx("span",{children:De(t,l)})]}),e.jsx("div",{className:`provider-state-pill ${Ks(i)}`,children:Vs(i)})]}),P?e.jsx("div",{className:"surface-tabs provider-mode-tabs",role:"tablist","aria-label":`${i.displayName} mode`,children:A.map(w=>e.jsx("button",{type:"button",role:"tab",id:`${v}-${w}`,className:b===w?"active":void 0,"aria-selected":b===w,"aria-controls":U(w),onClick:()=>I(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:Cs(i),children:Cs(i)})]}),k?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Base URL"}),e.jsx("dd",{title:p,children:p})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Model"}),e.jsx("dd",{title:m?.defaultModel??i.defaultModel??void 0,children:m?.defaultModel??i.defaultModel??"Not set"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Models"}),e.jsxs("dd",{title:f?.lastError??void 0,children:[C," cached · ",pt(f?.fetchedAt)]})]})]}),t==="codex"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Account"}),e.jsx("dd",{title:a?.account?.email??void 0,children:a?.account?.label??a?.account?.email??"Not signed in"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Binary"}),e.jsx("dd",{title:a?.binaryPath??void 0,children:a?.binaryPath??"Not found"})]})]}):null,i.credential.lastError||f?.lastError||i.lastError?e.jsxs("div",{className:"provider-dialog-error",children:[e.jsx("dt",{children:"Error"}),e.jsx("dd",{title:i.credential.lastError??f?.lastError??i.lastError??void 0,children:i.credential.lastError??f?.lastError??i.lastError})]}):null]}),t==="codex"?e.jsx(jt,{providerBusy:n,status:i,onValidate:h}):P&&m&&f?e.jsx(bt,{credentialTab:b,credentialTabsId:v,hasSubscriptionTab:D,providerId:t,providerBusy:n,settings:l,status:i,onDeleteCredential:c,onRefreshModels:o,onSaveConfig:j,onSaveCredential:g,onStartOpenAiSubscriptionAuth:u,onValidate:h}):i.routing.localByok&&!Ze(t)?e.jsxs("div",{className:"provider-dialog-note",children:[e.jsx(zs,{size:15}),e.jsx("span",{children:"Adapter pending"})]}):null]})})}function jt({providerBusy:s,status:a,onValidate:t}){const n=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(ue,{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:n,onClick:()=>{t("codex",{modelId:a.defaultModel??void 0})},children:[n?e.jsx(ae,{size:14,className:"settings-spin"}):e.jsx(Os,{size:14}),e.jsx("span",{children:n?"Testing":"Test Codex login"})]})})]})}function bt({credentialTab:s,credentialTabsId:a,hasSubscriptionTab:t,providerId:n,providerBusy:l,settings:i,status:d,onDeleteCredential:c,onRefreshModels:o,onSaveConfig:j,onSaveCredential:g,onStartOpenAiSubscriptionAuth:u,onValidate:h}){const m=i.providers[n],f=r.useMemo(()=>Te(n,i),[n,i]),v=`provider-models-${n}`,y=r.useRef(n),[C,P]=r.useState(m.baseUrl??""),[A,D]=r.useState(m.defaultModel??""),[b,I]=r.useState(m.modelOverrides.join(`
|
|
3
|
-
`)),[k,U]=r.useState({baseUrl:!1,defaultModel:!1,modelOverrides:!1}),[p,w]=r.useState("local_secret"),[N,x]=r.useState(""),[M,T]=r.useState(""),q=l===`${n}:config`,V=l===`${n}:credential`,R=l===`${n}:validate`,S=l===`${n}:models`,O=l==="openai:credential",Q=n==="openai",J=n==="xai",W=n==="zai",K=(B=>`${a}-${B}-panel`)(s),z=s==="subscription"&&t,se=s==="subscription"&&W?"coding-plan":"api",ie=se==="coding-plan"?"Coding Plan key":"API key",ce=d.credential.connected?se==="coding-plan"?"Replace saved plan key":"Replace saved key":ie,re=se==="coding-plan"?"Save plan key":"Save key",te=r.useMemo(()=>gt(f,[A,...Ss(b)]),[A,f,b]),ee=Math.max(0,f.length-te.length);r.useEffect(()=>{if(y.current!==n){y.current=n,U({baseUrl:!1,defaultModel:!1,modelOverrides:!1}),P(m.baseUrl??""),D(m.defaultModel??""),I(m.modelOverrides.join(`
|
|
4
|
-
`));return}k.baseUrl||P(m.baseUrl??""),k.defaultModel||D(m.defaultModel??""),k.modelOverrides||I(m.modelOverrides.join(`
|
|
5
|
-
`))},[m.baseUrl,m.defaultModel,m.modelOverrides,k.baseUrl,k.defaultModel,k.modelOverrides,n]);const fe=p==="env"?!!M.trim():!!N.trim();async function oe(B){B.preventDefault(),await j(n,{enabled:!0,baseUrl:C.trim()||null,defaultModel:A.trim()||null,modelOverrides:Ss(b)}),U({baseUrl:!1,defaultModel:!1,modelOverrides:!1})}async function L(B){if(B.preventDefault(),!!fe){if(p==="env"){await g(n,{source:"env",envVar:M.trim()});return}await g(n,{source:"local_secret",value:N}),x("")}}function _({panel:B=!0}={}){return e.jsxs("form",{className:"provider-credential-panel",id:B?K:void 0,role:B?"tabpanel":void 0,"aria-labelledby":B?`${a}-${s}`:void 0,onSubmit:H=>{L(H)},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(we,{value:p,disabled:V,label:"Credential source",options:tt,onChange:H=>w(H)})]}),p==="env"?e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Environment variable"}),e.jsx("input",{value:M,disabled:V,placeholder:"PROVIDER_API_KEY",onChange:H=>T(H.currentTarget.value)})]}):e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:ie}),e.jsx("input",{type:"password",value:N,disabled:V,placeholder:ce,autoComplete:"off",onChange:H=>x(H.currentTarget.value)})]})]}),e.jsxs("div",{className:"settings-button-row",children:[e.jsxs("button",{className:"settings-secondary",disabled:V||!fe,children:[V?e.jsx(ae,{size:14,className:"settings-spin"}):e.jsx(ue,{size:14}),e.jsx("span",{children:V?"Saving":re})]}),e.jsx("button",{type:"button",className:"settings-icon-button ghost","aria-label":`Delete ${d.displayName} credential`,disabled:V||!d.credential.connected,onClick:()=>{c(n)},children:e.jsx(be,{size:15})})]})]})}function F(){return Q?e.jsxs("div",{className:"provider-subscription-panel",id:K,role:"tabpanel","aria-labelledby":`${a}-subscription`,children:[e.jsxs("div",{className:"provider-dialog-note codex-provider-note",children:[e.jsx(ue,{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:O,onClick:()=>{u("browser")},children:[O?e.jsx(ae,{size:14,className:"settings-spin"}):e.jsx(ue,{size:14}),e.jsx("span",{children:O?"Opening":"Connect ChatGPT"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:O,onClick:()=>{u("device")},children:[O?e.jsx(ae,{size:14,className:"settings-spin"}):e.jsx(ue,{size:14}),e.jsx("span",{children:"Device code"})]}),e.jsx("button",{type:"button",className:"settings-icon-button ghost","aria-label":`Delete ${d.displayName} credential`,disabled:O||!d.credential.connected,onClick:()=>{c(n)},children:e.jsx(be,{size:15})})]})]}):J?e.jsx("div",{className:"provider-subscription-panel",id:K,role:"tabpanel","aria-labelledby":`${a}-subscription`,children:e.jsxs("div",{className:"provider-dialog-note xai-provider-note",children:[e.jsx(ue,{size:15}),e.jsx("span",{children:"SuperGrok includes Grok app and Grok Build access. xAI API calls here still use an xAI Console API key with API credits or invoiced billing, so there is no separate Connect SuperGrok step yet."})]})}):W?e.jsxs("div",{className:"provider-subscription-panel",id:K,role:"tabpanel","aria-labelledby":`${a}-subscription`,children:[e.jsxs("div",{className:"provider-dialog-note subscription-provider-note",children:[e.jsx(ue,{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."})]}),_({panel:!1})]}):null}return e.jsxs("div",{className:"provider-dialog-body",children:[z?null:e.jsxs("form",{className:"provider-card-form",onSubmit:B=>{oe(B)},children:[e.jsxs("div",{className:"provider-card-grid",children:[e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Base URL"}),e.jsx("input",{value:C,disabled:q,placeholder:"https://api.example.com/v1",onChange:B=>{U(H=>({...H,baseUrl:!0})),P(B.currentTarget.value)}})]}),e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Default model"}),e.jsx("input",{list:v,value:A,disabled:q,placeholder:"Model id",onChange:B=>{U(H=>({...H,defaultModel:!0})),D(B.currentTarget.value)}}),e.jsx("datalist",{id:v,children:te.map(B=>e.jsx("option",{value:B.value,children:B.label},B.value))}),ee>0?e.jsxs("small",{children:[ee," 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(ae,{size:14,className:"settings-spin"}):e.jsx(is,{size:14}),e.jsx("span",{children:q?"Saving":"Save config"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:S,onClick:()=>{o(n)},children:[S?e.jsx(ae,{size:14,className:"settings-spin"}):e.jsx(ne,{size:14}),e.jsx("span",{children:S?"Refreshing":"Refresh models"})]}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:R||!A.trim(),onClick:()=>{h(n,{baseUrl:C.trim()||void 0,modelId:A.trim()||void 0})},children:[R?e.jsx(ae,{size:14,className:"settings-spin"}):e.jsx(Os,{size:14}),e.jsx("span",{children:R?"Testing":"Test"})]})]})]}),e.jsx("div",{className:"provider-card-form credential-form",children:z?F():_()})]})}function vt({status:s,busy:a,flashTailscaleUp:t,refresh:n,enableRemoteAccess:l,disableRemoteAccess:i,copyRemoteLink:d,copyTailscaleUpCommand:c,copyServeCommand:o,copyServeSetupUrl:j,copyOperatorCommand:g,createRemoteLink:u}){const h=s?.tailscale.installed??!1,m=s?.serve.enabled??!1,f=s?.serve.reachable??!1,v=!!(s?.webUiAvailable&&h),y=m?!!s?.remoteWebUrl:v,P=(s?.tailscale.peers??[]).filter(b=>!b.isSelf),A=!!s?.tailscale.error?.includes("set --operator"),D=!!(m&&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":m?"configured":""}`,children:h?e.jsx(Hs,{size:18}):e.jsx(_a,{size:18})}),e.jsxs("div",{children:[e.jsx("strong",{children:f?"Tailscale Serve is reachable":m?"Tailscale Serve is configured":"Tailscale Serve is off"}),e.jsx("small",{children:s?wt(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:a!==null,onClick:()=>{n()},children:e.jsx(ne,{className:a==="refresh"?"settings-spin":"",size:15})}),e.jsxs("button",{type:"button",className:"settings-secondary",disabled:a!==null||!h||!m&&!v,onClick:()=>{m?i():l()},children:[e.jsx(en,{size:15}),e.jsx("span",{children:m?a==="disable"?"Turning off":"Turn off":a==="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:D?"Browser UI":"Tailscale + Serve"})]})}),D&&e.jsx(de,{label:"Remote URL",value:s?.remoteWebUrl??null,actionLabel:a==="copy-link"?"Copying":"Copy",disabled:!s?.remoteWebUrl||a!==null,onAction:d}),e.jsx(de,{label:"Tailscale up",value:s?.tailscaleUpCommand??null,flash:t,actionLabel:a==="copy-up-command"?"Copying":"Copy",disabled:!s?.tailscaleUpCommand||a!==null,onAction:c}),e.jsx(de,{label:"Serve command",value:s?.serveCommand??null,actionLabel:a==="copy-command"?"Copying":"Copy",disabled:!s?.serveCommand||a!==null,onAction:o}),s?.serve.setupUrl&&e.jsx(de,{label:"Enable Serve",value:s.serve.setupUrl,actionLabel:a==="copy-serve-setup"?"Copying":"Copy",disabled:a!==null,onAction:j}),A&&e.jsx(de,{label:"One-time setup",value:s?.operatorCommand??null,actionLabel:a==="copy-operator"?"Copying":"Copy",disabled:!s?.operatorCommand||a!==null,onAction:g}),e.jsx(de,{label:"Local target",value:s?.localUrl??null}),s?.tailscale.authUrl&&e.jsx(de,{label:"Tailscale login",value:s.tailscale.authUrl}),e.jsx(de,{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:[P.length," devices"]})]}),e.jsx("button",{type:"button",className:"settings-secondary",disabled:a!==null||!y,onClick:()=>{u()},children:e.jsx("span",{children:m?"Copy link":"Create link"})})]}),s?P.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."})]}):P.map(b=>e.jsx(Nt,{peer:b},b.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(yt,{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 de({actionLabel:s,disabled:a,flash:t,label:n,onAction:l,value:i}){return e.jsxs("div",{className:"product-row remote-access-value-row",children:[e.jsxs("div",{children:[e.jsx("strong",{className:t?"flash":void 0,children:n}),e.jsx("code",{children:i??"Not available"})]}),l&&e.jsx("button",{type:"button",className:"settings-secondary",disabled:a,onClick:()=>{l()},children:e.jsx("span",{children:s??"Copy"})})]})}function yt({status:s}){const a=[{label:"State",value:s?.tailscale.backendState??"Unknown"},{label:"Machine",value:s?.tailscale.machineName??"Unknown"},{label:"Tailnet",value:s?.tailscale.tailnetName??"Unknown"}],t=[{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:a.map(n=>e.jsx(Rs,{label:n.label,value:n.value},n.label))}),e.jsx("div",{className:"remote-access-environment-row two",children:t.map(n=>e.jsx(Rs,{label:n.label,value:n.value},n.label))})]})}function Rs({label:s,value:a}){return e.jsxs("div",{className:"remote-access-environment-cell",children:[e.jsx("strong",{children:s}),e.jsx("span",{children:a})]})}function Nt({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 wt(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 St=[{items:[{section:"account",label:"Account",Icon:rn},{section:"notifications",label:"Notifications",Icon:_s},{section:"providers",label:"Providers",Icon:Ca},{section:"dataset-storage",label:"Dataset Storage",Icon:Qa},{section:"usage",label:"Activity",Icon:ka},{section:"defaults",label:"Defaults",Icon:Fs}]},{label:"Harness",items:[{section:"harness",label:"Harness",Icon:He},{section:"skills",label:"Skills",Icon:Ie},{section:"context",label:"Context",Icon:Pa},{section:"training",label:"Training",Icon:He},{section:"subagents",label:"Subagents",Icon:He}]},{items:[{section:"profile",label:"Legacy Profiles",Icon:Le},{section:"editor",label:"Editor",Icon:Ua},{section:"remote",label:"Remote",Icon:Hs},{section:"personalization",label:"Personalization",Icon:Ga},{section:"diagnostics",label:"Diagnostics",Icon:Ha}]}];function Ct({section:s,onBack:a,onSectionChange:t}){return e.jsxs("aside",{className:"settings-sidebar",children:[e.jsxs("button",{className:"settings-back",onClick:a,children:[e.jsx(Sa,{size:15}),e.jsx("span",{children:"Back to app"})]}),e.jsx("nav",{className:"settings-nav","aria-label":"Settings",children:St.map((n,l)=>e.jsxs("div",{className:"settings-nav-group",children:[n.label?e.jsx("div",{className:"settings-nav-heading",children:n.label}):null,n.items.map(({section:i,label:d,Icon:c})=>e.jsxs("button",{className:`settings-nav-item ${s===i?"active":""}`,onClick:()=>t(i),children:[e.jsx(c,{size:16}),e.jsx("span",{children:d})]},i))]},n.label??`settings-${l}`))})]})}function kt({catalog:s,connection:a,onCatalog:t,onError:n,onOpenExtension:l,onToast:i}){const[d,c]=r.useState(""),[o,j]=r.useState(""),[g,u]=r.useState(null),[h,m]=r.useState(null),[f,v]=r.useState(null),y=r.useCallback(p=>{const w=p instanceof Error?p.message:String(p);v(w),n(w),i?.(w,"error")},[n,i]),C=r.useCallback(()=>{v(null),n(null)},[n]),P=r.useCallback(async p=>{if(p?.preventDefault(),!(!a||!d.trim()||h)){C(),m("preview");try{const w=await E.extensionPreview(a,{source:d.trim(),...o.trim()?{ref:o.trim()}:{}});u(w)}catch(w){u(null),y(w)}finally{m(null)}}},[h,C,a,y,o,d]),A=r.useCallback(async()=>{if(!(!a||!g||h)){C(),m("install");try{const p=await E.extensionAdd(a,{source:g.repositoryUrl,ref:g.requestedRef});t(p.catalog),c(""),j(""),u(null),i?.(`Installed ${p.extension.owner}/${p.extension.repo}.`,"success")}catch(p){y(p)}finally{m(null)}}},[h,C,a,t,i,g,y]),D=r.useCallback(async p=>{if(!(!a||h)){C(),m(`update:${p.id}`);try{const w=await E.extensionUpdate(a,p);t(w.catalog);const N=w.extension.resolvedCommit===p.resolvedCommit&&w.extension.packageHash===p.packageHash;i?.(N?`${p.owner}/${p.repo} is already current.`:`Updated ${p.owner}/${p.repo}.`,"success")}catch(w){y(w)}finally{m(null)}}},[h,C,a,t,i,y]),b=r.useCallback(async()=>{if(!(!a||h||s.extensions.length===0)){C(),m("update-all");try{const p=await E.extensionUpdateAll(a);t(p.catalog);const w=`Updated ${p.updated.length}; ${p.unchanged.length} already current${p.failed.length?`; ${p.failed.length} failed`:""}.`;i?.(w,p.failed.length?"error":"success"),p.failed.length&&v(p.failed.map(N=>N.error).join(" "))}catch(p){y(p)}finally{m(null)}}},[h,s.extensions.length,C,a,t,i,y]),I=r.useCallback(async p=>{if(!(!a||h)&&window.confirm(`Remove ${p.owner}/${p.repo} and its ${p.skills.length} installed skill${p.skills.length===1?"":"s"}? Profile and built-in skills will not be changed.`)){C(),m(`remove:${p.id}`);try{const w=await E.extensionRemove(a,p);t(w.catalog),i?.(`Removed ${p.owner}/${p.repo}.`,"success")}catch(w){y(w)}finally{m(null)}}},[h,C,a,t,i,y]),k=r.useCallback(p=>{c(p),u(null),v(null)},[]),U=r.useCallback(p=>{j(p),u(null),v(null)},[]);return e.jsxs("div",{className:"account-list native-skills-list github-extensions-list",children:[e.jsxs("div",{className:"account-list-heading github-extensions-heading",children:[e.jsx("span",{children:"Third-party extensions"}),e.jsxs("div",{className:"github-extensions-heading-actions",children:[e.jsxs("small",{children:[s.extensions.length," installed from GitHub"]}),e.jsxs("button",{className:"settings-secondary compact",disabled:!a||h!==null||s.extensions.length===0,type:"button",onClick:()=>{b()},children:[h==="update-all"?e.jsx(ae,{className:"settings-spin",size:13}):e.jsx(ne,{size:13}),"Update all"]})]})]}),e.jsxs("form",{className:"github-extension-add",onSubmit:p=>{P(p)},children:[e.jsxs("div",{className:"github-extension-add-copy",children:[e.jsx("strong",{children:"Add a GitHub skill pack"}),e.jsx("span",{children:"Use a skills-CLI-compatible owner/repo or GitHub URL. OpenPond installs it locally without running setup code."})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Repository"}),e.jsx("input",{disabled:!a||h!==null,placeholder:"owner/repo",value:d,onChange:p=>k(p.target.value)})]}),e.jsxs("label",{className:"github-extension-ref-input",children:[e.jsx("span",{children:"Branch, tag, or SHA"}),e.jsx("input",{disabled:!a||h!==null,placeholder:"Default branch",value:o,onChange:p=>U(p.target.value)})]}),e.jsxs("button",{className:"settings-secondary",disabled:!a||!d.trim()||h!==null,type:"submit",children:[h==="preview"?e.jsx(ae,{className:"settings-spin",size:14}):e.jsx(Qe,{size:14}),h==="preview"?"Checking":"Preview"]})]}),f||s.error?e.jsx("div",{className:"github-extension-message error",role:"alert",children:f??s.error}):null,g?e.jsxs("div",{className:"github-extension-preview",children:[e.jsxs("div",{children:[e.jsxs("strong",{children:[g.owner,"/",g.repo]}),e.jsxs("span",{children:[g.skills.length," skill",g.skills.length===1?"":"s"," at ",g.resolvedCommit.slice(0,12)]})]}),e.jsx("div",{className:"github-extension-preview-skills",children:g.skills.map(p=>e.jsx("span",{children:p.name},p.relativePath))}),e.jsxs("button",{className:"settings-secondary",disabled:h!==null,type:"button",onClick:()=>{A()},children:[h==="install"?e.jsx(ae,{className:"settings-spin",size:14}):e.jsx(me,{size:14}),h==="install"?"Installing":"Install extension"]})]}):null,s.extensions.length?s.extensions.map(p=>{const w=h===`update:${p.id}`,N=h===`remove:${p.id}`;return e.jsxs("div",{className:"github-extension-row",children:[e.jsxs("button",{"aria-label":`Open ${p.owner}/${p.repo} extension source`,className:"github-extension-open",disabled:!a||h!==null,type:"button",onClick:()=>l(p),children:[e.jsx("span",{className:"native-skill-icon","aria-hidden":"true",children:e.jsx(Qe,{size:17})}),e.jsxs("span",{className:"native-skill-identity",children:[e.jsxs("strong",{children:[p.owner,"/",p.repo]}),e.jsx("span",{children:p.skills.map(x=>x.name).join(", ")})]}),e.jsxs("span",{className:"native-skill-provider",children:[e.jsxs("strong",{children:[p.skills.length," skill",p.skills.length===1?"":"s"]}),e.jsxs("span",{children:[p.requestedRef," · ",p.resolvedCommit.slice(0,12)]})]}),e.jsx("span",{className:`native-skill-status ${p.validationStatus==="valid"?"":"invalid"}`,children:p.validationStatus==="valid"?"Ready":"Needs attention"}),e.jsx(Ts,{size:16,"aria-hidden":"true"})]}),e.jsxs("span",{className:"github-extension-row-actions",children:[e.jsx("button",{"aria-label":`Update ${p.owner}/${p.repo}`,className:"settings-icon-button ghost",disabled:h!==null,title:"Update extension",type:"button",onClick:()=>{D(p)},children:w?e.jsx(ae,{className:"settings-spin",size:14}):e.jsx(ne,{size:14})}),e.jsx("button",{"aria-label":`Remove ${p.owner}/${p.repo}`,className:"settings-icon-button ghost danger",disabled:h!==null,title:"Remove extension",type:"button",onClick:()=>{I(p)},children:N?e.jsx(ae,{className:"settings-spin",size:14}):e.jsx(be,{size:14})})]})]},p.id)}):e.jsx("div",{className:"skills-settings-empty",children:"No third-party extensions installed."})]})}function Pt({onOpenSkill:s,onOpenExtension:a,personalSkills:t,extensionCatalog:n,connection:l,onExtensionCatalog:i,onError:d,onToast:c}){return e.jsxs("section",{className:"account-settings skills-settings","aria-labelledby":"skills-settings-title",children:[e.jsx("header",{className:"skills-settings-header",children:e.jsxs("div",{children:[e.jsx("h1",{id:"skills-settings-title",children:"Skills"}),e.jsx("p",{children:"Install third-party GitHub packs, inspect personal Codex skills, and view instructions bundled with OpenPond."})]})}),e.jsx(kt,{catalog:n,connection:l,onCatalog:i,onError:d,onOpenExtension:a,onToast:c}),e.jsxs("div",{className:"account-list native-skills-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Personal Codex skills"}),e.jsx("small",{children:"Discovered from your local Codex skills folder"})]}),t.length?t.map(o=>e.jsxs("div",{className:"native-skill-row personal-skill-row",children:[e.jsx("span",{className:"native-skill-icon","aria-hidden":"true",children:e.jsx(Ie,{size:17})}),e.jsxs("span",{className:"native-skill-identity",children:[e.jsx("strong",{children:o.name}),e.jsx("span",{children:o.description||"Packaged Codex skill"})]}),e.jsxs("span",{className:"native-skill-provider",children:[e.jsx("strong",{children:o.resourceFiles.length?`${o.resourceFiles.length} packaged resource${o.resourceFiles.length===1?"":"s"}`:"Instructions only"}),e.jsx("span",{children:o.sourcePath})]}),e.jsx("span",{className:`native-skill-status ${o.validationStatus==="valid"?"":"invalid"}`,children:o.validationStatus==="valid"?"Ready":"Needs attention"}),e.jsx("span",{"aria-hidden":"true"})]},o.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"})]}),Ra.map(o=>{const j=Aa(o.provider)?.label??o.provider;return e.jsxs("button",{className:"native-skill-row",type:"button",onClick:()=>s(o),children:[e.jsx("span",{className:"native-skill-icon","aria-hidden":"true",children:e.jsx(Ie,{size:17})}),e.jsxs("span",{className:"native-skill-identity",children:[e.jsx("strong",{children:o.name}),e.jsx("span",{children:o.description})]}),e.jsxs("span",{className:"native-skill-provider",children:[e.jsx("strong",{children:j}),e.jsx("span",{children:o.path})]}),e.jsx("span",{className:"native-skill-status",children:"Built in"}),e.jsx(Ts,{size:16,"aria-hidden":"true"})]},o.name)})]})]})}const os="default";function Rt({connection:s,embedded:a=!1,onError:t,onPreferences:n,preferences:l,providers:i}){const d=l.training,[c,o]=r.useState(Ke(d.defaultModelRef)),[j,g]=r.useState(d.creationMode),[u,h]=r.useState(d.autoApproveEvidence),[m,f]=r.useState(!1),v=r.useMemo(()=>Es(i,{includeUnavailable:!0}),[i]),y=r.useMemo(()=>v.map(b=>({provider:b,models:Te(b.value,i)})).filter(b=>b.models.length>0),[v,i]),C=At(c),P=Da(l.defaultChatProvider,l.defaultChatModel,i)?` · ${Dt(l.codexReasoningEffort)} reasoning`:"",A=It(C,d.defaultModelRef??null)&&j===d.creationMode&&u===d.autoApproveEvidence;r.useEffect(()=>{o(Ke(d.defaultModelRef)),g(d.creationMode),h(d.autoApproveEvidence)},[l.defaultChatModel,l.defaultChatProvider,d.autoApproveEvidence,d.creationMode,d.defaultModelRef]);async function D(b){if(b.preventDefault(),!!s){f(!0),t(null);try{n(await E.savePreferences(s,{training:{defaultModelRef:C,creationMode:j,autoApproveEvidence:u}}))}catch(I){t(I instanceof Error?I.message:String(I))}finally{f(!1)}}}return e.jsxs("section",{className:`account-settings training-settings${a?" embedded":""}`,children:[a?null:e.jsx("h1",{children:"Training"}),e.jsxs("form",{className:"provider-settings-form",onSubmit:b=>{D(b)},children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Taskset authoring"}),e.jsx("small",{children:"The coding model that proposes tasks, graders, fixtures, and policy boundaries"})]}),e.jsx("div",{className:"provider-settings-grid single",children:e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Authoring model"}),e.jsxs("select",{value:c,disabled:m,onChange:b=>o(b.target.value),children:[e.jsxs("option",{value:os,children:["Use chat default — ",De(l.defaultChatProvider,i)," · ",Xe(l.defaultChatModel,i,l.defaultChatProvider),P]}),y.map(b=>e.jsx("optgroup",{label:b.provider.label,children:b.models.map(I=>e.jsx("option",{value:Ke({providerId:b.provider.value,modelId:I.value}),children:I.label},I.value))},b.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:j,disabled:m,onChange:b=>g(b.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:u,disabled:m,onChange:b=>h(b.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:m||A,children:e.jsx("span",{children:m?"Saving":"Save training settings"})})]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:"Authoring model"}),e.jsx("strong",{children:C?`${De(C.providerId,i)} / ${Xe(C.modelId,i,C.providerId)}`:"Chat default"})]}),e.jsxs("div",{className:"settings-footnote",children:[e.jsx("span",{children:"Safety boundary"}),e.jsx("strong",{children:"Taskset and training approvals always required"})]})]})}function Ke(s){return s?JSON.stringify([s.providerId,s.modelId]):os}function At(s){if(s===os)return null;try{const a=JSON.parse(s);return!Array.isArray(a)||a.length!==2||typeof a[0]!="string"||typeof a[1]!="string"?null:{providerId:a[0],modelId:a[1]}}catch{return null}}function Dt(s){return`${s.slice(0,1).toUpperCase()}${s.slice(1)}`}function It(s,a){return s?.providerId===a?.providerId&&s?.modelId===a?.modelId}function $t({disabled:s,onChange:a,storageRoots:t,value:n}){const l=r.useId(),[i,d]=r.useState(!1),c=As(n),o=u=>u.datasetStorePath,j="Dataset",g=t.find(u=>As(o(u))===c)??null;return e.jsxs("div",{className:"model-storage-picker",children:[e.jsxs("label",{className:"model-storage-label",htmlFor:l,children:[j," storage"]}),e.jsxs("div",{className:"model-storage-control-row",children:[e.jsxs("select",{"aria-label":`${j} storage drive`,className:"model-storage-select",disabled:s,id:l,title:n??"No Dataset storage configured",value:n??"",onChange:u=>a(u.target.value||null),children:[e.jsx("option",{value:"",children:"Not configured"}),n&&!g?e.jsx("option",{value:n,children:"Manual location"}):null,t.map(u=>e.jsxs("option",{disabled:!u.mounted||!u.writable,title:o(u),value:o(u),children:[u.label," · ",Tt(u.kind)," · ",Lt(u)]},u.id))]}),e.jsx("button",{className:"settings-icon-button model-storage-add",disabled:s,type:"button",title:"Add manual location","aria-label":"Add manual Dataset storage location",onClick:()=>d(!0),children:e.jsx(me,{size:15})})]}),i?Et(e.jsx(Mt,{initialPath:n??"",purpose:"dataset",onClose:()=>d(!1),onUse:u=>{a(u),d(!1)}})):null]})}function Et(s){return typeof document>"u"?s:qa.createPortal(s,document.body)}function Mt({initialPath:s,onClose:a,onUse:t,purpose:n="model"}){const l=r.useId(),[i,d]=r.useState(s),c=Ot(i);r.useEffect(()=>{const j=g=>{g.key==="Escape"&&a()};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[a]);function o(j){j.preventDefault(),j.stopPropagation(),!c&&t(i.trim())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:j=>{j.target===j.currentTarget&&a()},children:e.jsxs("form",{className:"git-dialog model-storage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":l,onSubmit:o,children:[e.jsx("button",{className:"git-dialog-close",type:"button",title:"Close","aria-label":`Close manual ${n} storage`,onClick:a,children:e.jsx(le,{size:15})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(Wa,{size:18})}),e.jsxs("h2",{id:l,children:["Manual ",n," storage"]}),e.jsx("p",{children:"Enter an absolute path to a folder mounted on this machine."}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Mounted folder path"}),e.jsx("input",{autoFocus:!0,spellCheck:!1,value:i,placeholder:n==="dataset"?"/mnt/OpenPond/datasets":"/mnt/models or /run/user/…/gvfs/…",onChange:j=>d(j.target.value)})]}),e.jsx("div",{className:"model-storage-dialog-note",children:"For SMB, connect the share in Files or Finder first, then paste its mounted folder path. OpenPond uses your operating system’s existing connection and credentials."}),i.trim()&&c?e.jsx("div",{className:"profile-dialog-warning",children:c}):null,e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",type:"button",onClick:a,children:"Cancel"}),e.jsx("button",{className:"git-dialog-primary",disabled:!!c,type:"submit",children:"Use location"})]})]})})}function Ot(s){const a=s.trim();return a?/^[a-z][a-z\d+.-]*:\/\//i.test(a)?"Use the mounted folder path, not an smb:// or other network URL.":a==="~"||a.startsWith("~/")||a.startsWith("/")||a.startsWith("\\\\")||/^[a-z]:[\\/]/i.test(a)?null:"Enter an absolute mounted folder path.":"Enter a mounted folder path."}function Tt(s){return s==="network"?"Network":s==="removable"?"Removable":s==="cache"?"Cache":"Local"}function Lt(s){return s.mounted?s.writable?`${Ut(s.freeBytes)} free`:"Read only":"Not mounted"}function As(s){const a=(s??"").trim().replace(/[\\/]+$/,"");return/^(?:[a-z]:[\\/]|\\\\)/i.test(a)?a.toLowerCase():a}function Ut(s){if(s==null)return"Unknown";if(s<1024)return`${s} B`;const a=["KB","MB","GB","TB"];let t=s,n=-1;do t/=1024,n+=1;while(t>=1024&&n<a.length-1);return`${t>=10?t.toFixed(0):t.toFixed(1)} ${a[n]}`}function zt({state:s,catalog:a,busy:t,catalogLoading:n,onRefresh:l,onSave:i}){const[d,c]=r.useState(s?.settings.datasetStorePath??null);r.useEffect(()=>{c(s?.settings.datasetStorePath??null)},[s?.settings.datasetStorePath]);const o=r.useMemo(()=>s?.storageRoots.find(h=>Ds(h.datasetStorePath)===Ds(d))??null,[d,s?.storageRoots]),j=d===(s?.settings.datasetStorePath??null),g=a?.datasets??[];async function u(h){h.preventDefault(),await i(d)}return e.jsxs("section",{className:"account-settings compute-settings dataset-storage-settings",children:[e.jsxs("div",{className:"compute-title-row",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Dataset Storage"}),e.jsx("p",{className:"dataset-storage-intro",children:"Choose where Dataset artifacts are saved and review registered Datasets without loading their rows."})]}),e.jsx("button",{"aria-label":"Refresh Dataset storage",className:"settings-icon-button",disabled:t!==null||n,onClick:()=>{l()},title:"Refresh Dataset storage",type:"button",children:e.jsx(ne,{className:n?"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:o?.label??(d?"Manual location":"Not configured")}),e.jsx("small",{children:d??"Choose a writable local or mounted location before importing a Dataset."}),o?e.jsxs("small",{children:[Ft(o.kind)," · ",o.freeBytes==null?"Free space unknown":`${Ys(o.freeBytes)} free`]}):null]})})}),e.jsxs("form",{className:"provider-settings-form",onSubmit:h=>{u(h)},children:[e.jsx("div",{className:"account-list-heading",children:e.jsx("span",{children:"Location"})}),e.jsx($t,{disabled:t!==null,onChange:c,storageRoots:s?.storageRoots??[],value:d}),e.jsx("button",{className:"settings-primary",disabled:t!==null||j,children:t==="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:g.length})]}),g.length?g.map(h=>e.jsx(Bt,{dataset:h},h.tasksetId)):e.jsx("div",{className:"empty-account-list",children:e.jsx("span",{children:n?"Loading registered Datasets":"No registered Datasets"})})]})]})}function Bt({dataset:s}){const a=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:[Qs(s.rowCount)," rows"," · ",_t(s)," · ",a," · ",s.sizeBytes==null?"Size unavailable":Ys(s.sizeBytes)]}),!s.available&&s.unavailableReason?e.jsx("small",{className:"dataset-storage-error",children:s.unavailableReason}):null]}),e.jsx("span",{children:s.available?Ht(s.status):"Unavailable"})]})}function _t(s){return[["train",s.splitCounts.train],["validation",s.splitCounts.validation],["test",s.splitCounts.test],["frozen eval",s.splitCounts.frozen_eval]].filter(([,t])=>Number(t)>0).map(([t,n])=>`${Qs(Number(n))} ${t}`).join(" · ")||"No split rows"}function Ys(s){if(s<1024)return`${s} B`;const a=["KB","MB","GB","TB"];let t=s,n=-1;do t/=1024,n+=1;while(t>=1024&&n<a.length-1);return`${t>=10?t.toFixed(0):t.toFixed(1)} ${a[n]}`}function Qs(s){return new Intl.NumberFormat().format(s)}function Ds(s){return s?.replace(/[\\/]+$/,"")??""}function Ht(s){return s.replaceAll("_"," ").replace(/^./,a=>a.toUpperCase())}function Ft(s){return s.replace(/^./,a=>a.toUpperCase())}function Me(s){if(!s)return"Not yet";const a=new Date(s);return Number.isNaN(a.valueOf())?s:a.toLocaleString()}function Ae(s){return s?s.slice(0,10):"none"}function ts(s){const a=s.replaceAll("_"," ");return`${a.charAt(0).toUpperCase()}${a.slice(1)}`}function Gt({review:s}){const a=[["Taskset",s.tasksetProposal],["Baseline evaluation",s.evaluation],["Training qualification",s.trainingQualification]];return e.jsx("div",{className:"harness-review-lineage","aria-label":"Review lineage",children:a.map(([t,n])=>e.jsxs("div",{className:n?"linked":"pending",children:[e.jsx("span",{children:t}),e.jsx("code",{children:n?Ae(n.contentHash):"Not created"})]},t))})}function qt({accepting:s,onAcceptTasksetReview:a,review:t}){const n=t.classification==="taskset"&&t.nextAuthority==="human_review"&&t.tasksetProposal===null;return e.jsxs("article",{className:"harness-history-card harness-evaluation-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-${t.classification}`,children:ts(t.classification)}),e.jsx("span",{children:ts(t.nextAuthority)})]}),e.jsx("h2",{children:t.claim?.statement??t.reason})]}),e.jsx("time",{children:Me(t.createdAt)})]}),e.jsx("p",{children:t.reason}),e.jsxs("div",{className:"harness-review-metrics",children:[e.jsxs("span",{children:[e.jsx("strong",{children:t.selectedEvidence.length})," selected"]}),e.jsxs("span",{children:[e.jsx("strong",{children:t.excludedEvidence.length})," excluded"]}),e.jsxs("span",{children:[e.jsx("strong",{children:t.claim?.independentOccurrences??0})," independent occurrences"]})]}),e.jsx(Gt,{review:t}),n?e.jsx("div",{className:"harness-history-actions",children:e.jsx("button",{className:"settings-primary compact",disabled:s,onClick:()=>a(t),type:"button",children:s?"Opening Taskset review…":"Build training Taskset"})}):null]})}function Wt({receipt:s}){return e.jsxs("article",{className:"harness-route-card harness-qualification-card",children:[e.jsxs("div",{children:[e.jsx("span",{className:`harness-status harness-status-${s.decision}`,children:ts(s.decision)}),e.jsxs("strong",{children:[s.model.provider,"/",s.model.model]}),e.jsx("time",{children:Me(s.createdAt)})]}),e.jsx("p",{children:s.reasons.join(" ")}),e.jsxs("small",{children:["Review ",Ae(s.review.contentHash)," · Taskset ",Ae(s.tasksetRelease?.contentHash)," · Baseline ",Ae(s.baselineEvaluation?.contentHash)]})]})}function Vt({acceptingReviewId:s,backgroundReviewBusy:a,backgroundReviewEnabled:t,busy:n,onBackgroundReviewChange:l,onAcceptTasksetReview:i,reviews:d,qualifications:c,schedule:o,onReview:j,onSaveSchedule:g}){const[u,h]=r.useState(o.cadence),[m,f]=r.useState(o.enabled);r.useEffect(()=>{h(o.cadence),f(o.enabled)},[o.cadence,o.enabled]);const v=u!==o.cadence||m!==o.enabled;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:"Continuous learning"}),e.jsx("p",{children:"Review completed turns immediately, then run scheduled RL reviews across recurring evidence."})]}),e.jsxs("div",{className:"harness-section-actions",children:[e.jsx("button",{className:"settings-secondary compact",disabled:n,onClick:()=>j(o.maxEstimatedCostUsd),type:"button",children:"Review now"}),e.jsx("button",{className:"settings-primary compact",disabled:n||!v,onClick:()=>g({enabled:m,cadence:u,maxEstimatedCostUsd:o.maxEstimatedCostUsd}),type:"button",children:"Update schedule"})]})]}),e.jsxs("section",{className:"harness-learning-card","aria-label":"Continuous learning controls",children:[e.jsxs("label",{className:"harness-learning-setting",children:[e.jsxs("span",{className:"harness-learning-copy",children:[e.jsx("strong",{children:"Refiner"}),e.jsx("small",{children:"Review each completed turn for reusable improvements. This is enabled by default for new users."})]}),e.jsxs("span",{className:"provider-toggle harness-learning-toggle",children:[e.jsx("input",{checked:t,disabled:a,onChange:y=>l(y.target.checked),type:"checkbox"}),e.jsx("span",{"aria-hidden":"true"})]})]}),e.jsxs("label",{className:"harness-learning-setting",children:[e.jsxs("span",{className:"harness-learning-copy",children:[e.jsx("strong",{children:"RL review"}),e.jsx("small",{children:"Compare recurring evidence on a schedule and propose evaluation or training work. Unchanged evidence does not call the model."})]}),e.jsxs("span",{className:"provider-toggle harness-learning-toggle",children:[e.jsx("input",{checked:m,disabled:n,onChange:y=>{const C=y.target.checked,P=C&&u==="manual"?"daily":u;f(C),h(P)},type:"checkbox"}),e.jsx("span",{"aria-hidden":"true"})]})]}),e.jsx("div",{className:"harness-learning-schedule",children:e.jsxs("label",{className:"settings-select-field",children:[e.jsx("span",{children:"Cadence"}),e.jsxs("select",{disabled:n,onChange:y=>{const C=y.target.value;h(C),C==="manual"&&f(!1)},value:u,children:[e.jsx("option",{value:"manual",children:"Manual only"}),e.jsx("option",{value:"daily",children:"Daily"}),e.jsx("option",{value:"weekly",children:"Weekly"})]})]})}),e.jsxs("dl",{className:"harness-learning-run-times",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Last run"}),e.jsx("dd",{children:Me(o.lastRunAt)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Next run"}),e.jsx("dd",{children:o.enabled?Me(o.nextRunAt):"Manual"})]})]})]})]}),e.jsxs("section",{className:"harness-history-section",children:[e.jsxs("div",{className:"harness-section-heading",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Evaluation reviews"}),e.jsx("p",{children:"Immutable review receipts and their downstream lineage."})]}),e.jsx("span",{children:d.length})]}),d.length?d.map(y=>e.jsx(qt,{accepting:s===y.id,onAcceptTasksetReview:i,review:y},`${y.id}:${y.contentHash}`)):e.jsx("div",{className:"harness-empty",children:"No model improvement reviews have run."})]}),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 qualifications"}),e.jsx("p",{children:"Evidence-bound decisions that permit a specific training method or record why training is not warranted."})]}),e.jsx("span",{children:c.length})]}),c.length?c.map(y=>e.jsx(Wt,{receipt:y},`${y.id}:${y.contentHash}`)):e.jsx("div",{className:"harness-empty",children:"No review has reached training qualification."})]})]})}const Kt={enabled:!0,cadence:"daily",maxEstimatedCostUsd:.1,nextRunAt:null,lastRunAt:null,lastResult:null,lastError:null,updatedAt:null};function ke(s){const a=new Date(s);return Number.isNaN(a.valueOf())?s:a.toLocaleString()}function Oe(s){return s?s.slice(0,10):"none"}function Is(s,a,t){return{workspaceId:s,baseRelease:a?{id:a.id,contentHash:a.contentHash}:null,targetRelease:{id:t.id,contentHash:t.contentHash},title:t.current?"Current Harness release":`Harness release ${Oe(t.contentHash)}`}}function Jt({change:s,onOpenDiff:a,onOpenSourceSession:t}){const n=s.trigger?.runRef??null,l=s.proposal;return e.jsxs("article",{className:"harness-history-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-${s.receipt.decision}`,children:s.receipt.decision.replaceAll("_"," ")}),e.jsx("span",{children:l?.route??(s.receipt.rollbackOf?"rollback":"workspace")})]}),e.jsx("h2",{children:l?.expectedOutcome??s.receipt.reason})]}),e.jsx("time",{children:ke(s.receipt.createdAt)})]}),e.jsxs("div",{className:"harness-history-release-flow",children:[e.jsx("code",{children:Oe(s.receipt.previousRelease?.contentHash)}),e.jsx("span",{"aria-hidden":"true",children:"→"}),e.jsx("code",{children:Oe(s.receipt.nextRelease?.contentHash)}),e.jsxs("span",{children:["channel ",s.receipt.previousChannelRevision," → ",s.receipt.nextChannelRevision]})]}),e.jsx("p",{children:s.receipt.reason}),a||n&&t?e.jsxs("div",{className:"harness-history-actions",children:[a?e.jsx("button",{className:"settings-secondary compact",onClick:a,type:"button",children:"View release diff"}):null,n&&t?e.jsx("button",{className:"settings-secondary compact",onClick:()=>t(n),type:"button",children:"Open source conversation"}):null]}):null,l?e.jsxs("details",{className:"harness-history-details",children:[e.jsxs("summary",{children:["Review ",l.edits.length," exact edit",l.edits.length===1?"":"s"]}),e.jsx("div",{className:"harness-edit-list",children:l.edits.map(i=>e.jsxs("section",{className:"harness-edit",children:[e.jsxs("div",{children:[e.jsxs("strong",{children:[i.operation," · ",i.target]}),e.jsx("span",{children:i.summary})]}),i.content!==null?e.jsx("pre",{children:i.content}):e.jsx("p",{children:"File deleted."})]},i.id))})]}):null,s.validations.length?e.jsx("div",{className:"harness-validation-list",children:s.validations.map(i=>e.jsxs("div",{children:[e.jsx("span",{className:`harness-validation-status ${i.status}`,children:i.status}),e.jsx("strong",{children:i.kind.replaceAll("_"," ")}),e.jsx("span",{children:i.summary})]},i.id))}):null,s.outcome?e.jsxs("footer",{children:[e.jsxs("span",{children:["Refiner: ",s.outcome.decision.replaceAll("_"," ")]}),e.jsxs("span",{children:["Estimated cost $",s.outcome.estimatedCostUsd.toFixed(4)]})]}):null]})}function Yt({route:s}){return e.jsxs("article",{className:"harness-route-card",children:[e.jsxs("div",{children:[e.jsx("span",{className:"harness-status harness-status-retained",children:"recommendation"}),e.jsx("strong",{children:s.decision.route}),e.jsx("time",{children:ke(s.decision.createdAt)})]}),e.jsx("p",{children:s.decision.reason}),s.trigger?e.jsxs("small",{children:["Triggered by ",s.trigger.reason]}):null]})}function Qt({review:s,busy:a,onReview:t}){return e.jsxs("article",{className:"harness-history-card harness-review-card",children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"harness-history-kicker",children:[e.jsx("span",{className:"harness-status harness-status-retained",children:"review required"}),e.jsxs("span",{children:[s.proposal.route," · ",s.proposal.edits[0]?.operation??"change"]})]}),e.jsx("h2",{children:s.proposal.expectedOutcome})]}),e.jsx("time",{children:ke(s.proposal.createdAt)})]}),e.jsx("p",{children:s.proposal.edits.map(n=>n.summary).join(" ")}),e.jsxs("details",{className:"harness-history-details",open:!0,children:[e.jsxs("summary",{children:["Review ",s.proposal.edits.length," exact edit",s.proposal.edits.length===1?"":"s"]}),e.jsx("div",{className:"harness-edit-list",children:s.proposal.edits.map(n=>e.jsxs("section",{className:"harness-edit",children:[e.jsxs("div",{children:[e.jsxs("strong",{children:[n.operation," · ",n.target]}),e.jsx("span",{children:n.summary})]}),n.content!==null?e.jsx("pre",{children:n.content}):e.jsx("p",{children:"File deleted."})]},n.id))})]}),e.jsx("div",{className:"harness-validation-list",children:s.validations.map(n=>e.jsxs("div",{children:[e.jsx("span",{className:`harness-validation-status ${n.status}`,children:n.status}),e.jsx("strong",{children:n.kind.replaceAll("_"," ")}),e.jsx("span",{children:n.summary})]},n.id))}),e.jsxs("footer",{className:"harness-review-actions",children:[e.jsxs("button",{className:"settings-secondary compact",disabled:a,onClick:()=>t(s,"decline"),type:"button",children:[e.jsx(le,{size:13})," Decline"]}),e.jsxs("button",{className:"settings-primary compact",disabled:a||s.validations.some(n=>n.status!=="passed"),onClick:()=>t(s,"approve"),type:"button",children:[e.jsx(Ms,{size:13})," Approve and release"]})]})]})}function Zt({baseRelease:s,release:a,busy:t,onOpenDiff:n,onRollback:l}){const[i,d]=r.useState(!1);return e.jsxs("div",{className:"harness-release-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:a.current?"Current release":a.id}),e.jsxs("span",{children:[Oe(a.contentHash)," · ",a.files.length," files · ",ke(a.createdAt)]})]}),i?e.jsxs("div",{className:"harness-inline-actions",children:[e.jsxs("button",{className:"settings-secondary compact",disabled:t,onClick:()=>d(!1),type:"button",children:[e.jsx(le,{size:13})," Cancel"]}),e.jsxs("button",{className:"settings-primary compact",disabled:t,onClick:()=>{d(!1),l(a)},type:"button",children:[e.jsx($e,{size:13})," Confirm rollback"]})]}):e.jsxs("div",{className:"harness-inline-actions",children:[a.current?e.jsx("span",{className:"harness-current-pill",children:"current"}):null,e.jsx("button",{className:"settings-secondary compact",onClick:()=>n(s,a),type:"button",children:"View changes"}),a.current?null:e.jsxs("button",{className:"settings-secondary compact",disabled:t,onClick:()=>d(!0),type:"button",children:[e.jsx($e,{size:13})," Roll back"]})]})]})}function Xt({connection:s,enabled:a,onAcceptEvaluationReview:t,onError:n,onDefaultReleaseDiff:l,onOpenReleaseDiff:i,onOpenSourceSession:d,onToast:c}){const[o,j]=r.useState(null),[g,u]=r.useState(!1),[h,m]=r.useState(null),[f,v]=r.useState(null),[y,C]=r.useState(!1),[P,A]=r.useState(!1),[D,b]=r.useState(null),[I,k]=r.useState(!1),U=r.useCallback(async()=>{if(s){u(!0);try{const R=await E.harnessHistory(s);j(R);const S=R.releases.findIndex(Q=>Q.current),O=S>=0?R.releases[S]:null;R.workspace&&O&&l(Is(R.workspace.id,R.releases[S+1]??null,O)),n(null)}catch(R){n(R instanceof Error?R.message:String(R))}finally{u(!1)}}},[s,l,n]);r.useEffect(()=>{a&&U()},[a,U]);const p=r.useCallback(async R=>{if(!(!s||!o?.workspace)){C(!0);try{const S=await E.updateHarnessBackgroundReview(s,{workspaceId:o.workspace.id,enabled:R});j(S.history),n(null),c?.(R?"Harness background review enabled.":"Harness background review disabled.","info")}catch(S){n(S instanceof Error?S.message:String(S))}finally{C(!1)}}},[s,o?.workspace,n,c]),w=r.useCallback(async R=>{if(!(!s||!o?.workspace)){A(!0);try{const S=await E.reviewHarnessEvaluation(s,{workspaceId:o.workspace.id,maxEstimatedCostUsd:R});j(S.history),n(null),c?.(`Harness review completed: ${S.receipt.classification.replaceAll("_"," ")}.`,"success")}catch(S){n(S instanceof Error?S.message:String(S))}finally{A(!1)}}},[s,o?.workspace,n,c]),N=r.useCallback(async R=>{if(!(!s||!o?.workspace)){k(!0);try{const S=await E.updateHarnessEvaluationReviewSchedule(s,{workspaceId:o.workspace.id,...R});j(S.history),n(null),c?.(R.enabled?"Harness review schedule saved.":"Harness review schedule disabled.","info")}catch(S){n(S instanceof Error?S.message:String(S))}finally{k(!1)}}},[s,o?.workspace,n,c]),x=r.useCallback(async R=>{if(o?.workspace){b(R.id);try{await t(o.workspace.id,{id:R.id,contentHash:R.contentHash})&&(n(null),c?.("Taskset review opened in Models.","success"))}catch(S){n(S instanceof Error?S.message:String(S))}finally{b(null)}}},[o?.workspace,t,n,c]),M=r.useCallback((R,S)=>{o?.workspace&&i(Is(o.workspace.id,R,S))},[o?.workspace,i]),T=r.useCallback(R=>{!o?.workspace||!R.receipt.nextRelease||i({workspaceId:o.workspace.id,baseRelease:R.receipt.previousRelease,targetRelease:R.receipt.nextRelease,title:R.proposal?.expectedOutcome??R.receipt.reason})},[o?.workspace,i]),q=r.useCallback(async R=>{if(!(!s||!o?.workspace)){m(R.contentHash);try{const S=await E.rollbackHarness(s,{workspaceId:o.workspace.id,targetRelease:{id:R.id,contentHash:R.contentHash}});j(S.history),n(null),c?.("Personal Harness rolled back. Existing runs remain pinned.","success")}catch(S){n(S instanceof Error?S.message:String(S))}finally{m(null)}}},[s,o?.workspace,n,c]),V=r.useCallback(async(R,S)=>{if(!(!s||!o?.workspace)){v(R.proposal.id);try{const O=await E.reviewHarnessProposal(s,{workspaceId:o.workspace.id,proposal:{id:R.proposal.id,contentHash:R.proposal.contentHash},decision:S});j(O.history),n(null),c?.(S==="approve"?"Harness proposal approved and released.":"Harness proposal declined.",S==="approve"?"success":"info")}catch(O){n(O instanceof Error?O.message:String(O))}finally{v(null)}}},[s,o?.workspace,n,c]);return e.jsxs("section",{className:"account-settings harness-history-settings","aria-labelledby":"harness-history-title",children:[e.jsxs("div",{className:"account-settings-title",children:[e.jsxs("div",{children:[e.jsx("h1",{id:"harness-history-title",children:"Harness"}),e.jsx("p",{children:"Immutable releases, Refiner changes, validation evidence, and rollback history."})]}),e.jsxs("button",{className:"settings-secondary",disabled:g,onClick:()=>{U()},type:"button",children:[e.jsx(ne,{className:g?"settings-spin":void 0,size:14})," Refresh"]})]}),s?null:e.jsx("div",{className:"harness-empty",children:"Connect to the Local OpenPond server to inspect the Harness."}),s&&g&&!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?e.jsxs(e.Fragment,{children:[e.jsx(Vt,{acceptingReviewId:D,backgroundReviewBusy:y,backgroundReviewEnabled:o.backgroundReview.enabled,busy:P||I,onBackgroundReviewChange:R=>{p(R)},onAcceptTasksetReview:R=>{x(R)},onReview:R=>{w(R)},onSaveSchedule:R=>{N(R)},qualifications:o.modelImprovementQualifications,reviews:o.evaluationReviews,schedule:o.evaluationReviewSchedule??Kt}),e.jsxs("section",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Releases"}),e.jsx("small",{children:"New runs use current; active runs stay pinned."})]}),o.releases.map((R,S)=>e.jsx(Zt,{baseRelease:o.releases[S+1]??null,busy:h!==null,onOpenDiff:M,onRollback:q,release:R},`${R.id}:${R.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:"Needs review"}),e.jsx("p",{children:"Executable, Agent, destructive, and sensitive changes never advance without your approval."})]}),e.jsx("span",{children:o.pendingReviews.length})]}),o.pendingReviews.length?o.pendingReviews.map(R=>e.jsx(Qt,{busy:f!==null,onReview:V,review:R},`${R.proposal.id}:${R.proposal.contentHash}`)):e.jsx("div",{className:"harness-empty",children:"No Harness proposals need 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:"Applied history"}),e.jsx("p",{children:"Every release transition with its exact change and validation receipts."})]}),e.jsx("span",{children:o.changes.length})]}),o.changes.length?o.changes.map(R=>e.jsx(Jt,{change:R,onOpenDiff:R.receipt.nextRelease?()=>T(R):void 0,onOpenSourceSession:d},`${R.receipt.id}:${R.receipt.contentHash}`)):e.jsx("div",{className:"harness-empty",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:"Runtime, memory, product, Taskset, and training observations that did not mutate the Harness."})]}),e.jsx("span",{children:o.routes.length})]}),o.routes.length?o.routes.map(R=>e.jsx(Yt,{route:R},`${R.decision.id}:${R.decision.contentHash}`)):e.jsx("div",{className:"harness-empty",children:"No external recommendations have been routed."})]}),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 external memory available through search; it is not copied into every Agent prompt or sandbox."})]}),e.jsx("span",{children:o.memories.length})]}),o.memories.length?o.memories.map(R=>e.jsxs("article",{className:"harness-route-card",children:[e.jsxs("div",{children:[e.jsx("strong",{children:R.key}),e.jsxs("span",{children:["revision ",R.revision]}),e.jsx("time",{children:ke(R.updatedAt)})]}),e.jsx("p",{children:R.content}),R.tags.length?e.jsx("small",{children:R.tags.join(" · ")}):null]},`${R.id}:${R.revision}`)):e.jsx("div",{className:"harness-empty",children:"No Harness memory has been saved."})]})]}):null]})}function $s(s){return s?s.slice(0,10):"initial"}function el({connection:s,expanded:a,onResizeStart:t,onToggleExpanded:n,selection:l}){const[i,d]=r.useState(null),[c,o]=r.useState(null),[j,g]=r.useState(!0),u=r.useCallback(async()=>{o(null),g(!0);try{d(await E.harnessReleaseDiff(s,l))}catch(f){d(null),o(f instanceof Error?f.message:String(f))}finally{g(!1)}},[s,l]);r.useEffect(()=>{u()},[u]);const h=r.useMemo(()=>i?{appId:`harness:${l.workspaceId}`,repoPath:l.title,initialized:!0,dirty:i.filesChanged>0,filesChanged:i.filesChanged,additions:i.additions,deletions:i.deletions,repoFiles:i.files.map(f=>f.path),files:i.files,error:null,updatedAt:""}:null,[i,l.title,l.workspaceId]),m=`${l.title} · ${$s(l.baseRelease?.contentHash)} → ${$s(l.targetRelease.contentHash)}`;return e.jsx(Va,{appId:`harness:${l.workspaceId}`,workspaceId:`harness:${l.targetRelease.contentHash}`,workspaceKind:"local_project",connection:s,diff:h,editorPreferences:null,expanded:a,filesWithPreview:!0,loading:j,onOpenBrowserUrl:()=>{},onRefresh:u,onResizeStart:t,onToggleExpanded:n,readOnly:!0,workspaceError:c,workspaceInitialized:!0,workspaceName:m})}function sl({connection:s,onError:a,onPayload:t}){const[n,l]=r.useState(!1),[i,d]=r.useState(!1);async function c(u,h){if(s){l(!0),a(null);try{const m=await E.switchOpenPondAccount(s,{handle:u,baseUrl:h??null}),f=await E.savePreferences(s,{defaultTeamId:null});t({...m,preferences:f.preferences})}catch(m){a(m instanceof Error?m.message:String(m))}finally{l(!1)}}}async function o(u,h){if(!s)return!1;l(!0),a(null);try{return t(await E.removeOpenPondAccount(s,{handle:u,baseUrl:h??null})),!0}catch(m){return a(m instanceof Error?m.message:String(m)),!1}finally{l(!1)}}async function j(u){if(!(!s||!u.apiKey.trim())){l(!0),a(null);try{const h=u.handle?.trim(),m=u.environment?.trim(),f=await E.saveOpenPondAccount(s,{apiKey:u.apiKey.trim(),handle:h||void 0,baseUrl:u.baseUrl,apiBaseUrl:u.apiBaseUrl,environment:m||"custom",setActive:!0}),v=await E.savePreferences(s,{defaultTeamId:null});t({...f,preferences:v.preferences})}catch(h){throw a(h instanceof Error?h.message:String(h)),h}finally{l(!1)}}}async function g(){if(s){d(!0),a(null);try{t(await E.refreshOpenPondAccounts(s))}catch(u){a(u instanceof Error?u.message:String(u))}finally{d(!1)}}}return{refreshingAccounts:i,saving:n,refreshAccounts:g,removeAccount:o,saveAccount:j,switchAccount:c}}function al({connection:s,onError:a,onPreferences:t,preferences:n,providers:l}){const[i,d]=r.useState(n.defaultBranchPrefix),[c,o]=r.useState(n.defaultNewProjectDirectory),[j,g]=r.useState(n.advancedWorkspaceControls),[u,h]=r.useState(n.contextCompaction.autoEnabled),[m,f]=r.useState(n.subagents.enabled),[v,y]=r.useState(n.subagents.delegationMode),[C,P]=r.useState(!n.subagents.defaultModelRef),[A,D]=r.useState(n.subagents.defaultModelRef?.providerId??n.defaultChatProvider),[b,I]=r.useState(n.subagents.defaultModelRef?.modelId??n.defaultChatModel),[k,U]=r.useState(n.subagents.roles),[p,w]=r.useState(n.subagents.maxConcurrentRuns),[N,x]=r.useState(n.subagents.maxConcurrentRunsPerProvider),[M,T]=r.useState(n.subagents.maxConcurrentRunsPerWorkspaceTarget),[q,V]=r.useState(!1),R=C?null:{providerId:A,modelId:b.trim()},S=m!==n.subagents.enabled||v!==n.subagents.delegationMode||!nl(R,n.subagents.defaultModelRef)||p!==n.subagents.maxConcurrentRuns||N!==n.subagents.maxConcurrentRunsPerProvider||M!==n.subagents.maxConcurrentRunsPerWorkspaceTarget||JSON.stringify(k)!==JSON.stringify(n.subagents.roles);r.useEffect(()=>{d(n.defaultBranchPrefix),o(n.defaultNewProjectDirectory),g(n.advancedWorkspaceControls),h(n.contextCompaction.autoEnabled),f(n.subagents.enabled),y(n.subagents.delegationMode),P(!n.subagents.defaultModelRef),D(n.subagents.defaultModelRef?.providerId??n.defaultChatProvider),I(n.subagents.defaultModelRef?.modelId??n.defaultChatModel),U(n.subagents.roles),w(n.subagents.maxConcurrentRuns),x(n.subagents.maxConcurrentRunsPerProvider),T(n.subagents.maxConcurrentRunsPerWorkspaceTarget)},[n.defaultChatProvider,n.defaultChatModel,n.defaultBranchPrefix,n.defaultNewProjectDirectory,n.advancedWorkspaceControls,n.contextCompaction.autoEnabled,n.subagents]);function O(L){D(L),I(_=>es(L,_,l))}function Q(){return C?n.defaultChatProvider:A}function J(){return C?n.defaultChatModel:b}function W(L,_){U(F=>F.map(B=>B.id===L?_(B):B))}function Z(L,_){W(L,F=>({...F,enabled:_}))}function K(L,_){W(L,F=>({...F,background:_}))}function z(L,_){W(L,F=>{if(_)return{...F,modelRef:null};const B=F.modelRef?.providerId??Q(),H=F.modelRef?.modelId??J();return{...F,modelRef:_e(B,H,l)??null}})}function se(L,_){W(L,F=>({...F,modelRef:_e(_,F.modelRef?.modelId??J(),l)??null}))}function ie(L,_){W(L,F=>{const B=F.modelRef?.providerId??Q(),H=_.trim();return{...F,modelRef:H?{providerId:B,modelId:H}:null}})}function ce(L,_){W(L,F=>({...F,isolationMode:_}))}function re(L,_){W(L,F=>({...F,toolPolicy:_}))}function te(L,_){W(L,F=>({...F,peerMessages:_}))}function ee(L,_){W(L,F=>({...F,maxConcurrentRuns:xe(_,1,16)}))}async function fe(){let L=null;if(window.openpond?.selectFolder){const _=await window.openpond.selectFolder();if(_.canceled)return;L=_.path}else L=window.prompt("Default new project directory",c);L?.trim()&&o(L.trim())}async function oe(L){if(L.preventDefault(),!!s){V(!0),a(null);try{t(await E.savePreferences(s,{defaultBranchPrefix:Je(i),defaultNewProjectDirectory:c.trim(),advancedWorkspaceControls:j,contextCompaction:{...n.contextCompaction,autoEnabled:u},subagents:{enabled:m,workspaceDefaultsVersion:n.subagents.workspaceDefaultsVersion,toolDefaultsVersion:n.subagents.toolDefaultsVersion,delegationMode:v,defaultModelRef:C?null:_e(A,b,l)??null,roles:k,maxConcurrentRuns:xe(p,1,32),maxConcurrentRunsPerProvider:N===null?null:xe(N,1,32),maxConcurrentRunsPerWorkspaceTarget:M===null?null:xe(M,1,32)}}))}catch(_){a(_ instanceof Error?_.message:String(_))}finally{V(!1)}}}return{advancedWorkspaceControls:j,contextCompactionAutoEnabled:u,defaultBranchPrefix:i,defaultNewProjectDirectory:c,subagentsEnabled:m,subagentDelegationMode:v,subagentsUseDefaultModel:C,subagentsProvider:A,subagentsModel:b,subagentRoles:k,subagentsMaxConcurrentRuns:p,subagentsMaxConcurrentRunsPerProvider:N,subagentsMaxConcurrentRunsPerWorkspaceTarget:M,subagentsDirty:S,saving:q,chooseDefaultProjectDirectory:fe,saveDefaults:oe,changeSubagentsProvider:O,changeSubagentRoleProvider:se,setAdvancedWorkspaceControls:g,setContextCompactionAutoEnabled:h,setDefaultBranchPrefix:d,setDefaultNewProjectDirectory:o,setSubagentsUseDefaultModel:P,setSubagentsModel:I,setSubagentsEnabled:f,setSubagentDelegationMode:L=>y(L),setSubagentsMaxConcurrentRuns:L=>w(xe(L,1,32)),setSubagentsMaxConcurrentRunsPerProvider:L=>x(L===null?null:xe(L,1,32)),setSubagentsMaxConcurrentRunsPerWorkspaceTarget:L=>T(L===null?null:xe(L,1,32)),setSubagentRoleBackground:K,setSubagentRoleEnabled:Z,setSubagentRoleIsolationMode:ce,setSubagentRoleMaxConcurrentRuns:ee,setSubagentRoleModel:ie,setSubagentRolePeerMessages:te,setSubagentRoleToolPolicy:re,setSubagentRoleUseDefaultModel:z}}function xe(s,a,t){return Number.isFinite(s)?Math.min(t,Math.max(a,Math.trunc(s))):a}function nl(s,a){return(s?.providerId??null)===(a?.providerId??null)&&(s?.modelId??null)===(a?.modelId??null)}const tl=15e3,ll=100,il=100,rl=2500;function ol({onError:s,section:a}){const[t,n]=r.useState(null),[l,i]=r.useState(null),[d,c]=r.useState(ll),[o,j]=r.useState([]),[g,u]=r.useState(null),[h,m]=r.useState(!0),f=r.useRef(null),[v,y]=r.useState(null),C=!!(window.openpond?.openLogsFolder||window.openpond?.readRecentLogs||window.openpond?.copyRecentLogs||window.openpond?.exportDiagnostics),A=!!window.openpond?.readRecentLogs?`${o.length} of ${d} line${d===1?"":"s"}${h?" tailing":""}`:"Unavailable";r.useEffect(()=>{a==="diagnostics"&&D(d,"refresh",{quiet:!0})},[a]),r.useEffect(()=>{if(a!=="diagnostics"||!h||!window.openpond?.readRecentLogs)return;let w=!1;const N=window.setInterval(()=>{w||(w=!0,D(d,"refresh",{quiet:!0}).finally(()=>{w=!1}))},rl);return()=>window.clearInterval(N)},[a,h,d]),r.useEffect(()=>{if(a!=="diagnostics"||!h)return;const w=f.current;w&&(w.scrollTop=w.scrollHeight)},[a,h,o]);async function D(w=d,N="refresh",x={}){const M=window.openpond?.readRecentLogs;if(!M){const T="Log view is not available in this runtime.";x.quiet||(y({label:"Logs",value:T,warning:!0}),s(T));return}x.quiet||i(N);try{const T=await Pe(M(w),"Read logs");if(!T.ok)throw new Error(T.error);c(T.lineLimit),u(T.logDir),j(T.lines),x.quiet?y(q=>q?.label==="Logs"?null:q):y(null)}catch(T){const q=T instanceof Error?T.message:String(T);y({label:"Logs",value:q,warning:!0}),x.quiet||s(q)}finally{x.quiet||i(null)}}function b(){m(!1),D(d+il,"older")}function I(){const w=!h;m(w),w&&D(d,"refresh",{quiet:!0})}async function k(){const w=window.openpond?.openLogsFolder;if(!w){const N="Desktop logs are not available in this runtime.";y({label:"Logs",value:N,warning:!0}),s(N);return}n("logs"),s(null);try{const N=await Pe(w(),"Open logs");if(!N.ok)throw new Error(N.error??"Could not open the logs folder.");y(null)}catch(N){const x=N instanceof Error?N.message:String(N);y({label:"Logs",value:x,warning:!0}),s(x)}finally{n(null)}}async function U(){const w=window.openpond?.copyRecentLogs;if(!w){const N="Recent log copy is not available in this runtime.";y({label:"Copy",value:N,warning:!0}),s(N);return}n("copy"),s(null);try{const N=await Pe(w(1e3),"Copy recent logs");if(!N.ok)throw new Error(N.error??"Could not copy recent logs.");y({label:"Copy",value:N.lines?`Copied ${N.lines} recent log lines.`:"Copied recent logs."})}catch(N){const x=N instanceof Error?N.message:String(N);y({label:"Copy",value:x,warning:!0}),s(x)}finally{n(null)}}async function p(){const w=window.openpond?.exportDiagnostics;if(!w){const N="Diagnostics export is not available in this runtime.";y({label:"Export",value:N,warning:!0}),s(N);return}n("export"),s(null);try{const N=await Pe(w(),"Export diagnostics");if(!N.ok)throw new Error(N.error??"Could not export diagnostics.");y({label:"Export",value:N.path?`Saved to ${N.path}`:"Diagnostics exported."})}catch(N){const x=N instanceof Error?N.message:String(N);y({label:"Export",value:x,warning:!0}),s(x)}finally{n(null)}}return{diagnosticsAvailable:C,diagnosticsBusy:t,diagnosticsStatus:v,logDir:g,logLineLimit:d,logLines:o,logViewBusy:l,logViewSummary:A,logViewportRef:f,tailLogs:h,copyRecentLogs:U,exportDiagnosticsBundle:p,loadOlderLogs:b,openLogsFolder:k,refreshLogView:D,toggleTailLogs:I}}async function Pe(s,a){let t;try{return await Promise.race([s,new Promise((n,l)=>{t=window.setTimeout(()=>{l(new Error(`${a} did not receive a desktop response.`))},tl)})])}finally{t!==void 0&&window.clearTimeout(t)}}function cl({connection:s,enabled:a,onError:t,onPreferences:n,onToast:l,preferences:i}){const[d,c]=r.useState(i.editor),[o,j]=r.useState(null),[g,u]=r.useState(!1),[h,m]=r.useState(!1),[f,v]=r.useState(!1);r.useEffect(()=>{c(i.editor)},[i.editor]);const y=r.useCallback(async()=>{if(s){m(!0);try{j(await E.workspaceLspSettingsStatus(s))}catch(b){t(b instanceof Error?b.message:String(b))}finally{m(!1)}}},[s,t]);r.useEffect(()=>{!a||!s||y()},[s,a,y]);function C(b,I){c(k=>({...k,languages:{...k.languages,[b]:{...k.languages[b],mode:I}}}))}function P(b,I){c(k=>({...k,languages:{...k.languages,[b]:{...k.languages[b],customCommand:I}}}))}async function A(b){if(b.preventDefault(),!!s){u(!0),t(null);try{const I=await E.savePreferences(s,{editor:d});n(I),j(await E.workspaceLspSettingsStatus(s))}catch(I){t(I instanceof Error?I.message:String(I))}finally{u(!1)}}}async function D(){if(s){v(!0),t(null);try{await E.restartWorkspaceLsp(s),j(await E.workspaceLspSettingsStatus(s)),l?.("Language servers restarted.","success")}catch(b){t(b instanceof Error?b.message:String(b))}finally{v(!1)}}}return{editorPreferences:d,lspStatus:o,restarting:f,saving:g,statusLoading:h,refreshLspStatus:y,restartLanguageServers:D,saveEditorSettings:A,setEditorPreferences:c,setLanguageCustomCommand:P,setLanguageMode:C}}function dl({connection:s,onError:a,onPayload:t,personalization:n}){const l=r.useMemo(()=>n.templates.map(p=>({value:p.id,label:p.name,description:p.id===n.activeTemplateId?"Selected":p.source==="built_in"?p.description:void 0})),[n.activeTemplateId,n.templates]),[i,d]=r.useState(n.activeTemplateId),[c,o]=r.useState(n.soul),[j,g]=r.useState(""),[u,h]=r.useState(!1),[m,f]=r.useState(!1),v=n.templates.find(p=>p.id===i)??n.templates[0],y=v?.source==="custom",C=v?c!==v.content:!0,P=i!==n.activeTemplateId||c!==n.soul||C,A=!!(y&&c.trim()&&v&&P);r.useEffect(()=>{d(n.activeTemplateId),o(n.soul);const p=n.templates.find(w=>w.id===n.activeTemplateId);g(p?`${p.name} Copy`:""),h(!1)},[n.activeTemplateId,n.soul,n.templates]);async function D(p=!1){if(!p&&!y)return;const w=p?j:v?.name;if(!(!s||!c.trim()||!w?.trim())){f(!0),a(null);try{t(await E.savePersonalization(s,{activeTemplateId:i,templateName:w,soul:c,saveAsNew:p})),h(!1)}catch(N){a(N instanceof Error?N.message:String(N))}finally{f(!1)}}}async function b(p){const w=n.templates.find(N=>N.id===p);if(w&&(d(w.id),g(`${w.name} Copy`),o(w.content),h(!1),!!s)){f(!0),a(null);try{t(await E.savePersonalization(s,{activeTemplateId:w.id,templateName:w.name,soul:w.content,saveAsNew:!1}))}catch(N){a(N instanceof Error?N.message:String(N))}finally{f(!1)}}}function I(){v&&(g(`${v.name} Copy`),o(v.content),h(!1))}function k(p){o(p),v&&!y&&p!==v.content&&h(!0)}function U(){v&&(g(`${v.name} Copy`),h(!0))}return{canSaveCurrentTemplate:A,personalizationTemplateId:i,personalizationTemplateOptions:l,saveAsNewOpen:u,saving:m,selectedPersonalizationTemplate:v,selectedTemplateIsCustom:y,soulDraft:c,templateNameDraft:j,changePersonalizationTemplate:b,changeSoulDraft:k,openSaveAsNew:U,resetPersonalizationDraft:I,savePersonalization:D,setSaveAsNewOpen:h,setTemplateNameDraft:g}}function ul({connection:s,onError:a,onPreferences:t,onProviders:n,preferences:l,providers:i}){const[d,c]=r.useState(l.defaultChatProvider),[o,j]=r.useState(l.defaultChatModel),[g,u]=r.useState(!1),[h,m]=r.useState(null),[f,v]=r.useState(null);r.useEffect(()=>{c(l.defaultChatProvider),j(l.defaultChatModel)},[l.defaultChatProvider,l.defaultChatModel]);async function y(N){if(N.preventDefault(),!!s){u(!0),a(null);try{t(await E.savePreferences(s,{defaultChatProvider:d,defaultChatModel:es(d,o,i)}))}catch(x){a(x instanceof Error?x.message:String(x))}finally{u(!1)}}}function C(N){c(N),j(x=>es(N,x,i))}async function P(N,x,M){if(!s)return null;m(`${N}:${x}`),v(null),a(null);try{return await M()}catch(T){return a(T instanceof Error?T.message:String(T)),null}finally{m(null)}}async function A(N,x){await P(N,"config",async()=>{const M=await E.saveProviderSettings(s,{providers:{[N]:x}});return n(M),M})}async function D(N,x){await P(N,"credential",async()=>{const M=await E.saveProviderCredential(s,N,x);return n(M),M})}async function b(N){await P(N,"credential",async()=>{const x=await E.deleteProviderCredential(s,N,{});return n(x),x})}async function I(N){return P("openai","credential",async()=>{const x=await E.startOpenAiSubscriptionAuth(s,{method:N});return x.method==="browser"?(window.open(x.url,"_blank","noopener,noreferrer"),v("OpenAI ChatGPT login opened in your browser. Return here after authorization.")):(window.open(x.url,"_blank","noopener,noreferrer"),v(`OpenAI device login started. Enter code ${x.userCode}.`)),k(x.expiresAt),x})}async function k(N){if(s)for(;Date.now()<N;){await new Promise(x=>setTimeout(x,2500));try{const x=await E.providerSettings(s);n(x);const M=x.statuses.openai?.credential;if(M?.connected&&M.source==="chatgpt_subscription"){v("OpenAI ChatGPT subscription connected.");return}}catch{}}}async function U(N){await P(N,"models",async()=>{const x=await E.refreshProviderModels(s,N,{force:!0});return n(x.providers),x})}async function p(N){await P(N,"models",async()=>{const x=await E.loadProviderModels(s,N,{limit:500});return n(x.providers),x})}async function w(N,x={}){await P(N,"validate",async()=>{const M=await E.validateProviderCredential(s,N,x);return v(M.ok?`${N} validated${M.modelId?` with ${M.modelId}`:""}.`:M.errors.join(`
|
|
6
|
-
`)||`${N} validation failed.`),n(M.providers),M})}return{defaultModel:o,defaultProvider:d,providerBusy:h,saving:g,validationMessage:f,changeDefaultProvider:C,deleteProviderCredential:b,loadProviderModels:p,refreshProviderModels:U,saveProviderConfig:A,saveProviderCredential:D,saveProviders:y,setDefaultModel:j,startOpenAiSubscriptionAuth:I,validateProvider:w}}function hl({connection:s,enabled:a,onError:t,onToast:n}){const[l,i]=r.useState(null),[d,c]=r.useState(null),[o,j]=r.useState(!1),g=r.useRef(null),u=r.useCallback(async(I={})=>{if(s){I.quiet||c("refresh");try{const k=await E.remoteAccess(s);i(k),t(null)}catch(k){t(k instanceof Error?k.message:String(k))}finally{I.quiet||c(null)}}},[s,t]);r.useEffect(()=>{!a||!s||u({quiet:!0})},[s,a,u]),r.useEffect(()=>()=>{g.current!==null&&window.clearTimeout(g.current)},[]);function h(){g.current!==null&&window.clearTimeout(g.current),j(!1),window.setTimeout(()=>{j(!0),g.current=window.setTimeout(()=>{j(!1),g.current=null},1500)},0)}async function m(){if(t(null),!!s)try{i(await E.remoteAccess(s))}catch{}}async function f(){if(!s)return null;l&&!l.tailscale.running&&h(),c("enable");try{const I=await E.enableRemoteAccess(s);return i(I.status),t(null),I.status.tailscale.running?!I.status.serve.enabled&&I.status.serve.error&&n?.(I.status.serve.setupUrl?"Tailscale Serve needs to be enabled for this tailnet. Copy the Enable Serve link.":I.message||I.status.serve.error,"error"):(h(),n?.(I.message||"Tailscale is not running. Run Tailscale up first.","error")),I.status}catch{return await m(),h(),n?.("Unable to turn on remote access. Run Tailscale up first.","error"),null}finally{c(null)}}async function v(){if(s&&window.confirm("Turn off remote access? This runs tailscale serve reset and clears Tailscale Serve config on this device.")){c("disable");try{const I=await E.disableRemoteAccess(s);i(I.status),t(null)}catch{await m()}finally{c(null)}}}async function y(){l?.remoteWebUrl&&(c("copy-link"),await je(l.remoteWebUrl),c(null))}async function C(){l?.serveCommand&&(c("copy-command"),await je(l.serveCommand),c(null))}async function P(){l?.serve.setupUrl&&(c("copy-serve-setup"),await je(l.serve.setupUrl),c(null))}async function A(){l?.tailscaleUpCommand&&(c("copy-up-command"),await je(l.tailscaleUpCommand),c(null))}async function D(){l?.operatorCommand&&(c("copy-operator"),await je(l.operatorCommand),c(null))}async function b(){if(!l?.serve.enabled){const I=await f();I?.serve.enabled&&I.remoteWebUrl&&await je(I.remoteWebUrl);return}await y()}return{status:l,busy:d,flashTailscaleUp:o,refresh:u,enableRemoteAccess:f,disableRemoteAccess:v,copyRemoteLink:y,copyTailscaleUpCommand:A,copyServeCommand:C,copyServeSetupUrl:P,copyOperatorCommand:D,createRemoteLink:b}}function ml(s){const[a,t]=r.useState(null),[n,l]=r.useState(null),i=r.useCallback(async()=>{if(s.connection){l("load");try{t(await E.datasetStorageState(s.connection)),s.onError(null)}catch(c){s.onError(c instanceof Error?c.message:String(c))}finally{l(null)}}},[s.connection,s.onError]),d=r.useCallback(async c=>{if(!s.connection||!c)return!1;l("save");try{return t(await E.updateDatasetStorage(s.connection,c)),s.onError(null),!0}catch(o){return s.onError(o instanceof Error?o.message:String(o)),!1}finally{l(null)}},[s.connection,s.onError]);return r.useEffect(()=>{s.enabled&&i()},[s.enabled,i]),{state:a,busy:n,refresh:i,save:d}}function pl(s){const{connection:a,enabled:t,onError:n,profileId:l}=s,[i,d]=r.useState(null),[c,o]=r.useState(!1),j=r.useCallback(async()=>{if(a){o(!0);try{d(await E.datasetCatalog(a,l)),n(null)}catch(g){n(gl(g))}finally{o(!1)}}},[a,n,l]);return r.useEffect(()=>{t&&j()},[t,j]),{catalog:i,loading:c,refresh:j}}function gl(s){return s instanceof Error?s.message:String(s)}const fl=r.lazy(()=>La(()=>import("./UsageSettingsSection-Cdc_jGFX.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url).then(s=>({default:s.UsageSettingsSection})));function Ul({payload:s,connection:a,diagnostics:t,onPayload:n,onError:l,onToast:i,onBack:d,onOpenSourceSession:c,onAcceptEvaluationReview:o,onOpenSkill:j,onOpenExtension:g,teamChatCurrentUserId:u,teamChatEnabled:h,teamChatNotificationMode:m,teamChatThreads:f,onTeamChatNotificationModeChange:v,onTeamChatThreadMuteChange:y,diffPanelWidth:C,diffPanelResizing:P,diffPanelExpanded:A,onDiffPanelResizeStart:D,onDiffPanelExpandedChange:b,initialSection:I="account"}){const[k,U]=r.useState(I),[p,w]=r.useState(null),[N,x]=r.useState(!1),M=s?.codex??null,T=r.useMemo(()=>Ia(s?.preferences),[s?.preferences]),q=s?.personalization??$a,V=t??s?.diagnostics??[],R=Ea()&&Ma(a?.platform),S=r.useCallback(H=>{s&&n({...s,providers:H})},[n,s]),O=r.useCallback(H=>{s&&n({...s,preferences:H.preferences})},[n,s]),Q=r.useCallback(H=>{s&&n({...s,extensionCatalog:H})},[n,s]),J=sl({connection:a,onError:l,onPayload:n}),W=ul({connection:a,onError:l,onPayload:n,onPreferences:O,onProviders:S,preferences:T,providers:s?.providers??null}),Z=al({connection:a,onError:l,onPayload:n,onPreferences:O,preferences:T,providers:s?.providers??null}),K=cl({connection:a,enabled:k==="editor",onError:l,onPayload:n,onPreferences:O,onToast:i,preferences:T}),z=dl({connection:a,onError:l,onPayload:n,personalization:q}),se=ol({onError:l,section:k}),ie=hl({connection:a,enabled:k==="remote",onError:l,onToast:i}),ce=k==="dataset-storage",re=ml({connection:a,enabled:ce,onError:l}),te=pl({connection:a,enabled:ce,onError:l,profileId:s?.profile.activeProfile??"default"}),ee=re.save,fe=r.useCallback(async()=>{await Promise.all([re.refresh(),te.refresh()])},[re.refresh,te.refresh]),oe=r.useCallback(()=>k!=="subagents"||!Z.subagentsDirty?!0:window.confirm("You have unsaved changes. Leave Subagents without saving?"),[Z.subagentsDirty,k]),L=r.useCallback(H=>{H!==k&&oe()&&(x(!1),b(!1),U(H))},[oe,b,k]),_=r.useCallback(()=>{oe()&&(x(!1),b(!1),d())},[oe,d,b]);r.useEffect(()=>{U(I)},[I]),r.useEffect(()=>{if(k!=="subagents"||!Z.subagentsDirty)return;const H=ye=>{ye.preventDefault(),ye.returnValue="You have unsaved changes."};return window.addEventListener("beforeunload",H),()=>window.removeEventListener("beforeunload",H)},[Z.subagentsDirty,k]);const F={"--diff-panel-width":`${C}px`},B=k==="harness"&&N&&p;return e.jsxs("div",{className:`settings-shell ${R?"platform-macos":""} ${B?"harness-diff-open":""} ${A?"harness-diff-expanded":""} ${P?"diff-panel-resizing":""}`,style:F,children:[e.jsx("div",{className:"settings-drag-region","aria-hidden":"true"}),e.jsxs("div",{className:"settings-window-controls",children:[k==="harness"?e.jsx("button",{type:"button",className:`topbar-diff-button ${B?"active":""}`,title:`${B?"Hide":"Show"} sidebar`,"aria-label":`${B?"Hide":"Show"} sidebar`,"aria-pressed":!!B,disabled:!p,onClick:()=>x(H=>!H),children:e.jsx(Oa,{size:16})}):null,e.jsx(Ta,{platform:a?.platform})]}),e.jsx(Ct,{section:k,onBack:_,onSectionChange:L}),e.jsx("main",{className:`settings-content ${k==="profile"||k==="harness"?"settings-content-wide":""}`,children:k==="account"?e.jsx(un,{payload:s,connection:a,onPayload:n,onPreferences:O,onError:l,onToast:i,...J}):k==="notifications"?e.jsx(Dn,{currentUserId:u,enabled:h,mode:m,threads:f,onModeChange:v,onThreadMuteChange:y}):k==="harness"?e.jsx(Xt,{connection:a,enabled:k==="harness",onAcceptEvaluationReview:o,onError:l,onDefaultReleaseDiff:w,onOpenSourceSession:c,onOpenReleaseDiff:H=>{w(H),x(!0)},onToast:i}):k==="profile"?e.jsx(Vn,{payload:s,connection:a,onPayload:n,onError:l,onToast:i}):k==="skills"?e.jsx(Pt,{personalSkills:s?.codexPersonalSkills??[],extensionCatalog:s?.extensionCatalog??{rootPath:"",registryPath:"",extensions:[],error:null},connection:a,onExtensionCatalog:Q,onError:l,onToast:i,onOpenSkill:j,onOpenExtension:g}):k==="providers"?e.jsx(ft,{account:s?.account??null,codex:M,providers:s?.providers??null,...W}):k==="dataset-storage"?e.jsx(zt,{state:re.state,catalog:te.catalog,busy:re.busy,catalogLoading:te.loading,onRefresh:fe,onSave:ee}):k==="defaults"?e.jsx(gn,{preferences:T,...Z}):k==="context"?e.jsx(yn,{preferences:T,...Z}):k==="training"?e.jsx(Rt,{connection:a,onError:l,onPreferences:O,preferences:T,providers:s?.providers??null}):k==="subagents"?e.jsx(Nn,{preferences:T,providers:s?.providers??null,...Z}):k==="editor"?e.jsx(vn,{preferences:T,...K}):k==="remote"?e.jsx(vt,{...ie}):k==="usage"?e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"usage-load-state",children:"Loading activity…"}),children:e.jsx(fl,{account:s?.account??null,connection:a,enabled:k==="usage",onError:l,onOpenSourceSession:c})}):k==="personalization"?e.jsx($n,{...z}):e.jsx(fn,{diagnostics:V,...se})}),k==="harness"&&a&&B?e.jsx(el,{connection:a,expanded:A,onResizeStart:D,onToggleExpanded:()=>b(!A),selection:B}):null]})}export{Ul as SettingsView};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as t,c1 as H,X as R,r as o,c2 as le,c3 as K,a0 as N,n as re,at as de,au as ce,c4 as me,c5 as ue,c6 as ge,aA as he,c7 as fe,c8 as xe}from"./index-DHxBMQIJ.js";/* empty css */import{R as E,d as L}from"./MainPane-DlciH8yR.js";import{T as ve,B as T,b as k}from"./MarkdownText-CyOeCVjf.js";import{R as X}from"./refresh-cw-DRN17xPU.js";import{S as Ce}from"./square-pen-ChJgNiDm.js";import{r as ye}from"./index-BtiK52K1.js";import"./cloud-upload-CjLR-8-r.js";import"./folder-tLv6TMN2.js";import"./arrow-up-right-CzBZuWNj.js";import"./square-Cf_AXs4a.js";import"./folder-open-BpUcIJHn.js";function be(e,l){const s=new Set(Array.from(e.matchAll(/(?:^|\s)@([a-zA-Z0-9_-]+)/g),n=>(n[1]??"").toLowerCase()));return l.filter(n=>{const d=n.handle?.toLowerCase(),r=n.name.toLowerCase().replace(/[^a-z0-9_-]+/g,"-");return d&&s.has(d)||s.has(r)}).map(n=>n.userId)}function je(e){return t.jsxs("div",{className:"team-chat-composer-reply",role:"status",children:[t.jsx(E,{size:15,"aria-hidden":"true"}),t.jsxs("button",{type:"button",className:"team-chat-composer-reply-target","aria-label":`Jump to message from ${e.authorLabel}`,onClick:e.onJump,children:[t.jsxs("strong",{children:["Replying to ",e.authorLabel]}),t.jsx("span",{children:H(e.target)})]}),t.jsx("button",{type:"button",className:"team-chat-icon-button","aria-label":"Cancel reply","data-tooltip":"Cancel reply",onClick:e.onCancel,children:t.jsx(R,{size:14})})]})}function we(e){return t.jsxs("button",{type:"button",className:"team-chat-message-reply-quote","aria-label":`Jump to replied message from ${e.authorLabel}`,onClick:e.onJump,children:[t.jsx("strong",{children:e.authorLabel}),t.jsx("span",{children:H(e.target)})]})}function Te(e){const l=o.useRef(null);if(o.useEffect(()=>{if(!e.menu)return;l.current?.focus();const n=()=>e.onClose(),d=r=>{r.key==="Escape"&&n()};return window.addEventListener("click",n),window.addEventListener("blur",n),window.addEventListener("keydown",d),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("click",n),window.removeEventListener("blur",n),window.removeEventListener("keydown",d),window.removeEventListener("scroll",n,!0)}},[e.menu,e.onClose]),!e.menu||typeof document>"u")return null;const s=t.jsx("div",{className:"team-chat-message-context-menu",role:"menu","aria-label":"Message actions",style:{left:e.menu.x,top:e.menu.y},onClick:n=>n.stopPropagation(),children:t.jsxs("button",{ref:l,type:"button",role:"menuitem",onClick:()=>{e.onReply(e.menu.message),e.onClose()},children:[t.jsx(E,{size:14}),"Reply"]})});return ye.createPortal(s,document.body)}function Me(e){const d=e.clientX||e.fallbackX,r=e.clientY||e.fallbackY;return{x:Math.max(8,Math.min(d,e.viewportWidth-150-8)),y:Math.max(8,Math.min(r,e.viewportHeight-42-8))}}function Y(e){return`team-chat-message-${encodeURIComponent(e)}`}function Re(e){const[l,s]=o.useState(!1),[n,d]=o.useState(e.message.body),r=e.message.refs.find(a=>a.refType==="hosted_ai_thread"),m=e.message.refs.find(a=>a.refType==="agent_run"),v=typeof r?.preview.status=="string"?r.preview.status:null,h=typeof e.message.metadata.deliveryStatus=="string"?e.message.metadata.deliveryStatus:null,C=typeof e.message.metadata.uploadProgress=="string"?e.message.metadata.uploadProgress:null,c=!e.message.deletedAt&&!h,g=le(e.message,e.messagesById),b=g?K(g,e.membersById):null;return t.jsxs("article",{id:Y(e.message.id),className:`team-chat-message${e.own?" own":""}`,tabIndex:-1,onContextMenu:a=>{if(!c)return;a.preventDefault();const y=a.currentTarget.getBoundingClientRect();e.onOpenReplyMenu(e.message,{clientX:a.clientX,clientY:a.clientY,fallbackX:y.right-12,fallbackY:y.top+24})},children:[t.jsx(Ie,{member:e.author}),t.jsxs("div",{className:"team-chat-message-content",children:[t.jsxs("header",{children:[t.jsx("strong",{children:e.author?.name??"Team member"}),t.jsx("time",{children:Se(e.message.createdAt)}),e.message.editedAt?t.jsx("span",{children:"edited"}):null,h==="sending"?t.jsx("span",{children:"sending"}):null,h==="sending"&&C?t.jsxs("span",{children:["uploaded ",C]}):null,h==="failed"?t.jsx("span",{className:"failed",children:"not sent"}):null,h==="failed"?t.jsxs("div",{className:"team-chat-message-actions visible",children:[t.jsx("button",{type:"button","data-tooltip":"Retry message","aria-label":"Retry message",onClick:()=>{e.onRetry(e.message)},children:t.jsx(X,{size:13})}),t.jsx("button",{type:"button","data-tooltip":"Remove failed message","aria-label":"Remove failed message",onClick:()=>e.onDismissFailed(e.message),children:t.jsx(R,{size:13})})]}):c||e.own&&!e.message.deletedAt?t.jsxs("div",{className:"team-chat-message-actions",children:[c?t.jsx("button",{type:"button","data-tooltip":"Reply","aria-label":"Reply to message",onClick:()=>e.onReply(e.message),children:t.jsx(E,{size:13})}):null,e.own&&!r?t.jsx("button",{type:"button","data-tooltip":"Edit message","aria-label":"Edit message",onClick:()=>s(!0),children:t.jsx(Ce,{size:13})}):null,e.own?t.jsx("button",{type:"button","data-tooltip":"Delete message","aria-label":"Delete message",onClick:()=>{e.onDelete(e.message)},children:t.jsx(ve,{size:13})}):null]}):null]}),g&&b?t.jsx(we,{authorLabel:b,target:g,onJump:()=>e.onJumpToMessage(g.id)}):null,l?t.jsxs("form",{className:"team-chat-message-edit",onSubmit:a=>{a.preventDefault(),e.onEdit(e.message,n).then(y=>{y&&s(!1)})},children:[t.jsx("textarea",{autoFocus:!0,value:n,onChange:a=>d(a.currentTarget.value),onKeyDown:a=>{a.key==="Escape"&&(a.preventDefault(),s(!1),d(e.message.body))}}),t.jsxs("div",{children:[t.jsx("button",{type:"button",onClick:()=>s(!1),children:"Cancel"}),t.jsx("button",{type:"submit",disabled:!n.trim(),children:"Save"})]})]}):t.jsx("div",{className:e.message.deletedAt?"deleted":"",children:e.message.deletedAt?"Message deleted":e.message.body}),!e.message.deletedAt&&e.message.attachments.length>0?t.jsx(Ae,{message:e.message,connection:e.connection}):null,r?t.jsxs("button",{type:"button",className:"team-chat-thread-link",onClick:()=>{e.onOpenAiThread(r.refId)},children:[t.jsx(N,{size:14}),t.jsx("span",{children:"Thread"}),v&&v!=="completed"?t.jsx("small",{children:J(v)}):null,t.jsx("span",{"aria-hidden":"true",children:"›"})]}):null,m?t.jsxs("button",{type:"button",className:"team-chat-thread-link",onClick:()=>{e.onOpenAgentConversation(m.refId)},children:[t.jsx(T,{size:14}),t.jsx("span",{children:"Agent run"}),t.jsx("small",{children:J(String(m.preview.status??"queued"))}),t.jsx("span",{"aria-hidden":"true",children:"›"})]}):null]})]})}function Ae(e){const l=new Map(Array.isArray(e.message.metadata.localAttachmentPreviews)?e.message.metadata.localAttachmentPreviews.flatMap(s=>{if(!s||typeof s!="object")return[];const n=s;return typeof n.id=="string"&&typeof n.url=="string"?[[n.id,n.url]]:[]}):[]);return t.jsx("div",{className:"team-chat-message-images",children:e.message.attachments.map(s=>t.jsx(Pe,{attachmentId:s.id,alt:s.name,teamId:e.message.teamId,connection:e.connection,localUrl:l.get(s.clientAttachmentId)??null},s.id))})}function Pe(e){const[l,s]=o.useState(e.localUrl),[n,d]=o.useState(!1),r=o.useRef(0);async function m(){if(!e.connection||e.localUrl){e.localUrl||d(!0);return}d(!1);try{const v=await re.teamChatAttachmentDownload(e.connection,e.teamId,e.attachmentId);s(v.url)}catch{s(null),d(!0)}}return o.useEffect(()=>{s(e.localUrl),d(!1),r.current=0,e.localUrl||m()},[e.attachmentId,e.connection,e.localUrl,e.teamId]),l?t.jsx("a",{href:l,target:"_blank",rel:"noreferrer","aria-label":`Open ${e.alt}`,children:t.jsx("img",{src:l,alt:e.alt,loading:"lazy",onError:()=>{if(!e.localUrl&&r.current<1){r.current+=1,m();return}s(null),d(!0)}})}):n?t.jsx("button",{type:"button",className:"team-chat-message-image-retry","aria-label":`Retry ${e.alt}`,"data-tooltip":"Retry image",onClick:()=>{r.current=0,e.localUrl?(d(!1),s(e.localUrl)):m()},children:t.jsx(X,{size:18})}):t.jsx("div",{className:"team-chat-message-image-loading",role:"status","aria-label":`Loading ${e.alt}`})}function J(e){return e==="pending"?"Starting":e==="running"?"Responding":e==="failed"?"Failed":e==="interrupted"?"Interrupted":e==="cancelled"?"Cancelled":e}function Ie({member:e}){if(e?.image)return t.jsx("img",{className:"team-chat-avatar",src:e.image,alt:""});const l=(e?.name??"T").split(/\s+/).slice(0,2).map(s=>s[0]?.toUpperCase()??"").join("");return t.jsx("span",{className:"team-chat-avatar fallback",children:l})}function Se(e){const l=new Date(e);return Number.isFinite(l.getTime())?l.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):""}const U={value:"none",label:"No project",detail:"Team conversation",options:[],busy:!1},z={value:"local",label:"Local",detail:"Local execution",options:[],action:{value:"local",label:"Local",detail:"Local execution",disabled:!1},busy:!1},G=new Set(["codex","openai","xai","openrouter","deepseek","zai","moonshot","together","groq","custom-openai-compatible"]);function ke(e,l){return!l||e===l?e:e?`${l}
|
|
2
|
-
|
|
3
|
-
${e}`:l}function _e(){return t.jsx("section",{className:"team-chat-view team-chat-pro-view","aria-label":"Team Chat",children:t.jsxs("div",{className:"team-chat-pro-content",children:[t.jsx("span",{className:"team-chat-pro-icon","aria-hidden":"true",children:t.jsx(N,{size:22})}),t.jsx("h1",{children:"Team Chat"}),t.jsx("p",{children:"Team Chat is available with Pro mode."}),t.jsx("small",{children:"Create or join a Pro team to chat with teammates, coordinate work, and share agents."})]})})}function Je(e){de(e.error);const[l,s]=o.useState(""),[n,d]=o.useState(!1),[r,m]=o.useState(null),[v,h]=o.useState(null),[C,c]=o.useState(0),g=o.useRef(null),b=o.useRef(!0),a=o.useRef(e.detail?.thread.id??null);a.current=e.detail?.thread.id??null;const{confirmAction:y,confirmDialog:V,resolveConfirmDialog:Q}=ce(),A=o.useMemo(()=>new Map(e.members.map(i=>[i.userId,i])),[e.members]),D=o.useMemo(()=>new Map((e.detail?.messages??[]).map(i=>[i.id,i])),[e.detail?.messages]),Z=e.detail?.thread.id??null,O=r?.threadId===Z?D.get(r.message.id)??r.message:null,M=O?.deletedAt?null:O,j=M?me(M):null,q=j?K(j,A):null,p=e.detail?ue(e.detail.thread,e.currentUserId):"Team",P=G.has(e.provider)?e.provider:"codex",B=P===e.provider?e.model:"gpt-5.6-sol",ee=o.useMemo(()=>ge({hostedActions:e.agents,profile:e.profile,teamId:e.teamId}),[e.agents,e.profile,e.teamId]),te=e.detail?.messages.at(-1)?.sequence??0;o.useEffect(()=>{if(!b.current)return;const i=g.current;i&&(i.scrollTop=i.scrollHeight)},[te,e.detail?.thread.id]);const $=o.useCallback(i=>{i.deletedAt||i.id.startsWith("pending:")||typeof i.metadata.deliveryStatus=="string"||(m({threadId:i.threadId,message:i}),d(!1),h(null),c(f=>f+1))},[]),ne=o.useCallback(()=>h(null),[]),ae=o.useCallback((i,f)=>{const x=Me({...f,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight});h({message:i,...x})},[]),F=o.useCallback(i=>{const f=document.getElementById(Y(i));f&&(f.scrollIntoView({behavior:"smooth",block:"center"}),f.focus({preventScroll:!0}))},[]);async function se(i=[],f=null){if(i.some(u=>u.kind!=="image"||!["image/png","image/jpeg","image/webp","image/gif"].includes(u.mediaType)))return e.showToast("Team chat supports PNG, JPEG, WebP, and GIF images.","error"),!1;let x=f;if(M&&x)return e.showToast("Remove the agent action before replying to a message.","error"),!1;if(fe(x)){const u=xe(x);if(!u)throw new Error("The selected profile agent is missing its profile id.");if(!await y({title:`Publish ${x.label??x.name??"agent"} to Team?`,body:`This will upload the committed agent source to ${e.teamName??"this Team"}, create its hosted runtime, and then send your message.`,confirmLabel:"Publish and send",tone:"default"}))return!1;x=await e.onPublishProfileAgent(u)}const I=x?.approvalPolicy?.risk;let W=null;if(x?.approvalPolicy?.required&&I&&I!=="read"){const u=I==="destructive";if(!await y({title:u?"Approve destructive action?":"Approve external write?",body:`${x.label??x.name??"This agent action"} will use the workspace connection to ${u?"perform a destructive operation":"write external data"}. Approve this run only?`,confirmLabel:u?"Approve destructive action":"Approve write",tone:u?"danger":"default"}))return!1;W=crypto.randomUUID()}const S=l,oe=e.detail?.thread.id??null,w=M,_=()=>{a.current===oe&&(s(u=>ke(u,S)),w&&m(u=>u??{threadId:w.threadId,message:w}))};s(""),w&&m(null);try{const u=await e.onSendMessage({body:S,useModel:n,providerId:P,modelId:B,mentionUserIds:be(S,e.members),attachments:i,replyToMessage:w,selectedActionKey:x?.id??null,approvalId:W});return u?n&&d(!1):_(),u}catch(u){throw _(),u}}return t.jsxs("section",{className:"team-chat-view",children:[t.jsxs("div",{className:"team-chat-main conversation-surface-main",children:[t.jsxs("div",{className:"team-chat-messages conversation-message-scroll",role:"log","aria-live":"polite","aria-relevant":"additions text","aria-busy":e.loading,"aria-label":p,tabIndex:0,ref:g,onScroll:i=>{const f=i.currentTarget;b.current=f.scrollHeight-f.scrollTop-f.clientHeight<72},children:[e.detail?.hasMoreBefore?t.jsx("button",{type:"button",className:"team-chat-load-older",disabled:e.loading,onClick:()=>{e.onLoadMoreMessages()},children:e.loading?"Loading...":"Load older messages"}):null,e.loading&&!e.detail?t.jsx("div",{className:"team-chat-empty",children:"Loading messages..."}):e.detail?.messages.length?e.detail.messages.map(i=>t.jsx(Re,{message:i,author:i.authorUserId?A.get(i.authorUserId)??null:null,own:i.authorUserId===e.currentUserId,onOpenAiThread:e.onOpenAiThread,onOpenAgentConversation:e.onOpenAgentConversation,onEdit:e.onEditMessage,onDelete:e.onDeleteMessage,onRetry:e.onRetryMessage,onDismissFailed:e.onDismissFailedMessage,membersById:A,messagesById:D,onReply:$,onOpenReplyMenu:ae,onJumpToMessage:F,connection:e.connection},i.id)):t.jsx("div",{className:"team-chat-empty",children:"No messages yet"})]}),t.jsxs("div",{className:"team-chat-composer-shell conversation-composer-shell",children:[j&&q?t.jsx(je,{authorLabel:q,target:j,onCancel:()=>m(null),onJump:()=>F(j.id)}):null,t.jsx(L,{mode:"dock",surface:"team",teamUseModel:n,teamUseModelLocked:!!j,teamMentionMembers:e.members.filter(i=>i.userId!==e.currentUserId),actionCatalog:ee,onTeamUseModelChange:d,prompt:l,contextWindowStatus:e.contextWindowStatus,busy:e.busy,running:!1,focusRequestId:C,submissionScopeKey:`team:${e.detail?.thread.id??"none"}`,showProjectFooter:!1,connection:e.connection,providerSettings:e.providerSettings,provider:P,model:B,projectTarget:U,workspaceTarget:z,codexPermissionMode:e.codexPermissionMode,codexReasoningEffort:e.codexReasoningEffort,openPondCommandAccessMode:e.openPondCommandAccessMode,onProviderChange:e.onProviderChange,onProviderSetupOpen:e.onOpenProviderSettings,onProjectTargetChange:()=>{},onWorkspaceTargetChange:()=>{},onModelChange:e.onModelChange,onCodexPermissionModeChange:e.onCodexPermissionModeChange,onCodexReasoningEffortChange:e.onCodexReasoningEffortChange,onOpenPondCommandAccessModeChange:e.onOpenPondCommandAccessModeChange,onPromptChange:s,showToast:e.showToast,onSubmit:async(i,f)=>se(i??[],f??null),onStop:()=>!1})]})]}),t.jsx(Te,{menu:v,onClose:ne,onReply:$}),t.jsx(he,{state:V,onResolve:Q})]})}function He(e){const[l,s]=o.useState(""),n=e.agentConversation,d=o.useRef(null),r=o.useRef(null),m=o.useRef(null),v=n.messages.at(-1)?.sequence??0,h=["pending","queued","running"].includes(n.run.status);o.useEffect(()=>{const c=d.current;c&&(c.scrollTop=c.scrollHeight)},[v,n.run.status]),o.useEffect(()=>{r.current?.focus();const c=g=>{g.key==="Escape"&&(g.preventDefault(),e.onCloseAgentConversation())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[e.onCloseAgentConversation]);async function C(){const c=m.current??crypto.randomUUID();m.current=c;const g=await e.onSendAgentTurn({body:l,clientRequestId:c});return g&&(m.current=null,s("")),g}return t.jsxs("aside",{className:"workspace-diff-panel team-ai-thread-panel","aria-label":`${n.agent.name} run`,children:[e.onResizeStart?t.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize agent run panel",onPointerDown:e.onResizeStart}):null,t.jsxs("header",{children:[t.jsxs("div",{children:[t.jsx(T,{size:15}),t.jsx("strong",{children:n.agent.name}),t.jsx("span",{children:n.run.status})]}),t.jsx("button",{ref:r,type:"button",className:"team-chat-icon-button","aria-label":"Close agent run",onClick:e.onCloseAgentConversation,children:t.jsx(R,{size:16})})]}),t.jsxs("div",{className:"team-ai-thread-messages",ref:d,role:"log","aria-live":"polite","aria-relevant":"additions text",tabIndex:0,children:[n.messages.map(c=>t.jsxs("article",{className:`team-ai-message ${c.role}`,children:[t.jsxs("div",{className:"team-ai-message-author",children:[c.role==="assistant"?t.jsx(T,{size:14}):null,t.jsx("strong",{children:c.role==="user"?"Team member":n.agent.name})]}),t.jsx(k,{connection:e.connection,content:c.body})]},c.id)),n.messages.length===0?t.jsx("div",{className:"team-chat-empty",children:"The agent run is starting."}):null]}),t.jsx("div",{className:"team-ai-thread-composer",children:t.jsx(L,{mode:"dock",surface:"team",teamUseModel:!1,teamUseModelLocked:!0,prompt:l,contextWindowStatus:e.contextWindowStatus,busy:e.busy||h,running:h,submissionScopeKey:`team-agent:${n.conversationId}`,showProjectFooter:!1,connection:e.connection,providerSettings:e.providerSettings,provider:e.provider,model:e.model,projectTarget:U,workspaceTarget:z,codexPermissionMode:e.codexPermissionMode,codexReasoningEffort:e.codexReasoningEffort,openPondCommandAccessMode:e.openPondCommandAccessMode,onProviderChange:e.onProviderChange,onProviderSetupOpen:e.onOpenProviderSettings,onProjectTargetChange:()=>{},onWorkspaceTargetChange:()=>{},onModelChange:e.onModelChange,onCodexPermissionModeChange:e.onCodexPermissionModeChange,onCodexReasoningEffortChange:e.onCodexReasoningEffortChange,onOpenPondCommandAccessModeChange:e.onOpenPondCommandAccessModeChange,onPromptChange:c=>{m.current=null,s(c)},showToast:e.showToast,onSubmit:C,onStop:()=>!1})})]})}function Ke(e){const[l,s]=o.useState(""),n=e.aiThread,d=new Map(e.members.map(a=>[a.userId,a])),r=n.turns.at(-1)??null,m=o.useRef(null),v=n.messages.at(-1)?.sequence??0,h=o.useRef(null),C=G.has(e.provider)?e.provider:"codex",c=C===e.provider?e.model:"gpt-5.6-sol",g=!!(n.activeTurn&&(n.activeTurn.status==="pending"||n.activeTurn.status==="running"));o.useEffect(()=>{const a=m.current;a&&(a.scrollTop=a.scrollHeight)},[v,n.activeTurn?.partialBody]),o.useEffect(()=>{h.current?.focus();const a=y=>{y.key==="Escape"&&(y.preventDefault(),e.onCloseAiThread())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e.onCloseAiThread]);async function b(){const a=await e.onSendAiTurn({body:l,providerId:C,modelId:c});return a&&s(""),a}return t.jsxs("aside",{className:"workspace-diff-panel team-ai-thread-panel","aria-label":"AI thread",children:[e.onResizeStart?t.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-label":"Resize AI thread panel","aria-orientation":"vertical",onPointerDown:e.onResizeStart}):null,t.jsxs("header",{children:[t.jsxs("div",{children:[t.jsx(N,{size:15}),t.jsx("strong",{children:"AI thread"}),t.jsxs("span",{children:[n.messages.length," messages"]})]}),t.jsx("button",{ref:h,type:"button",className:"team-chat-icon-button","data-tooltip":"Close thread","aria-label":"Close thread",onClick:e.onCloseAiThread,children:t.jsx(R,{size:16})})]}),t.jsxs("div",{className:"team-ai-thread-messages",ref:m,role:"log","aria-live":"polite","aria-relevant":"additions text",tabIndex:0,children:[n.messages.map(a=>t.jsxs("article",{className:`team-ai-message ${a.role}`,children:[t.jsxs("div",{className:"team-ai-message-author",children:[a.role==="assistant"?t.jsx(T,{size:14}):null,t.jsx("strong",{children:a.role==="assistant"?"Model":a.createdByUserId?d.get(a.createdByUserId)?.name??"Team member":"Team member"})]}),t.jsx(k,{connection:e.connection,content:a.body})]},a.id)),n.activeTurn?.partialBody?t.jsxs("article",{className:"team-ai-message assistant streaming",children:[t.jsxs("div",{className:"team-ai-message-author",children:[t.jsx(T,{size:14}),t.jsx("strong",{children:"Model"}),t.jsx("span",{children:n.activeTurn.status})]}),t.jsx(k,{connection:e.connection,content:n.activeTurn.partialBody})]}):n.activeTurn?t.jsx("div",{className:"team-ai-running",children:n.activeTurn.status==="pending"?"Starting model...":"Model is responding..."}):r&&["failed","interrupted","cancelled"].includes(r.status)?t.jsx("div",{className:`team-ai-turn-state ${r.status}`,children:r.status==="failed"?"Model response failed":r.status==="interrupted"?"Model response was interrupted":"Model response was cancelled"}):null]}),t.jsx("div",{className:"team-ai-thread-composer",children:t.jsx(L,{mode:"dock",surface:"team",teamUseModel:!0,teamUseModelLocked:!0,prompt:l,contextWindowStatus:e.contextWindowStatus,busy:g,running:g,submissionScopeKey:`team-ai:${n.conversationId}`,showProjectFooter:!1,connection:e.connection,providerSettings:e.providerSettings,provider:C,model:c,projectTarget:U,workspaceTarget:z,codexPermissionMode:e.codexPermissionMode,codexReasoningEffort:e.codexReasoningEffort,openPondCommandAccessMode:e.openPondCommandAccessMode,onProviderChange:e.onProviderChange,onProviderSetupOpen:e.onOpenProviderSettings,onProjectTargetChange:()=>{},onWorkspaceTargetChange:()=>{},onModelChange:e.onModelChange,onCodexPermissionModeChange:e.onCodexPermissionModeChange,onCodexReasoningEffortChange:e.onCodexReasoningEffortChange,onOpenPondCommandAccessModeChange:e.onOpenPondCommandAccessModeChange,onPromptChange:s,showToast:e.showToast,onSubmit:b,onStop:e.onStopAiTurn})})]})}export{He as TeamAgentConversationPanel,Ke as TeamAiThreadPanel,_e as TeamChatProView,Je as TeamChatView,ke as restoreFailedTeamChatPrompt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as h,j as e,aL as f,F as d,b as x,X as j}from"./index-DHxBMQIJ.js";import{C as b}from"./circle-alert-B_xROoPY.js";/* empty css */function N({creation:s,training:r,compact:i=!1,onOpenTraining:t}){const[o,g]=h.useState(""),[c,u]=h.useState(""),n=s.state,a=!!r.busyAction;return h.useEffect(()=>{g(""),u("")},[s.id,n]),e.jsxs("section",{className:i?`composer-create-strip ${k(n)} training-create-strip`:"training-approval","aria-label":"Training task status",children:[i?e.jsxs("div",{className:"composer-create-strip-heading",children:[n==="planning"||n==="materializing"||n==="validating"?e.jsx(f,{className:"composer-create-spin",size:15}):n==="failed"?e.jsx(b,{size:15}):e.jsx(d,{size:15}),e.jsx("span",{children:v(n)}),e.jsx("small",{children:"training"})]}):null,n==="awaiting_disclosure_approval"?e.jsxs("div",{className:i?"composer-create-plan-summary":"training-creation-content",children:[i?null:e.jsx("strong",{children:"Review selected evidence with the authoring model?"}),e.jsxs("p",{children:["Approve sends excerpts from ",s.request.sourceIds.length," explicitly selected source",s.request.sourceIds.length===1?"":"s"," to ",s.request.analysisModel?.providerId,"/",s.request.analysisModel?.modelId," so it can propose a Taskset and grader. This does not start training."]}),e.jsxs("div",{className:i?"composer-create-actions":"training-inline-actions",children:[e.jsxs("button",{className:i?void 0:"training-button",disabled:a,onClick:()=>{r.actions.approveDisclosure(s.id,!0)},children:[e.jsx(x,{size:13}),e.jsx("span",{children:"Approve evidence"})]}),e.jsxs("button",{className:i?void 0:"training-button secondary",disabled:a,onClick:()=>{r.actions.approveDisclosure(s.id,!1)},children:[e.jsx(j,{size:13}),e.jsx("span",{children:"Decline"})]}),i&&t?e.jsxs("button",{disabled:a,onClick:t,children:[e.jsx(d,{size:13}),e.jsx("span",{children:"Open Training"})]}):null]})]}):n==="awaiting_materialization_approval"&&s.proposal?e.jsxs("div",{className:i?"composer-create-plan-summary":"training-creation-content",children:[i?null:e.jsx("strong",{children:s.proposal.name}),e.jsx("p",{children:s.proposal.objective}),e.jsxs("div",{className:"training-creation-plan-facts",children:[e.jsx("span",{children:s.proposal.taskKind.replaceAll("_"," ")}),e.jsxs("span",{children:[s.proposal.proposedGraders.length," grader",s.proposal.proposedGraders.length===1?"":"s"]}),e.jsx("span",{children:s.proposal.proposedMethod.replaceAll("_"," ")})]}),s.request.mode==="customize"?e.jsxs("div",{className:"training-question-answer",children:[e.jsx("input",{value:c,onChange:l=>u(l.target.value),placeholder:"Revise tasks, graders, fixtures, or policy"}),e.jsx("button",{className:i?void 0:"training-button secondary",disabled:!c.trim()||a,onClick:async()=>{const l=c;u(""),await r.actions.chatCreation(s.id,l)},children:"Revise"})]}):null,e.jsxs("div",{className:i?"composer-create-actions":"training-inline-actions",children:[e.jsxs("button",{className:i?void 0:"training-button",disabled:a,onClick:()=>{r.actions.materialize(s.id,!0)},children:[e.jsx(x,{size:13}),e.jsx("span",{children:"Materialize Taskset"})]}),t?e.jsxs("button",{className:i?void 0:"training-button secondary",disabled:a,onClick:t,children:[e.jsx(d,{size:13}),e.jsx("span",{children:"Review details"})]}):null,e.jsxs("button",{className:i?void 0:"training-button secondary",disabled:a,onClick:()=>{r.actions.materialize(s.id,!1)},children:[e.jsx(j,{size:13}),e.jsx("span",{children:"Cancel"})]})]})]}):n==="awaiting_questions"?e.jsx("div",{className:i?"composer-create-question":"training-creation-content",children:(()=>{const l=s.blockingQuestions.find(p=>!p.answer);return l?e.jsxs(e.Fragment,{children:[e.jsx("p",{children:l.prompt}),e.jsxs("div",{className:"training-question-answer",children:[e.jsx("input",{value:o,onChange:p=>g(p.target.value)}),e.jsx("button",{className:i?void 0:"training-button",disabled:!o.trim()||a,onClick:()=>{r.actions.answerQuestions(s.id,{[l.id]:o})},children:"Continue"})]})]}):null})()}):e.jsxs("div",{className:i?"composer-create-status-body":"training-creation-content",children:[e.jsx("p",{children:m(s)}),i&&t?e.jsx("div",{className:"composer-create-actions",children:e.jsxs("button",{onClick:t,children:[e.jsx(d,{size:13}),e.jsx("span",{children:"Open Training"})]})}):null]})]})}function T({creation:s}){return e.jsxs("section",{className:"chat-create-receipt","aria-label":"Training status",children:[e.jsxs("div",{className:"chat-create-receipt-heading",children:[e.jsx(d,{size:14}),e.jsx("span",{children:v(s.state)}),e.jsx("small",{children:"training"})]}),e.jsx("p",{children:s.request.objective??m(s)}),e.jsxs("div",{className:"chat-create-receipt-facts",children:[e.jsxs("span",{children:[s.request.sourceIds.length," selected source",s.request.sourceIds.length===1?"":"s"]}),e.jsx("span",{children:s.request.mode==="customize"?"guided plan":"fast draft"})]})]})}function v(s){return s==="awaiting_disclosure_approval"?"Training evidence review":s==="awaiting_materialization_approval"?"Training plan ready":s==="awaiting_questions"?"Training question":s==="materializing"?"Materializing Taskset":s==="ready"?"Taskset ready":s==="failed"?"Training plan failed":s==="cancelled"?"Training plan cancelled":"Preparing training plan"}function m(s){return s.blockedReason?s.blockedReason:s.state==="ready"?"The reviewed Taskset was materialized. Training still requires a separate approval.":s.state==="cancelled"?"Taskset creation was cancelled.":s.state==="planning"?"The authoring model is proposing tasks, graders, fixtures, and policy boundaries.":`Task Creator is ${s.state.replaceAll("_"," ")}.`}function k(s){return s==="ready"?"success":s==="failed"||s==="cancelled"?"danger":s==="awaiting_disclosure_approval"||s==="awaiting_materialization_approval"||s==="awaiting_questions"?"warning":"info"}export{N as TrainingCreationPanel,T as TrainingStatusReceipt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s,a1 as p,Z as j}from"./index-DHxBMQIJ.js";import{M as x}from"./MarkdownText-CyOeCVjf.js";/* empty css */function b({training:r,sessionId:t,expanded:i,onOpenTraining:d,onResizeStart:o,onToggleExpanded:l}){const n=r.payload?.sources.filter(e=>e.sessionId===t)??[],c=new Set(n.map(e=>e.id)),a=r.payload?.creations.find(e=>e.request.sourceIds.some(h=>c.has(h)))??null;return s.jsxs("aside",{className:`workspace-diff-panel training-draft-panel ${i?"expanded":""}`,"aria-label":"Training task draft",children:[i?null:s.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize task draft",onPointerDown:o}),s.jsxs("div",{className:"workspace-diff-topbar",children:[s.jsx("div",{className:"workspace-diff-tabs",children:s.jsxs("button",{type:"button",className:"workspace-diff-tab active",children:[s.jsx(p,{size:14}),s.jsx("span",{children:"Task draft"})]})}),s.jsx("div",{className:"workspace-diff-toolbar-actions",children:s.jsx("button",{className:"diff-icon-button",type:"button",onClick:l,"aria-label":i?"Dock task draft":"Expand task draft",children:i?s.jsx(x,{size:14}):s.jsx(j,{size:14})})})]}),s.jsxs("div",{className:"training-draft-body",children:[s.jsx("span",{className:"training-eyebrow",children:"Selected chat"}),s.jsx("h2",{children:n[0]?.title??"Not added to training"}),s.jsxs("dl",{className:"training-definition",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Sources"}),s.jsx("dd",{children:n.length})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Status"}),s.jsx("dd",{children:a?.state.replaceAll("_"," ")??"No draft"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Method"}),s.jsx("dd",{children:a?.proposal?.proposedMethod??"Pending"})]})]}),a?.proposal?s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:a.proposal.name}),s.jsx("p",{children:a.proposal.objective})]}):s.jsxs("p",{children:["Add this chat with the sidebar action or run ",s.jsx("code",{children:"/train"}),"."]}),a?.blockedReason?s.jsx("p",{className:"training-draft-warning",children:a.blockedReason}):null,s.jsx("button",{className:"training-button secondary",type:"button",onClick:d,children:"Open Training"})]})]})}export{b as TrainingDraftPanel};
|