openpond 0.0.51 → 0.0.53
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/{app-layer-DCUTQ4TM.js → app-layer-T26MAAGI.js} +2 -2
- package/dist/chunks/{app-server-runtime-Q3IGU5YB.js → app-server-runtime-332SNX3U.js} +6 -6
- package/dist/chunks/{apps-JDRCDAPE.js → apps-7KLTYKHN.js} +2 -2
- package/dist/chunks/{chunk-3PYU3XCS.js → chunk-55KT7K5P.js} +1 -2
- package/dist/chunks/{chunk-PFNX5XOT.js → chunk-6QWTEC2D.js} +1 -1
- package/dist/chunks/{chunk-IGSEFSMA.js → chunk-EIRW6Z6S.js} +1 -1
- package/dist/chunks/{chunk-R4PRXXTC.js → chunk-JSRCXDIL.js} +32 -32
- package/dist/chunks/{chunk-J4LLKY6E.js → chunk-LOYP2CAV.js} +1 -1
- package/dist/chunks/{chunk-CSN3DLWJ.js → chunk-M2OSF2YN.js} +1 -1
- package/dist/chunks/{chunk-UDTHREHB.js → chunk-TSICWFAI.js} +174 -97
- package/dist/chunks/{chunk-35OYRVVH.js → chunk-US7DOPAH.js} +19 -4
- package/dist/chunks/{chunk-V3HADQL5.js → chunk-V7CBYHXO.js} +1 -1
- package/dist/chunks/{chunk-LYEXNSCO.js → chunk-YGYO5AQF.js} +2 -2
- package/dist/chunks/{cli-2FTM4SXH.js → cli-WGGGZFLN.js} +5 -5
- package/dist/chunks/{core-commands-5BRR7TU4.js → core-commands-SND555SC.js} +3 -3
- package/dist/chunks/{desktop-test-EQ2BGZOM.js → desktop-test-WSWXNSFS.js} +2 -2
- package/dist/chunks/{extension-V3NZ7MU7.js → extension-3IKF6YQE.js} +1 -1
- package/dist/chunks/{help-WJBMX37U.js → help-DHGNXUA4.js} +1 -1
- package/dist/chunks/{opchat-W7DSKNNB.js → opchat-XYKT5KKO.js} +2 -2
- package/dist/chunks/{organizations-RHOF5H4Z.js → organizations-HKVC4CSA.js} +4 -4
- package/dist/chunks/{profile-B62ZWPTQ.js → profile-PLWXQHKF.js} +2 -2
- package/dist/chunks/{project-agent-QA25HHDV.js → project-agent-JNSP56KG.js} +2 -2
- package/dist/chunks/{sandbox-command-JFEVPU4X.js → sandbox-command-Z6LNNSSL.js} +2 -2
- package/dist/chunks/{sandbox-template-GEWTAWAR.js → sandbox-template-FVW2UTI4.js} +3 -3
- package/dist/chunks/{src-P2BL3KCV.js → src-2TP42H76.js} +3 -3
- package/dist/chunks/{src-JOTV67WO.js → src-U7KRR6II.js} +387 -599
- package/dist/chunks/{teams-bot-ODSMRNE4.js → teams-bot-FNPT4Q2B.js} +2 -2
- package/dist/chunks/{workspaces-7YHBJG5P.js → workspaces-PYRYXKJI.js} +2 -2
- package/dist/cli.js +13 -13
- package/dist/web/assets/{AppDialog-DylZeiI-.js → AppDialog-BEKS_Ixr.js} +1 -1
- package/dist/web/assets/{AppsView-Bz6C0a1u.js → AppsView-CbuT2sT2.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-xXFxZP2-.js → BrowserSidebar-DgqVeW5u.js} +1 -1
- package/dist/web/assets/{CommandMenu-C9k5VdaR.js → CommandMenu-CQcaEB76.js} +1 -1
- package/dist/web/assets/{CommunityView-DcJlUNgd.js → CommunityView-CYX6iFcg.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-Yt3irJVo.js → ComposerCreateImproveStrip-DY4SQbL4.js} +1 -1
- package/dist/web/assets/{GetStartedView-BhD0Ij7c.js → GetStartedView-DnxeZaBB.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-B-OoSJYT.js → LabModelVersionDetailPage-DYTfYGWv.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-dqdSTmHG.js → LabSkillSidebar-BpD-kjP_.js} +1 -1
- package/dist/web/assets/{LabsRoute-BMPI4vB8.js → LabsRoute-DVC7eZCs.js} +3 -3
- package/dist/web/assets/{MainChatThread-B0ajKiNL.js → MainChatThread-DTiX_8MC.js} +2 -2
- package/dist/web/assets/{MainPane-COs4xUGo.js → MainPane-CNoHJkXy.js} +3 -3
- package/dist/web/assets/{MarkdownText-CzZ60aWs.js → MarkdownText-_JhfBcQL.js} +1 -1
- package/dist/web/assets/{Messages-DGrK4iIj.js → Messages-Bo0-Uvcz.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-BkpgGLSO.js → NativeSkillSidebar-CHQ87FW2.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-BOdCdNcG.js → NewProjectDialog-B-1KuU5u.js} +1 -1
- package/dist/web/assets/{OutputsPage-CSBWIFdi.js → OutputsPage-BSimpEpA.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-PZR6NYJj.js → RightChatPanelStack-B8ZOyuFO.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-WXLnwju_.js → ScheduledWorkPage-Blwy1G8r.js} +1 -1
- package/dist/web/assets/{SettingsView-CQJoEx-y.js → SettingsView-CTLTakyn.js} +3 -3
- package/dist/web/assets/{TeamChatView-BRnuD-lV.js → TeamChatView-dN3fUCbZ.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-B5m8j4_C.js → TerminalOverlay-CPVGeO7U.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-CA1rt7XZ.js → TrainingCreationPanel-ettNNJBP.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-C0p3GP1n.js → TrainingDraftPanel-DUJBuII1.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CpIKj4p-.js → UsageSettingsSection-BOZR3JE_.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-BXk8mdZB.js → WorkspaceDiffPanel-99MjzMkW.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-BO60uNVj.js → WorkspaceEnvironmentMenu-C3s3mTyu.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-hWBfhgaP.js → WorkspaceGitDialogs-BvurXjNP.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-ULPyacH8.js → WorkspaceMonacoEditor-BCXg9mBQ.js} +3 -3
- package/dist/web/assets/{arrow-up-right-CkfCgokz.js → arrow-up-right-DRIT5z3q.js} +1 -1
- package/dist/web/assets/{chevron-up-B5URpgIH.js → chevron-up-Hglu-Zx3.js} +1 -1
- package/dist/web/assets/{circle-alert-CAvjRdlQ.js → circle-alert-Crh3Zr2m.js} +1 -1
- package/dist/web/assets/{cloud-upload-DeQEwz1o.js → cloud-upload-mSm9KIL4.js} +1 -1
- package/dist/web/assets/{cssMode-B4V5a3OX.js → cssMode-CkQ4x6JA.js} +1 -1
- package/dist/web/assets/{folder-DgS_U9Lq.js → folder-DMeODEQJ.js} +1 -1
- package/dist/web/assets/{folder-git-2-BTtbxKWf.js → folder-git-2-B8TV5i0V.js} +1 -1
- package/dist/web/assets/{folder-open-CqjIkaDK.js → folder-open-DXaun_C3.js} +1 -1
- package/dist/web/assets/{folder-plus-CsS0KPW5.js → folder-plus-CUbTwu82.js} +1 -1
- package/dist/web/assets/{git-branch-BN2ijBYt.js → git-branch-CUlgF0kK.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-CVsl4u1O.js → git-commit-horizontal-DAQfyhbS.js} +1 -1
- package/dist/web/assets/{htmlMode-DRksGWJA.js → htmlMode-BfyAplZo.js} +1 -1
- package/dist/web/assets/index-Blindd8c.js +1 -0
- package/dist/web/assets/{index-Cxq5q-6B.js → index-CDJX5ZxL.js} +3 -3
- package/dist/web/assets/{info-DwVXRQli.js → info-Ll3PkeGE.js} +1 -1
- package/dist/web/assets/{jsonMode-eJvgtAy-.js → jsonMode-C9Vibh0P.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-DCk7zUI-.js → lspLanguageFeatures-CFoA9--Z.js} +1 -1
- package/dist/web/assets/{monaco.contribution-B02C5mDa.js → monaco.contribution-C2q-tDuk.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DWVguH46.js → monaco.contribution-C8tRjUqy.js} +2 -2
- package/dist/web/assets/{monaco.contribution-WGT1eYvk.js → monaco.contribution-Co4ZPnCC.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CPnN-lZN.js → monaco.contribution-vWDjhuCI.js} +2 -2
- package/dist/web/assets/{play-DGCzapdE.js → play-lC5KpmRD.js} +1 -1
- package/dist/web/assets/{python-DRPzruv8.js → python-I5xkyvMs.js} +1 -1
- package/dist/web/assets/{refresh-cw-BKF4NhDI.js → refresh-cw-8a_wz4tX.js} +1 -1
- package/dist/web/assets/{save-DQXtfx_4.js → save-Dj9ex3Ce.js} +1 -1
- package/dist/web/assets/{square-Dp5eGICS.js → square-DfEM9XgY.js} +1 -1
- package/dist/web/assets/{square-pen-j-mZ_UkO.js → square-pen-CgX3HoJ6.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-wDmA5YPb.js → toggleHighContrast-BkNzz1Bg.js} +1 -1
- package/dist/web/assets/{tsMode-DELTv39m.js → tsMode-CNwaV0ZJ.js} +1 -1
- package/dist/web/assets/{upload-_rNli8wK.js → upload-Co5zYY9Z.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-DRVUfTbv.js → useLocalAgentSchedules-QY4_XS2F.js} +1 -1
- package/dist/web/assets/{wifi-off-uKPwd8A7.js → wifi-off-CFzyn7Tf.js} +1 -1
- package/dist/web/assets/{workers-CXbluSB3.js → workers-DqFxl1zu.js} +1 -1
- package/dist/web/assets/{yaml-BMqi-3ui.js → yaml-Bbm66uDK.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-SKvMOpII.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CommandMenu-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CommandMenu-CQcaEB76.js","./folder-DMeODEQJ.js","./square-pen-CgX3HoJ6.js","./CommandMenu-hNQCm8mw.css","./SettingsView-CTLTakyn.js","./refresh-cw-8a_wz4tX.js","./MarkdownText-_JhfBcQL.js","./save-Dj9ex3Ce.js","./folder-open-DXaun_C3.js","./chevron-up-Hglu-Zx3.js","./circle-alert-Crh3Zr2m.js","./play-lC5KpmRD.js","./wifi-off-CFzyn7Tf.js","./useLocalAgentSchedules-QY4_XS2F.js","./cloud-upload-mSm9KIL4.js","./folder-git-2-B8TV5i0V.js","./git-commit-horizontal-DAQfyhbS.js","./index-Blindd8c.js","./folder-plus-CUbTwu82.js","./WorkspaceDiffPanel-99MjzMkW.js","./training-model-data-V8276E5q.js","./info-Ll3PkeGE.js","./SettingsView-C39BqlSI.css","./git-dialogs-BZDqS1eT.css","./NewProjectDialog-B-1KuU5u.js","./WorkspaceGitDialogs-BvurXjNP.js","./git-branch-CUlgF0kK.js","./upload-Co5zYY9Z.js","./WorkspaceEnvironmentMenu-C3s3mTyu.js","./square-DfEM9XgY.js","./WorkspaceEnvironmentMenu-DGIFdG3o.css","./MainPane-CNoHJkXy.js","./arrow-up-right-DRIT5z3q.js","./MainPane-BfVDe9f7.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
function FT(e,t){for(var a=0;a<t.length;a++){const i=t[a];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const u=Object.getOwnPropertyDescriptor(i,s);u&&Object.defineProperty(e,s,u.get?u:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const u of s)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function a(s){const u={};return s.integrity&&(u.integrity=s.integrity),s.referrerPolicy&&(u.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?u.credentials="include":s.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(s){if(s.ep)return;s.ep=!0;const u=a(s);fetch(s.href,u)}})();function KT(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Th={exports:{}},zu={};var XS;function GT(){if(XS)return zu;XS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(i,s,u){var d=null;if(u!==void 0&&(d=""+u),s.key!==void 0&&(d=""+s.key),"key"in s){u={};for(var f in s)f!=="key"&&(u[f]=s[f])}else u=s;return s=u.ref,{$$typeof:e,type:i,key:d,ref:s!==void 0?s:null,props:u}}return zu.Fragment=t,zu.jsx=a,zu.jsxs=a,zu}var QS;function ZT(){return QS||(QS=1,Th.exports=GT()),Th.exports}var E=ZT(),Eh={exports:{}},Rt={};var e1;function WT(){if(e1)return Rt;e1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),k=Symbol.for("react.activity"),w=Symbol.iterator;function T(O){return O===null||typeof O!="object"?null:(O=w&&O[w]||O["@@iterator"],typeof O=="function"?O:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},H=Object.assign,W={};function B(O,Z,be){this.props=O,this.context=Z,this.refs=W,this.updater=be||A}B.prototype.isReactComponent={},B.prototype.setState=function(O,Z){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,Z,"setState")},B.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function M(){}M.prototype=B.prototype;function j(O,Z,be){this.props=O,this.context=Z,this.refs=W,this.updater=be||A}var L=j.prototype=new M;L.constructor=j,H(L,B.prototype),L.isPureReactComponent=!0;var D=Array.isArray;function q(){}var $={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function ae(O,Z,be){var ve=be.ref;return{$$typeof:e,type:O,key:Z,ref:ve!==void 0?ve:null,props:be}}function ie(O,Z){return ae(O.type,Z,O.props)}function ue(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function ge(O){var Z={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(be){return Z[be]})}var Te=/\/+/g;function Be(O,Z){return typeof O=="object"&&O!==null&&O.key!=null?ge(""+O.key):Z.toString(36)}function Pe(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(q,q):(O.status="pending",O.then(function(Z){O.status==="pending"&&(O.status="fulfilled",O.value=Z)},function(Z){O.status==="pending"&&(O.status="rejected",O.reason=Z)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function U(O,Z,be,ve,fe){var ee=typeof O;(ee==="undefined"||ee==="boolean")&&(O=null);var Ce=!1;if(O===null)Ce=!0;else switch(ee){case"bigint":case"string":case"number":Ce=!0;break;case"object":switch(O.$$typeof){case e:case t:Ce=!0;break;case y:return Ce=O._init,U(Ce(O._payload),Z,be,ve,fe)}}if(Ce)return fe=fe(O),Ce=ve===""?"."+Be(O,0):ve,D(fe)?(be="",Ce!=null&&(be=Ce.replace(Te,"$&/")+"/"),U(fe,Z,be,"",function(We){return We})):fe!=null&&(ue(fe)&&(fe=ie(fe,be+(fe.key==null||O&&O.key===fe.key?"":(""+fe.key).replace(Te,"$&/")+"/")+Ce)),Z.push(fe)),1;Ce=0;var je=ve===""?".":ve+":";if(D(O))for(var et=0;et<O.length;et++)ve=O[et],ee=je+Be(ve,et),Ce+=U(ve,Z,be,ee,fe);else if(et=T(O),typeof et=="function")for(O=et.call(O),et=0;!(ve=O.next()).done;)ve=ve.value,ee=je+Be(ve,et++),Ce+=U(ve,Z,be,ee,fe);else if(ee==="object"){if(typeof O.then=="function")return U(Pe(O),Z,be,ve,fe);throw Z=String(O),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return Ce}function le(O,Z,be){if(O==null)return O;var ve=[],fe=0;return U(O,ve,"","",function(ee){return Z.call(be,ee,fe++)}),ve}function he(O){if(O._status===-1){var Z=O._result;Z=Z(),Z.then(function(be){(O._status===0||O._status===-1)&&(O._status=1,O._result=be)},function(be){(O._status===0||O._status===-1)&&(O._status=2,O._result=be)}),O._status===-1&&(O._status=0,O._result=Z)}if(O._status===1)return O._result.default;throw O._result}var Me=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},Ue={map:le,forEach:function(O,Z,be){le(O,function(){Z.apply(this,arguments)},be)},count:function(O){var Z=0;return le(O,function(){Z++}),Z},toArray:function(O){return le(O,function(Z){return Z})||[]},only:function(O){if(!ue(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Rt.Activity=k,Rt.Children=Ue,Rt.Component=B,Rt.Fragment=a,Rt.Profiler=s,Rt.PureComponent=j,Rt.StrictMode=i,Rt.Suspense=b,Rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Rt.__COMPILER_RUNTIME={__proto__:null,c:function(O){return $.H.useMemoCache(O)}},Rt.cache=function(O){return function(){return O.apply(null,arguments)}},Rt.cacheSignal=function(){return null},Rt.cloneElement=function(O,Z,be){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var ve=H({},O.props),fe=O.key;if(Z!=null)for(ee in Z.key!==void 0&&(fe=""+Z.key),Z)!X.call(Z,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&Z.ref===void 0||(ve[ee]=Z[ee]);var ee=arguments.length-2;if(ee===1)ve.children=be;else if(1<ee){for(var Ce=Array(ee),je=0;je<ee;je++)Ce[je]=arguments[je+2];ve.children=Ce}return ae(O.type,fe,ve)},Rt.createContext=function(O){return O={$$typeof:d,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:u,_context:O},O},Rt.createElement=function(O,Z,be){var ve,fe={},ee=null;if(Z!=null)for(ve in Z.key!==void 0&&(ee=""+Z.key),Z)X.call(Z,ve)&&ve!=="key"&&ve!=="__self"&&ve!=="__source"&&(fe[ve]=Z[ve]);var Ce=arguments.length-2;if(Ce===1)fe.children=be;else if(1<Ce){for(var je=Array(Ce),et=0;et<Ce;et++)je[et]=arguments[et+2];fe.children=je}if(O&&O.defaultProps)for(ve in Ce=O.defaultProps,Ce)fe[ve]===void 0&&(fe[ve]=Ce[ve]);return ae(O,ee,fe)},Rt.createRef=function(){return{current:null}},Rt.forwardRef=function(O){return{$$typeof:f,render:O}},Rt.isValidElement=ue,Rt.lazy=function(O){return{$$typeof:y,_payload:{_status:-1,_result:O},_init:he}},Rt.memo=function(O,Z){return{$$typeof:p,type:O,compare:Z===void 0?null:Z}},Rt.startTransition=function(O){var Z=$.T,be={};$.T=be;try{var ve=O(),fe=$.S;fe!==null&&fe(be,ve),typeof ve=="object"&&ve!==null&&typeof ve.then=="function"&&ve.then(q,Me)}catch(ee){Me(ee)}finally{Z!==null&&be.types!==null&&(Z.types=be.types),$.T=Z}},Rt.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Rt.use=function(O){return $.H.use(O)},Rt.useActionState=function(O,Z,be){return $.H.useActionState(O,Z,be)},Rt.useCallback=function(O,Z){return $.H.useCallback(O,Z)},Rt.useContext=function(O){return $.H.useContext(O)},Rt.useDebugValue=function(){},Rt.useDeferredValue=function(O,Z){return $.H.useDeferredValue(O,Z)},Rt.useEffect=function(O,Z){return $.H.useEffect(O,Z)},Rt.useEffectEvent=function(O){return $.H.useEffectEvent(O)},Rt.useId=function(){return $.H.useId()},Rt.useImperativeHandle=function(O,Z,be){return $.H.useImperativeHandle(O,Z,be)},Rt.useInsertionEffect=function(O,Z){return $.H.useInsertionEffect(O,Z)},Rt.useLayoutEffect=function(O,Z){return $.H.useLayoutEffect(O,Z)},Rt.useMemo=function(O,Z){return $.H.useMemo(O,Z)},Rt.useOptimistic=function(O,Z){return $.H.useOptimistic(O,Z)},Rt.useReducer=function(O,Z,be){return $.H.useReducer(O,Z,be)},Rt.useRef=function(O){return $.H.useRef(O)},Rt.useState=function(O){return $.H.useState(O)},Rt.useSyncExternalStore=function(O,Z,be){return $.H.useSyncExternalStore(O,Z,be)},Rt.useTransition=function(){return $.H.useTransition()},Rt.version="19.2.7",Rt}var t1;function zv(){return t1||(t1=1,Eh.exports=WT()),Eh.exports}var _=zv();const YT=KT(_),sG=FT({__proto__:null,default:YT},[_]);var Mh={exports:{}},Du={},Ph={exports:{}},Oh={};var n1;function JT(){return n1||(n1=1,(function(e){function t(U,le){var he=U.length;U.push(le);e:for(;0<he;){var Me=he-1>>>1,Ue=U[Me];if(0<s(Ue,le))U[Me]=le,U[he]=Ue,he=Me;else break e}}function a(U){return U.length===0?null:U[0]}function i(U){if(U.length===0)return null;var le=U[0],he=U.pop();if(he!==le){U[0]=he;e:for(var Me=0,Ue=U.length,O=Ue>>>1;Me<O;){var Z=2*(Me+1)-1,be=U[Z],ve=Z+1,fe=U[ve];if(0>s(be,he))ve<Ue&&0>s(fe,be)?(U[Me]=fe,U[ve]=he,Me=ve):(U[Me]=be,U[Z]=he,Me=Z);else if(ve<Ue&&0>s(fe,he))U[Me]=fe,U[ve]=he,Me=ve;else break e}}return le}function s(U,le){var he=U.sortIndex-le.sortIndex;return he!==0?he:U.id-le.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var b=[],p=[],y=1,k=null,w=3,T=!1,A=!1,H=!1,W=!1,B=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function L(U){for(var le=a(p);le!==null;){if(le.callback===null)i(p);else if(le.startTime<=U)i(p),le.sortIndex=le.expirationTime,t(b,le);else break;le=a(p)}}function D(U){if(H=!1,L(U),!A)if(a(b)!==null)A=!0,q||(q=!0,ge());else{var le=a(p);le!==null&&Pe(D,le.startTime-U)}}var q=!1,$=-1,X=5,ae=-1;function ie(){return W?!0:!(e.unstable_now()-ae<X)}function ue(){if(W=!1,q){var U=e.unstable_now();ae=U;var le=!0;try{e:{A=!1,H&&(H=!1,M($),$=-1),T=!0;var he=w;try{t:{for(L(U),k=a(b);k!==null&&!(k.expirationTime>U&&ie());){var Me=k.callback;if(typeof Me=="function"){k.callback=null,w=k.priorityLevel;var Ue=Me(k.expirationTime<=U);if(U=e.unstable_now(),typeof Ue=="function"){k.callback=Ue,L(U),le=!0;break t}k===a(b)&&i(b),L(U)}else i(b);k=a(b)}if(k!==null)le=!0;else{var O=a(p);O!==null&&Pe(D,O.startTime-U),le=!1}}break e}finally{k=null,w=he,T=!1}le=void 0}}finally{le?ge():q=!1}}}var ge;if(typeof j=="function")ge=function(){j(ue)};else if(typeof MessageChannel<"u"){var Te=new MessageChannel,Be=Te.port2;Te.port1.onmessage=ue,ge=function(){Be.postMessage(null)}}else ge=function(){B(ue,0)};function Pe(U,le){$=B(function(){U(e.unstable_now())},le)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_next=function(U){switch(w){case 1:case 2:case 3:var le=3;break;default:le=w}var he=w;w=le;try{return U()}finally{w=he}},e.unstable_requestPaint=function(){W=!0},e.unstable_runWithPriority=function(U,le){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var he=w;w=U;try{return le()}finally{w=he}},e.unstable_scheduleCallback=function(U,le,he){var Me=e.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?Me+he:Me):he=Me,U){case 1:var Ue=-1;break;case 2:Ue=250;break;case 5:Ue=1073741823;break;case 4:Ue=1e4;break;default:Ue=5e3}return Ue=he+Ue,U={id:y++,callback:le,priorityLevel:U,startTime:he,expirationTime:Ue,sortIndex:-1},he>Me?(U.sortIndex=he,t(p,U),a(b)===null&&U===a(p)&&(H?(M($),$=-1):H=!0,Pe(D,he-Me))):(U.sortIndex=Ue,t(b,U),A||T||(A=!0,q||(q=!0,ge()))),U},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(U){var le=w;return function(){var he=w;w=le;try{return U.apply(this,arguments)}finally{w=he}}}})(Oh)),Oh}var a1;function XT(){return a1||(a1=1,Ph.exports=JT()),Ph.exports}var jh={exports:{}},ja={};var o1;function QT(){if(o1)return ja;o1=1;var e=zv();function t(b){var p="https://react.dev/errors/"+b;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+b+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var i={d:{f:a,r:function(){throw Error(t(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},s=Symbol.for("react.portal");function u(b,p,y){var k=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:k==null?null:""+k,children:b,containerInfo:p,implementation:y}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(b,p){if(b==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return ja.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,ja.createPortal=function(b,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return u(b,p,null,y)},ja.flushSync=function(b){var p=d.T,y=i.p;try{if(d.T=null,i.p=2,b)return b()}finally{d.T=p,i.p=y,i.d.f()}},ja.preconnect=function(b,p){typeof b=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(b,p))},ja.prefetchDNS=function(b){typeof b=="string"&&i.d.D(b)},ja.preinit=function(b,p){if(typeof b=="string"&&p&&typeof p.as=="string"){var y=p.as,k=f(y,p.crossOrigin),w=typeof p.integrity=="string"?p.integrity:void 0,T=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?i.d.S(b,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:k,integrity:w,fetchPriority:T}):y==="script"&&i.d.X(b,{crossOrigin:k,integrity:w,fetchPriority:T,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},ja.preinitModule=function(b,p){if(typeof b=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=f(p.as,p.crossOrigin);i.d.M(b,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(b)},ja.preload=function(b,p){if(typeof b=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,k=f(y,p.crossOrigin);i.d.L(b,y,{crossOrigin:k,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},ja.preloadModule=function(b,p){if(typeof b=="string")if(p){var y=f(p.as,p.crossOrigin);i.d.m(b,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(b)},ja.requestFormReset=function(b){i.d.r(b)},ja.unstable_batchedUpdates=function(b,p){return b(p)},ja.useFormState=function(b,p,y){return d.H.useFormState(b,p,y)},ja.useFormStatus=function(){return d.H.useHostTransitionStatus()},ja.version="19.2.7",ja}var i1;function eE(){if(i1)return jh.exports;i1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),jh.exports=QT(),jh.exports}var r1;function tE(){if(r1)return Du;r1=1;var e=XT(),t=zv(),a=eE();function i(n){var o="https://react.dev/errors/"+n;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)o+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+n+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function u(n){var o=n,r=n;if(n.alternate)for(;o.return;)o=o.return;else{n=o;do o=n,(o.flags&4098)!==0&&(r=o.return),n=o.return;while(n)}return o.tag===3?r:null}function d(n){if(n.tag===13){var o=n.memoizedState;if(o===null&&(n=n.alternate,n!==null&&(o=n.memoizedState)),o!==null)return o.dehydrated}return null}function f(n){if(n.tag===31){var o=n.memoizedState;if(o===null&&(n=n.alternate,n!==null&&(o=n.memoizedState)),o!==null)return o.dehydrated}return null}function b(n){if(u(n)!==n)throw Error(i(188))}function p(n){var o=n.alternate;if(!o){if(o=u(n),o===null)throw Error(i(188));return o!==n?null:n}for(var r=n,c=o;;){var m=r.return;if(m===null)break;var h=m.alternate;if(h===null){if(c=m.return,c!==null){r=c;continue}break}if(m.child===h.child){for(h=m.child;h;){if(h===r)return b(m),n;if(h===c)return b(m),o;h=h.sibling}throw Error(i(188))}if(r.return!==c.return)r=m,c=h;else{for(var C=!1,P=m.child;P;){if(P===r){C=!0,r=m,c=h;break}if(P===c){C=!0,c=m,r=h;break}P=P.sibling}if(!C){for(P=h.child;P;){if(P===r){C=!0,r=h,c=m;break}if(P===c){C=!0,c=h,r=m;break}P=P.sibling}if(!C)throw Error(i(189))}}if(r.alternate!==c)throw Error(i(190))}if(r.tag!==3)throw Error(i(188));return r.stateNode.current===r?n:o}function y(n){var o=n.tag;if(o===5||o===26||o===27||o===6)return n;for(n=n.child;n!==null;){if(o=y(n),o!==null)return o;n=n.sibling}return null}var k=Object.assign,w=Symbol.for("react.element"),T=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),j=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),ae=Symbol.for("react.activity"),ie=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function ge(n){return n===null||typeof n!="object"?null:(n=ue&&n[ue]||n["@@iterator"],typeof n=="function"?n:null)}var Te=Symbol.for("react.client.reference");function Be(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===Te?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case H:return"Fragment";case B:return"Profiler";case W:return"StrictMode";case D:return"Suspense";case q:return"SuspenseList";case ae:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case A:return"Portal";case j:return n.displayName||"Context";case M:return(n._context.displayName||"Context")+".Consumer";case L:var o=n.render;return n=n.displayName,n||(n=o.displayName||o.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case $:return o=n.displayName||null,o!==null?o:Be(n.type)||"Memo";case X:o=n._payload,n=n._init;try{return Be(n(o))}catch{}}return null}var Pe=Array.isArray,U=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},Me=[],Ue=-1;function O(n){return{current:n}}function Z(n){0>Ue||(n.current=Me[Ue],Me[Ue]=null,Ue--)}function be(n,o){Ue++,Me[Ue]=n.current,n.current=o}var ve=O(null),fe=O(null),ee=O(null),Ce=O(null);function je(n,o){switch(be(ee,o),be(fe,n),be(ve,null),o.nodeType){case 9:case 11:n=(n=o.documentElement)&&(n=n.namespaceURI)?_S(n):0;break;default:if(n=o.tagName,o=o.namespaceURI)o=_S(o),n=xS(o,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Z(ve),be(ve,n)}function et(){Z(ve),Z(fe),Z(ee)}function We(n){n.memoizedState!==null&&be(Ce,n);var o=ve.current,r=xS(o,n.type);o!==r&&(be(fe,n),be(ve,r))}function Ve(n){fe.current===n&&(Z(ve),Z(fe)),Ce.current===n&&(Z(Ce),Pu._currentValue=he)}var lt,st;function Je(n){if(lt===void 0)try{throw Error()}catch(r){var o=r.stack.trim().match(/\n( *(at )?)/);lt=o&&o[1]||"",st=-1<r.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+lt+n+st}var Y=!1;function oe(n,o){if(!n||Y)return"";Y=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(o){var He=function(){throw Error()};if(Object.defineProperty(He.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(He,[])}catch(Ae){var we=Ae}Reflect.construct(n,[],He)}else{try{He.call()}catch(Ae){we=Ae}n.call(He.prototype)}}else{try{throw Error()}catch(Ae){we=Ae}(He=n())&&typeof He.catch=="function"&&He.catch(function(){})}}catch(Ae){if(Ae&&we&&typeof Ae.stack=="string")return[Ae.stack,we.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=c.DetermineComponentFrameRoot(),C=h[0],P=h[1];if(C&&P){var J=C.split(`
|
|
@@ -129,13 +129,13 @@ Do not use emojis.
|
|
|
129
129
|
Use concise explanations, but include necessary specifics.
|
|
130
130
|
Surface risks, constraints, and verification steps.`}],nb=l().trim().min(1).max(120),XN=v({id:nb,name:l(),source:I(["built_in","custom"]).default("custom"),description:l(),content:l()}),m_=v({activeTemplateId:nb.default(JN),customized:z().default(!1),soul:l(),soulPath:l().nullable(),updatedAt:l().nullable(),templates:x(XN).default(()=>[...bw])}),QN=v({id:l(),host:l(),port:S(),startedAt:l(),storePath:l(),version:l(),runtimeVersion:l()}),ab=I(["chat","work","development"]);I(["chat","models","development"]);const ez="work",ut=l().trim().min(1).nullable(),ri=$e(l(),Fe()).default({}),tz=I(["direct_prompt_create","context_backed_create","create_as_agent","workflow_suggestion","local_extend","hosted_create","local_import","direct_prompt_improve","context_backed_improve","hosted_improve","lab_create","lab_improve","training"]),yw=I(["/create","/edit","openpond extend","create_as_agent","suggest_workflow","local_import","lab_create","lab_improve","training"]),nz=I(["create","improve","import","promote"]),az=I(["planning","awaiting_questions","awaiting_plan_approval","paused","applying_source","running_checks","evaluating","awaiting_promotion","opening_pull_request","pull_request_open","reconciling_release","released","rejected","ready","ready_local","pushing_hosted","running_hosted_checks","published_hosted","blocked","failed","cancelled"]),Em=I(["always_require_plan_approval","approval_already_granted"]);I(["local_profile","hosted_profile","promote_local_to_hosted","managed_artifact"]);const oz=Ja("kind",[v({kind:N("local"),sourceAuthority:N("local_profile"),activeProfile:l().trim().min(1).nullable(),repoPath:ut,sourcePath:ut,localHead:ut,confirmationPolicy:Em.default("always_require_plan_approval")}),v({kind:N("hosted"),sourceAuthority:N("hosted_profile"),teamId:ut,projectId:ut,activeProfile:l().trim().min(1).nullable(),sourceRef:ut,baseSha:ut,confirmationPolicy:Em.default("always_require_plan_approval")}),v({kind:N("promote_local_to_hosted"),sourceAuthority:N("promote_local_to_hosted"),teamId:ut,projectId:ut,activeProfile:l().trim().min(1).nullable(),repoPath:ut,sourcePath:ut,localHead:ut,hostedHead:ut,sourceRef:ut,confirmationPolicy:Em.default("always_require_plan_approval")}),v({kind:N("managed_artifact"),sourceAuthority:N("managed_artifact"),activeProfile:l().trim().min(1).nullable(),confirmationPolicy:Em.default("always_require_plan_approval")})]),iz=v({id:ut,kind:I(["user","system","automation"]).default("user"),label:ut}),rz=v({profileId:l().trim().min(1),conversationId:ut,originTurnId:ut,projectId:ut,targetProject:v({id:ut,name:ut,workspacePath:ut,sourceRef:ut,baseSha:ut}).nullable()}),Vu=v({messageIds:x(l().trim().min(1)).default([]),conversationExcerpts:x(v({messageId:ut,role:l().trim().min(1).nullable(),excerpt:l().trim().min(1),reason:l().trim().min(1).nullable()})).default([]),attachments:x(v({id:ut,name:l().trim().min(1),mediaType:ut,ref:ut})).default([]),apps:x(v({id:l().trim().min(1),name:l().trim().min(1),connectionId:ut,required:z().default(!1)})).default([]),tools:x(v({name:l().trim().min(1),inputSummary:ut,outputSummary:ut,artifactRefs:x(l().trim().min(1)).default([]),sideEffects:x(l().trim().min(1)).default([])})).default([]),signalRefs:x(l().trim().min(1)).default([]),evalRefs:x(l().trim().min(1)).default([]),targetRepoAssumptions:x(l().trim().min(1)).default([])}),gc={id:ut,displayName:ut},ob=Ja("kind",[v({kind:N("unselected"),...gc}),v({kind:N("agent"),...gc,defaultActionKey:ut}),v({kind:N("skill"),...gc,skillName:ut}),v({kind:N("extension"),...gc,slot:ut}),v({kind:N("model"),...gc,trainingPlanId:ut,trainingJobId:ut,artifactId:ut}),v({kind:N("configuration"),...gc,key:ut})]),av=I(["agent","skill","extension","model","configuration"]),sz=v({schemaVersion:N("openpond.createImprove.evidenceSnapshot.v1"),id:l().trim().min(1),contentHash:l().trim().min(8),consent:v({status:I(["granted","denied","revoked"]),scope:I(["metadata_only","selected_turns","full_session","direct_intent"]),reviewedBy:ut,reviewedAt:l().trim().min(1)}),sources:x(v({kind:I(["signal","conversation","direct_correction","manual_intent","artifact"]),id:l().trim().min(1),sourceHash:l().trim().min(8),excerptRef:ut})).min(1),reviewerIntent:l().trim().min(1),createdAt:l().trim().min(1),metadata:ri}),Sw=v({schemaVersion:N("openpond.createImprove.tasksetRef.v1"),id:l().trim().min(1),revision:S().int().positive(),contentHash:l().trim().min(8),evidenceSnapshotIds:x(l().trim().min(1)).min(1),policyBoundary:v({policyVisibleFields:x(l().trim().min(1)).default([]),privilegedFields:x(l().trim().min(1)).default([]),hiddenGraderRefs:x(l().trim().min(1)).default([]),connectedAppScopes:x(l().trim().min(1)).default([])}),targetRecommendation:v({kind:av,rationale:x(l().trim().min(1)).min(1),confidence:S().min(0).max(1)}),authoringSplitRefs:x(l().trim().min(1)).default([]),privateSplitRefs:x(l().trim().min(1)).default([]),approvedBy:ut,approvedAt:l().trim().min(1),metadata:ri}),lz=v({kind:I(["npm_package","runtime_tool","setup_command","secret","integration","volume","target_project","external_service"]),name:l().trim().min(1),status:I(["declared","required","blocked","satisfied"]).default("declared"),detail:ut,metadata:ri}),cz=v({mode:I(["chat","direct_action","chat_and_direct_actions"]),label:l().trim().min(1),detail:l().trim().min(1),defaultActionKey:ut,directActionHint:ut,artifactPolicy:l().trim().min(1)}),uz=v({schemaVersion:N("openpond.createImprove.plan.v1"),id:l().trim().min(1),runId:l().trim().min(1),status:I(["draft","pending_approval","approved","rejected","cancelled","superseded"]).default("pending_approval"),objective:l().trim().min(1),summary:l().trim().min(1),capturedContextSummary:l().trim().min(1),defaultChatAction:v({key:ut,label:ut,required:z().default(!0)}),sourcePlan:x(v({path:l().trim().min(1),operation:I(["create","update","delete","inspect"]),reason:l().trim().min(1)})).default([]),requirements:x(lz).default([]),checks:x(v({name:l().trim().min(1),command:l().trim().min(1),required:z().default(!0)})).default([]),approvalId:ut,approvedAt:ut,editedFromPlanId:ut,metadata:ri,createdAt:l().trim().min(1),updatedAt:l().trim().min(1)}),dz=v({id:l().trim().min(1),label:l().trim().min(1),value:l().trim().min(1),description:ut,metadata:ri}),mz=v({value:l().trim().min(1),label:ut,detail:ut,answeredAt:l().trim().min(1),metadata:ri}),fz=v({id:l().trim().min(1),kind:I(["single_choice","free_text"]).default("single_choice"),title:l().trim().min(1),prompt:l().trim().min(1),required:z().default(!0),status:I(["pending","answered","skipped"]).default("pending"),options:x(dz).default([]),answer:mz.nullable().default(null),metadata:ri}),pz=v({schemaVersion:N("openpond.createImprove.workflowCapture.v1"),id:l().trim().min(1),runId:l().trim().min(1),command:yw,objective:l().trim().min(1),conversationExcerpts:Vu.shape.conversationExcerpts,attachments:Vu.shape.attachments,apps:Vu.shape.apps,tools:Vu.shape.tools,sideEffects:x(l().trim().min(1)).default([]),profileActions:x(l().trim().min(1)).default([]),externalProviders:x(l().trim().min(1)).default([]),environmentVariables:x(l().trim().min(1)).default([]),files:x(l().trim().min(1)).default([]),schedules:x(l().trim().min(1)).default([]),webhooks:x(l().trim().min(1)).default([]),channelTargets:x(l().trim().min(1)).default([]),outputArtifacts:x(l().trim().min(1)).default([]),targetRepoAssumptions:x(l().trim().min(1)).default([]),traceRefs:x(l().trim().min(1)).default([]),metadata:ri,createdAt:l().trim().min(1)}),_w=v({provider:N("github"),number:S().int().positive(),url:l().url(),state:I(["open","merged","closed"]),baseBranch:l().trim().min(1),headBranch:l().trim().min(1),mergeCommit:ut,openedAt:l().trim().min(1),updatedAt:l().trim().min(1)}),hz=v({baseBranch:l().trim().min(1),baseCommit:l().trim().min(1),branch:l().trim().min(1),headCommit:ut,remoteName:l().trim().min(1).default("origin"),remoteUrl:ut,worktreePath:ut,changedPaths:x(l().trim().min(1)).default([]),diffStat:ut,pullRequest:_w.nullable().default(null)}),gz=v({id:l().trim().min(1),target:ob,status:I(["draft","authored","checking","evaluated","accepted","rejected","failed"]),git:hz.nullable().default(null),parentCandidateId:ut.default(null),tasksetRef:Sw.nullable().default(null),authoringModelRef:ut.default(null),allowedPaths:x(l().trim().min(1)).default([]),sourceRefs:x(l().trim().min(1)).default([]),artifactRefs:x(l().trim().min(1)).default([]),checkRefs:x(l().trim().min(1)).default([]),evaluationReceiptRefs:x(l().trim().min(1)).default([]),createdAt:l().trim().min(1),updatedAt:l().trim().min(1),metadata:ri}),vz=v({id:l().trim().min(1),candidateId:ut,target:ob,evaluatorKind:I(["agent_sdk","taskset","extension","skill","configuration","checks"]).default("checks"),subject:I(["active","candidate","post_release","standalone"]).default("standalone"),sourceCommit:ut.default(null),sourceBranch:ut.default(null),tasksetId:ut.default(null),tasksetHash:ut.default(null),taskAttemptRefs:x(l().trim().min(1)).default([]),status:I(["pending","passed","failed","blocked"]),publishGate:I(["passed","failed","not_applicable"]).default("not_applicable"),summaryCounts:v({total:S().int().nonnegative(),passed:S().int().nonnegative(),failed:S().int().nonnegative()}).nullable().default(null),evalRefs:x(l().trim().min(1)).default([]),artifactRefs:x(l().trim().min(1)).default([]),summary:ut,createdAt:l().trim().min(1),metadata:ri}),bz=v({mode:I(["foreground","background"]).default("background"),pauseAllowed:z().default(!0),cancellationAllowed:z().default(!0)}),yz=v({mode:I(["single","bounded","until_evals_pass"]).default("single"),maximumAttempts:S().int().min(1).max(20).default(1),currentAttempt:S().int().min(0).max(20).default(0)}),Sz=v({kind:I(["candidate_authoring","local_apply","hosted_turn","training_job","evaluation","pull_request","release"]),id:l().trim().min(1),status:ut,metadata:ri}),_z=v({status:I(["not_requested","pending","released","rejected","rolled_back"]),profileCommit:ut,profileTag:ut,releaseReceiptRef:ut,pullRequest:_w.nullable().default(null),updatedAt:ut}),gd=v({schemaVersion:N("openpond.createImprove.run.v1"),id:l().trim().min(1),revision:S().int().nonnegative(),operation:nz,surface:tz,command:yw,objective:l().trim().min(1),state:az,adapter:oz,actor:iz,scope:rz,context:Vu,target:ob,evidenceSnapshots:x(sz).default([]),tasksetRef:Sw.nullable().default(null),targetSelection:v({status:I(["open","recommended","confirmed"]),preselectedKind:av.nullable(),confirmedKind:av.nullable()}).nullable().default(null),plan:uz.nullable(),workflowCapture:pz.nullable(),executionPolicy:bz.default({mode:"background",pauseAllowed:!0,cancellationAllowed:!0}),iterationPolicy:yz.default({mode:"single",maximumAttempts:1,currentAttempt:0}),approvalIds:x(l().trim().min(1)).default([]),questionIds:x(l().trim().min(1)).default([]),questions:x(fz).default([]),candidates:x(gz).default([]),evaluationReceipts:x(vz).default([]),checkRefs:x(l().trim().min(1)).default([]),sourceRefs:x(l().trim().min(1)).default([]),externalExecutionRefs:x(Sz).default([]),localProfileCommit:ut,hostedSourceCommit:ut,hostedSourceRef:ut,releaseOutcome:_z.default({status:"not_requested",profileCommit:null,profileTag:null,releaseReceiptRef:null,pullRequest:null,updatedAt:null}),blockedReason:ut,appliedActionIds:x(l().trim().min(1)).max(200).default([]),metadata:ri,createdAt:l().trim().min(1),updatedAt:l().trim().min(1)}),$i={runId:l().trim().min(1),expectedRevision:S().int().nonnegative(),actionId:l().trim().min(1)};Ja("type",[v({...$i,type:N("answer_question"),questionId:l().trim().min(1),value:l().trim().min(1)}),v({...$i,type:N("approve_plan")}),v({...$i,type:N("revise_plan"),revision:l().trim().min(1)}),v({...$i,type:N("cancel"),reason:ut.optional().default(null)}),v({...$i,type:N("pause")}),v({...$i,type:N("resume")}),v({...$i,type:N("open_pull_request"),candidateId:l().trim().min(1)}),v({...$i,type:N("apply_candidate"),candidateId:l().trim().min(1)}),v({...$i,type:N("reject_candidate"),candidateId:l().trim().min(1),reason:ut.optional().default(null)}),v({...$i,type:N("reconcile_pull_request"),candidateId:l().trim().min(1)})]);v({schemaVersion:N("openpond.createImprove.runList.v1"),runs:x(gd),generatedAt:l().trim().min(1)});function AG(e){const t=cz.safeParse(e?.actionShape);return t.success?t.data:null}const Il=v({source:I(["local","github","openpond_git"]),repositoryId:l().trim().min(1),profileId:l().trim().min(1)}),xz=v({ref:Il,revision:l().nullable(),sourceHash:l()}),kz=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),wz=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function Cz(e){const t=typeof e=="string"?new TextEncoder().encode(e):e,a=Math.ceil((t.byteLength+9)/64)*64,i=new Uint8Array(a);i.set(t),i[t.byteLength]=128;const s=t.byteLength*8,u=new DataView(i.buffer);u.setUint32(a-8,Math.floor(s/4294967296),!1),u.setUint32(a-4,s>>>0,!1);const d=new Uint32Array(kz),f=new Uint32Array(64);for(let b=0;b<a;b+=64){for(let B=0;B<16;B+=1)f[B]=u.getUint32(b+B*4,!1);for(let B=16;B<64;B+=1){const M=f[B-15],j=f[B-2],L=qi(M,7)^qi(M,18)^M>>>3,D=qi(j,17)^qi(j,19)^j>>>10;f[B]=f[B-16]+L+f[B-7]+D>>>0}let p=d[0],y=d[1],k=d[2],w=d[3],T=d[4],A=d[5],H=d[6],W=d[7];for(let B=0;B<64;B+=1){const M=T&A^~T&H,j=p&y^p&k^y&k,L=qi(p,2)^qi(p,13)^qi(p,22),D=qi(T,6)^qi(T,11)^qi(T,25),q=W+D+M+wz[B]+f[B]>>>0,$=L+j>>>0;W=H,H=A,A=T,T=w+q>>>0,w=k,k=y,y=p,p=q+$>>>0}d[0]=d[0]+p>>>0,d[1]=d[1]+y>>>0,d[2]=d[2]+k>>>0,d[3]=d[3]+w>>>0,d[4]=d[4]+T>>>0,d[5]=d[5]+A>>>0,d[6]=d[6]+H>>>0,d[7]=d[7]+W>>>0}return Array.from(d,b=>b.toString(16).padStart(8,"0")).join("")}function qi(e,t){return e>>>t|e<<32-t}const Iz=2e3,xw=25e7,it=l().trim().min(1).max(240),mt=l().regex(/^[a-f0-9]{64}$/),tn=l().datetime({offset:!0}),ko=$e(l(),Fe()).default({}),ht=v({id:it,contentHash:mt}).strict(),Vi=v({id:it,path:l().trim().min(1).max(Iz).refine(Rz),contentHash:mt,sizeBytes:S().int().nonnegative().max(xw),mediaType:l().trim().min(1).max(200),visibility:I(["policy","verifier","host_private"])}).strict(),nf=v({id:it,contentHash:mt,mediaType:l().trim().min(1).max(200).nullable().default(null),sizeBytes:S().int().nonnegative().max(xw).nullable().default(null)}).strict(),Tf=I(["policy_failure","grader_failure","environment_failure","infrastructure_failure","timeout","cancelled"]);function kw(e){return`${JSON.stringify(ov(e),null,2)}
|
|
131
131
|
`}function Az(e){return Cz(e)}function Kt(e){return Az(kw(e))}function Rz(e){const t=e.replaceAll("\\","/");return!t||t.startsWith("/")||t.includes("\0")?!1:!t.split("/").some(a=>!a||a==="."||a==="..")}function ov(e){return Array.isArray(e)?e.map(ov):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).sort(([t],[a])=>t.localeCompare(a)).map(([t,a])=>[t,ov(a)]))}const Kc=$e(l(),Fe()).default({}),ti=S().int().nonnegative(),Ef=l().trim().min(1).max(1e5),ww=v({kind:I(["personal","team"]),id:it}).strict(),Tz=v({name:it,release:ht.nullable(),revision:ti}).strict();v({schemaVersion:N("openpond.harnessWorkspace.v1"),id:it,ownerScope:ww,name:l().trim().min(1).max(240),location:I(["local","hosted"]),sourceRevision:l().trim().min(1).max(500),revision:ti,dirty:z(),currentChannel:Tz,createdAt:tn,updatedAt:tn,metadata:Kc}).strict();const Qu=I(["runtime","memory","prompt","skill","agent","product","taskset","training"]),Cw=I(["text_instruction","memory","dependency_selection","executable_code","business_logic","financial_logic","permission","connected_app","publication","deployment","training","model_binding","team_or_global"]),Iw=v({id:it,route:Qu,operation:I(["create","update","delete"]),target:l().trim().min(1).max(2e3),summary:l().trim().min(1).max(2e3),content:l().max(1e6).nullable(),contentHash:mt.nullable(),effects:x(Cw).min(1).max(20)}).strict().superRefine((e,t)=>{if(e.operation==="delete"){(e.content!==null||e.contentHash!==null)&&t.addIssue({code:"custom",message:"delete edits cannot include replacement content",path:["content"]});return}if(e.content===null||e.contentHash===null){t.addIssue({code:"custom",message:"create and update edits require content and contentHash",path:["content"]});return}const a=Kt(e.content);e.contentHash!==a&&t.addIssue({code:"custom",message:`edit contentHash is ${e.contentHash}; expected ${a}`,path:["contentHash"]})}),Aw=v({workspaceId:it,revision:ti,sourceRevision:l().trim().min(1).max(500),channelRevision:ti}).strict(),Tr=v({id:it,revision:ti,contentHash:mt}).strict(),Ez=v({schemaVersion:N("openpond.harnessTurnSnapshot.v1"),workspaceId:it,workspaceRevision:ti,sourceRevision:l().trim().min(1).max(500),channelName:it,channelRevision:ti,harnessRelease:ht,toolCatalogHash:mt.nullable().optional(),overlay:Tr.nullable().optional().default(null)}).strict(),Mz=v({schemaVersion:N("openpond.harnessRunOverlay.v1"),id:it,runId:it,baseHarnessRelease:ht,workspace:Aw,revision:ti,status:I(["active","frozen","abandoned"]),edits:x(Iw).max(1e3),createdAt:tn,updatedAt:tn,metadata:Kc}).strict();Mz.extend({contentHash:mt}).strict();const Rw=v({kind:I(["tool_event","recovery","validation","user_turn","work_output","work_receipt"]),id:it,contentHash:mt.nullable()}).strict(),Tw=v({id:it,kind:I(["dependency","schema","package","file_render","skill","prompt","business_formula","targeted_evaluation","observed_recovery","memory","component_activation"]),description:Ef,required:z()}).strict(),Pz=v({schemaVersion:N("openpond.harnessImprovementProposal.v1"),id:it,overlay:Tr,baseHarnessRelease:ht,expectedWorkspace:Aw,requestedScope:I(["personal","team","global"]),route:Qu,risk:I(["low","review","restricted"]),effects:x(Cw).min(1).max(20),evidence:x(Rw).min(1).max(1e3),edits:x(Iw).min(1).max(1e3),validationPlan:x(Tw).min(1).max(100),expectedOutcome:Ef,createdAt:tn,metadata:Kc}).strict().superRefine((e,t)=>{const a=new Set(e.effects);for(const[i,s]of e.edits.entries()){s.route!==e.route&&t.addIssue({code:"custom",message:"every edit route must match the proposal route",path:["edits",i,"route"]});for(const u of s.effects)a.has(u)||t.addIssue({code:"custom",message:`edit effect ${u} is missing from proposal effects`,path:["edits",i,"effects"]})}new Set(e.validationPlan.map(i=>i.id)).size!==e.validationPlan.length&&t.addIssue({code:"custom",message:"validation plan ids must be unique",path:["validationPlan"]})});Pz.extend({contentHash:mt}).strict();const Oz=v({schemaVersion:N("openpond.harnessTargetedValidationReceipt.v1"),id:it,proposal:ht,validationId:it,kind:Tw.shape.kind,status:I(["passed","failed","blocked","skipped"]),summary:Ef,evidenceRefs:x(Rw).max(1e3),createdAt:tn,metadata:Kc}).strict();Oz.extend({contentHash:mt}).strict();const jz=I(["advanced","retained","conflict","rolled_back"]),Nz=v({schemaVersion:N("openpond.harnessAdvanceReceipt.v1"),id:it,workspaceId:it,ownerScope:ww,proposal:ht.nullable(),expectedWorkspaceRevision:ti,observedWorkspaceRevision:ti,previousChannelRevision:ti,nextChannelRevision:ti,previousRelease:ht.nullable(),nextRelease:ht.nullable(),validationReceipts:x(ht).max(100),decision:jz,reason:Ef,rollbackOf:ht.nullable(),createdAt:tn,metadata:Kc}).strict().superRefine((e,t)=>{const a=e.nextChannelRevision===e.previousChannelRevision+1;["advanced","rolled_back"].includes(e.decision)!==a&&t.addIssue({code:"custom",message:"only successful advancement or rollback increments the channel revision",path:["nextChannelRevision"]}),e.decision==="rolled_back"&&e.rollbackOf===null&&t.addIssue({code:"custom",message:"rollback receipts require rollbackOf",path:["rollbackOf"]}),e.decision!=="rolled_back"&&e.rollbackOf!==null&&t.addIssue({code:"custom",message:"rollbackOf is only valid for rollback receipts",path:["rollbackOf"]})});Nz.extend({contentHash:mt}).strict();const zz=v({schemaVersion:N("openpond.harnessOverlayMergeReceipt.v1"),id:it,workspaceId:it,baseHarnessRelease:ht,leftOverlay:Tr,rightOverlay:Tr,decision:I(["merged","conflict"]),mergedOverlay:Tr.nullable(),conflictTargets:x(l().trim().min(1).max(2e3)).max(1e3),requiresRevalidation:N(!0),createdAt:tn,metadata:Kc}).strict().superRefine((e,t)=>{e.decision==="merged"!=(e.mergedOverlay!==null)&&t.addIssue({code:"custom",message:"merged decisions require a merged overlay; conflicts cannot provide one",path:["mergedOverlay"]}),e.decision==="conflict"!=e.conflictTargets.length>0&&t.addIssue({code:"custom",message:"conflict decisions require conflict targets and merged decisions cannot include them",path:["conflictTargets"]})});zz.extend({contentHash:mt}).strict();const Ew=I(["openpond.lab"]),iv=v({id:l(),experience:ab.default(ez),provider:Cl,modelRef:ma.nullable().optional(),openPondCommandAccessMode:pd.default(fd),systemKind:Ew.nullable().optional(),hiddenFromDefaultSidebar:z().optional(),parentSessionId:l().nullable().optional(),parentTurnId:l().nullable().optional(),subagentRunId:l().nullable().optional(),subagentRoleId:Fc.nullable().optional(),subagentDelegationMode:kf.nullable().optional(),title:l(),appId:l().nullable(),appName:l().nullable(),workspaceKind:hd.optional(),workspaceId:l().nullable().optional(),workspaceName:l().nullable().optional(),localProjectId:l().nullable().optional(),cloudProjectId:l().nullable().optional(),cloudTeamId:l().nullable().optional(),currentProfile:Il.nullable().optional(),metadata:$e(l(),Fe()).optional(),cwd:l().nullable(),codexThreadId:l().nullable(),createdAt:l(),updatedAt:l(),status:I(["idle","active","failed","closed"]),runtimeSeconds:S().int().nonnegative().optional(),runtimeRunningSince:l().nullable().optional(),pinned:z(),savedForLater:z().optional(),archived:z(),order:S()});v({id:l(),sessionId:l(),providerTurnId:l().nullable(),modelRef:ma.nullable().optional(),prompt:l(),startedAt:l(),completedAt:l().nullable(),status:I(["in_progress","completed","failed","interrupted"]),error:l().nullable(),metadata:$e(l(),Fe()).optional().default({}),createImproveRun:gd.nullable().optional().default(null),profileSnapshot:xz.nullable().optional(),harnessSnapshot:Ez.nullable().optional()});const Dz=v({id:l(),sessionId:l(),turnId:l().nullable(),providerRequestId:Ua([l(),S()]),kind:I(["command","file_change","permissions","user_input","create_plan","subagent_patch_apply","legacy_exec","legacy_patch"]),title:l(),detail:l(),status:I(["pending","accepted","accepted_for_session","declined","cancelled"]),createdAt:l()}),Uz=v({key:I(["files","diffs","checks","deploys","sources","schedules","tool_runs","logs","app_config"]),label:l(),status:I(["placeholder","available","error"]),summary:l()}),Mw=v({id:l().trim().min(1).max(191),agentId:l().trim().min(1).max(191).optional().nullable(),sourcePath:l().trim().min(1).max(2e3).optional().nullable(),sourceActionId:l().trim().min(1).max(191).optional().nullable(),name:l().trim().min(1).max(191).optional().nullable(),label:l().trim().min(1).max(160).optional().nullable(),description:l().trim().max(1e3).optional().nullable(),visibility:l().trim().max(80).optional().nullable(),inputSchema:Ua([l().trim().max(191),$e(l(),Fe())]).optional().nullable(),outputSchema:Ua([l().trim().max(191),$e(l(),Fe())]).optional().nullable(),approvalPolicy:$e(l(),Fe()).optional().nullable(),artifactPolicy:$e(l(),Fe()).optional().nullable(),setupRequirements:x($e(l(),Fe())).optional(),mcp:$e(l(),Fe()).optional().nullable(),schedulePolicy:$e(l(),Fe()).optional().nullable(),trace:$e(l(),Fe()).optional().nullable(),implementation:$e(l(),Fe()).optional().nullable(),invokesModel:z().optional()}),Lz=v({command:I(["inspect","build","validate","eval","traces","run"]),status:I(["passed","failed"]),checkedAt:l(),exitCode:S().nullable().optional(),sourceHead:l().nullable().optional()}),Hz=v({id:l(),name:l(),path:l(),enabled:z()}),$z=v({name:l(),description:l(),path:l(),scope:N("profile"),enabled:z(),sourcePath:l(),charCount:S(),sourceHash:l(),validationStatus:I(["valid","warning","error"]),validationMessages:x(l()),resourceFiles:x(l()).optional().default([])}),qz=v({id:l(),name:l(),path:l(),agentId:l().nullable(),sourcePath:l()}),Pw=v({path:l(),originalPath:l().nullable().optional(),indexStatus:l().nullable(),worktreeStatus:l().nullable(),status:l(),category:I(["added","modified","deleted","renamed","untracked","changed"])}),Bz=v({isRepo:z(),branch:l().nullable(),head:l().nullable(),shortHead:l().nullable(),dirty:z(),upstream:l().nullable(),ahead:S().nullable(),behind:S().nullable(),remoteUrl:l().nullable(),files:x(Pw),error:l().nullable()}),Vz=v({actionCount:S(),generatedAt:l().nullable(),manifestPath:l().nullable(),registryPath:l().nullable(),stale:z(),error:l().nullable()}),Fz=v({skillCount:S(),generatedAt:l().nullable(),stale:z(),error:l().nullable()}),f_=v({ref:l(),source:I(["action_catalog","source_upload_metadata"]),actionId:l().nullable(),kind:l().nullable(),label:l(),status:l(),required:z(),blocking:z()}),Kz=v({status:I(["ready","setup_required","blocked"]),requirementCount:S(),blockingCount:S(),optionalMissingCount:S(),readyCount:S(),requirements:x(f_),blockingRequirements:x(f_)}),Gz=v({changedAgents:x(l()),newAgents:x(l()),deletedAgents:x(l()),changedSkills:x(l()).optional().default([]),changedActions:x(l()),changedExtensions:x(l()),setupChanges:x(l()),envRequirementChanges:x(l()),files:x(Pw)}),Zz=v({status:l(),agentId:l().nullable().optional(),deployPlanStatus:l().nullable().optional(),canRun:z().nullable().optional(),canDeploy:z().nullable().optional(),sourceRef:l().nullable().optional(),sourceCommitSha:l().nullable().optional(),manifestHash:l().nullable().optional(),manifestPath:l().nullable().optional(),setupCommands:x(l()).optional(),validationCommands:x(l()).optional(),requiredChecks:x(l()).optional(),evalNames:x(l()).optional(),blockedReasons:x(l()).optional(),staleReasons:x(l()).optional(),runtimeId:l().nullable().optional(),sandboxId:l().nullable().optional(),traceArtifactRefs:x(l()).optional(),evalResultArtifactRefs:x(l()).optional(),validatorArtifactRefs:x(l()).optional(),checkedAt:l().nullable().optional(),error:l().nullable().optional()}),Wz=v({status:l(),agentId:l().nullable().optional(),runtimeAgentId:l().nullable().optional(),projectId:l().nullable().optional(),sourceRoot:l().nullable().optional(),sourceRef:l().nullable().optional(),sourceCommitSha:l().nullable().optional(),manifestHash:l().nullable().optional(),manifestPath:l().nullable().optional(),manifestSyncedAt:l().nullable().optional(),fileCount:S().nullable().optional(),totalBytes:S().nullable().optional(),generatedManifestPath:l().nullable().optional(),synthesizedOpenPondYaml:z().nullable().optional(),uploadMetadataPath:l().nullable().optional(),setupCommands:x(l()).optional(),validationCommands:x(l()).optional(),materializedAt:l().nullable().optional(),error:l().nullable().optional()}),Yz=v({status:l(),agentId:l().nullable().optional(),snapshotId:l().nullable().optional(),sourceRef:l().nullable().optional(),sourceCommitSha:l().nullable().optional(),manifestHash:l().nullable().optional(),manifestPath:l().nullable().optional(),buildStatus:l().nullable().optional(),validationStatus:l().nullable().optional(),evalStatus:l().nullable().optional(),publishedAt:l().nullable().optional(),error:l().nullable().optional()}),Jz=v({status:l(),agentId:l().nullable().optional(),runId:l().nullable().optional(),runtimeId:l().nullable().optional(),sandboxId:l().nullable().optional(),sourceRef:l().nullable().optional(),sourceCommitSha:l().nullable().optional(),manifestHash:l().nullable().optional(),setupGateStatus:l().nullable().optional(),setupRequirementRefs:x(l()).optional(),artifactRefs:x(l()).optional(),traceArtifactRefs:x(l()).optional(),evalArtifactRefs:x(l()).optional(),startedAt:l().nullable().optional(),completedAt:l().nullable().optional(),error:l().nullable().optional()}),Xz=v({teamId:l().nullable(),projectId:l().nullable(),sourceRef:l().nullable(),sourceCommitSha:l().nullable(),lastPushedAt:l().nullable(),lastPushedLocalHead:l().nullable(),lastPushedHostedHead:l().nullable(),promotionStatus:l().nullable().optional().default(null),hostedRunStatus:l().nullable().optional().default(null),hostedRunAgentId:l().nullable().optional().default(null),hostedRunId:l().nullable().optional().default(null),hostedRunAt:l().nullable().optional().default(null),hostedSourceMaterialization:Wz.nullable().optional().default(null),hostedSourceCheck:Zz.nullable().optional().default(null),hostedPublish:Yz.nullable().optional().default(null),hostedRun:Jz.nullable().optional().default(null)}),Qz=v({state:I(["none","ready","dirty","pending_commit","error"]),message:l(),agentCount:S(),actionCount:S(),defaultAction:l().nullable(),checkFresh:z(),checkStaleReason:l().nullable(),localHead:l().nullable(),hostedHead:l().nullable()}),Ow=v({mode:I(["none","local"]),repoPath:l().nullable(),activeProfile:l().nullable(),sourcePath:l().nullable(),manifestPath:l().nullable(),agents:x(Hz),skills:x($z).optional().default([]),evals:x(qz).optional().default([]),git:Bz.nullable(),catalog:Vz,skillCatalog:Fz.optional().default({skillCount:0,generatedAt:null,stale:!0,error:null}),actionCatalog:x(Mw),sourceSetupRequirements:x($e(l(),Fe())),setupGate:Kz,diff:Gz,hosted:Xz.nullable(),summary:Qz,lastCheck:Lz.nullable(),error:l().nullable()}),eD=v({ref:Il,name:l(),repoPath:l(),sourcePath:l().nullable(),state:Ow}),tD=v({lastUsed:Il.nullable(),profiles:x(eD)});function nD(){return{lastUsed:null,profiles:[]}}function aD(){return{mode:"none",repoPath:null,activeProfile:null,sourcePath:null,manifestPath:null,agents:[],skills:[],evals:[],git:null,catalog:{actionCount:0,generatedAt:null,manifestPath:null,registryPath:null,stale:!0,error:null},skillCatalog:{skillCount:0,generatedAt:null,stale:!0,error:null},actionCatalog:[],sourceSetupRequirements:[],setupGate:{status:"ready",requirementCount:0,blockingCount:0,optionalMissingCount:0,readyCount:0,requirements:[],blockingRequirements:[]},diff:{changedAgents:[],newAgents:[],deletedAgents:[],changedSkills:[],changedActions:[],changedExtensions:[],setupChanges:[],envRequirementChanges:[],files:[]},hosted:null,summary:{state:"none",message:"No active OpenPond profile.",agentCount:0,actionCount:0,defaultAction:null,checkFresh:!1,checkStaleReason:"No active profile.",localHead:null,hostedHead:null},lastCheck:null,error:null}}const oD=v({name:l(),description:l(),path:l(),sourcePath:l(),enabled:z(),charCount:S().int().nonnegative(),sourceHash:l(),validationStatus:I(["valid","error"]),validationMessages:x(l()),resourceFiles:x(l()),updatedAt:l().nullable()}),iD=I(["codex","profile","extension"]);v({skillName:l(),scope:iD,path:l(),byteSize:S().int().nonnegative(),isBinary:z(),content:l().nullable()});const rD=[{name:"openpond-taskset-authoring",description:"Create, improve, inspect, test, or prepare an OpenPond Taskset from a capability, Profile Agent, consented evidence, or imported data.",path:"skills/openpond-taskset-authoring/SKILL.md",scope:"profile",enabled:!0,sourcePath:"bundled://openpond",charCount:0,sourceHash:"bundled",validationStatus:"valid",validationMessages:[],resourceFiles:["references/task-design.md","references/graders-and-rewards.md","references/method-selection.md","references/privacy-and-provenance.md"]},{name:"openpond-skill-authoring",description:"Create, copy, adapt, review, or update OpenPond Profile skill packages from slash commands or ordinary authoring requests.",path:"skills/openpond-skill-authoring/SKILL.md",scope:"profile",enabled:!0,sourcePath:"bundled://openpond",charCount:0,sourceHash:"bundled",validationStatus:"valid",validationMessages:[],resourceFiles:["references/skill-package-layout.md","references/copying-and-adaptation.md","references/validation-and-repair.md","scripts/validate-skill.mjs"]},{name:"openpond-agent-authoring",description:"Create, improve, review, or repair source-backed OpenPond Profile Agents and Agent SDK projects.",path:"skills/openpond-agent-authoring/SKILL.md",scope:"profile",enabled:!0,sourcePath:"bundled://openpond",charCount:0,sourceHash:"bundled",validationStatus:"valid",validationMessages:[],resourceFiles:["references/profile-layout.md","references/action-and-chat-design.md","references/integrations-and-setup.md","references/validation-and-repair.md"]}],sD=v({name:l(),description:l(),relativePath:l(),sourcePath:l(),charCount:S().int().nonnegative(),sourceHash:l(),resourceFiles:x(l()),validationStatus:I(["valid","error"]),validationMessages:x(l())}),jw=v({id:l(),source:N("github"),owner:l(),repo:l(),repositoryUrl:l().url(),requestedRef:l(),resolvedCommit:l(),sourcePath:l(),readmePath:l().nullable(),installedAt:l(),updatedAt:l(),packageHash:l(),skills:x(sD),validationStatus:I(["valid","error"]),validationMessages:x(l())});jw.omit({installedAt:!0,updatedAt:!0,sourcePath:!0}).extend({sourcePath:Tk()});const lD=v({rootPath:l(),registryPath:l(),extensions:x(jw),error:l().nullable()});v({source:l().trim().min(1),ref:l().trim().min(1).optional()});const cD=v({latestSequence:S().int().nonnegative(),oldestSequence:S().int().nonnegative(),totalEvents:S().int().nonnegative(),limit:S().int().nonnegative(),hasMoreBefore:z()});v({server:QN,account:BN,codex:VN,preferences:d_.optional().default(()=>d_.parse({})),providers:O1.optional().default(()=>O1.parse({})),personalization:m_.optional().default(()=>m_.parse({soul:bw[0].content,soulPath:null,updatedAt:null})),apps:x(Xj),localProjects:x(aN).optional().default([]),cloudProjects:x(nN).optional().default([]),profile:Ow.optional().default(aD),profileLibrary:tD.optional().default(nD),codexPersonalSkills:x(oD).optional().default([]),extensionCatalog:lD.optional().default({rootPath:"",registryPath:"",extensions:[],error:null}),codexHistorySessions:x(iv).optional().default([]),sidebarAppPreferences:zN,sidebarFileBookmarks:x(gw).optional().default([]),appsError:l().nullable(),appsMeta:u_,accountMeta:u_,sessions:x(iv),events:x(j1),eventWindow:cD.optional(),approvals:x(Dz),placeholders:x(Uz),diagnostics:x(j1)});const ib=I(["openpond_hosted","local_byok","codex_app_server","unknown"]),Nw=I(["provider_usage","codex_context_usage","missing"]),uD=I(["chat_turn","tool_loop","slash_command","create_improve_planner","harness_refiner","context_compaction","subagent","codex_context","other"]),zw=I(["user_facing","background","system"]),Dw=I(["started","completed","failed","interrupted"]),rb=I(["composer_selection","prompt_parse","server_parser","model_tool","api"]),Uw=I(["chat","settings","goal","create_improve","compaction","system"]),Lw=I(["direct_chat","tool_loop","slash_command","planner","summary","scan","subagent","other"]),dD=v({surface:Uw,workflowKind:Lw,sessionId:l().trim().min(1).nullable().default(null),turnId:l().trim().min(1).nullable().default(null),goalId:l().trim().min(1).nullable().default(null),subagentRunId:l().trim().min(1).nullable().default(null),subagentRoleId:l().trim().min(1).nullable().default(null),createImproveRunId:l().trim().min(1).nullable().default(null),commandName:l().trim().min(1).max(160).nullable().default(null),commandSource:rb.nullable().default(null),appId:l().trim().min(1).nullable().default(null),workspaceKind:hd.nullable().default(null),workspaceId:l().trim().min(1).nullable().default(null),localProjectId:l().trim().min(1).nullable().default(null),cloudProjectId:l().trim().min(1).nullable().default(null),sourceEventSequence:S().int().nonnegative().nullable().default(null)}),mD=v({surface:Uw.optional(),workflowKind:Lw.optional(),goalId:l().trim().min(1).nullable().optional(),subagentRunId:l().trim().min(1).nullable().optional(),subagentRoleId:l().trim().min(1).nullable().optional(),createImproveRunId:l().trim().min(1).nullable().optional(),commandName:l().trim().min(1).max(160).nullable().optional(),commandSource:rb.nullable().optional()}).strict(),Gc=Ua([Cl,N("unknown")]),fD=v({id:l().trim().min(1),requestId:l().trim().min(1),requestOrdinal:S().int().nonnegative(),sessionId:l().trim().min(1).nullable(),turnId:l().trim().min(1).nullable(),provider:Gc,model:l().trim().min(1),route:ib,source:Nw,requestKind:uD,visibility:zw,status:Dw,startedAt:l().trim().min(1),completedAt:l().trim().min(1).nullable(),durationMs:S().int().nonnegative().nullable(),firstTokenMs:S().int().nonnegative().nullable(),promptTokens:S().int().nonnegative().nullable(),completionTokens:S().int().nonnegative().nullable(),totalTokens:S().int().nonnegative().nullable(),errorType:l().trim().min(1).max(160).nullable(),errorMessage:l().trim().min(1).max(2e3).nullable(),attribution:dD}),Hw=v({from:l().trim().min(1),to:l().trim().min(1),bucket:I(["day","all_time"])}),sb=Ua([N("all"),zw]),lb=I(["all","started","completed","failed","interrupted","missing"]),pD=v({range:I(["7d","30d","90d","all"]).default("30d"),visibility:sb.default("all"),status:lb.default("all"),provider:Gc.optional(),model:l().trim().min(1).optional()});pD.extend({sessionId:l().trim().min(1).optional(),turnId:l().trim().min(1).optional(),limit:S().int().positive().max(500).default(100)});const Zc=v({requests:S().int().nonnegative(),promptTokens:S().int().nonnegative().nullable(),completionTokens:S().int().nonnegative().nullable(),totalTokens:S().int().nonnegative().nullable(),averageLatencyMs:S().nonnegative().nullable(),p95LatencyMs:S().nonnegative().nullable(),averageFirstTokenMs:S().nonnegative().nullable(),p95FirstTokenMs:S().nonnegative().nullable(),failures:S().int().nonnegative(),failureRate:S().nonnegative(),firstSeenAt:l().trim().min(1),lastSeenAt:l().trim().min(1)}),hD=Zc.extend({provider:Gc,model:l().trim().min(1),route:ib}),gD=Zc.extend({sessionId:l().trim().min(1),title:l().trim().min(1).nullable(),workspaceKind:hd.nullable(),workspaceId:l().trim().min(1).nullable()}),vD=Zc.extend({commandName:l().trim().min(1),commandSource:rb.nullable()}),bD=Zc.extend({route:ib}),yD=Zc.extend({status:Dw}),SD=Zc.extend({source:Nw}),_D=v({date:l().trim().min(1),totalTokens:S().int().nonnegative(),requests:S().int().nonnegative(),models:x(v({provider:Gc,model:l().trim().min(1),totalTokens:S().int().nonnegative(),requests:S().int().nonnegative()}))}),xD=v({requests:S().int().nonnegative(),completedRequests:S().int().nonnegative(),failedRequests:S().int().nonnegative(),missingUsageRequests:S().int().nonnegative(),promptTokens:S().int().nonnegative().nullable(),completionTokens:S().int().nonnegative().nullable(),totalTokens:S().int().nonnegative().nullable(),averageLatencyMs:S().nonnegative().nullable(),p95LatencyMs:S().nonnegative().nullable(),averageFirstTokenMs:S().nonnegative().nullable(),p95FirstTokenMs:S().nonnegative().nullable(),failureRate:S().nonnegative(),activeModelCount:S().int().nonnegative(),peakDailyTokens:S().int().nonnegative(),longestRequestMs:S().int().nonnegative().nullable(),activeDays:S().int().nonnegative(),currentStreakDays:S().int().nonnegative(),longestStreakDays:S().int().nonnegative()});v({generatedAt:l().trim().min(1),range:Hw,filters:v({visibility:sb,status:lb,provider:Gc.nullable(),model:l().trim().min(1).nullable()}),totals:xD,daily:x(_D),models:x(hD),threads:x(gD),commands:x(vD),routes:x(bD),statuses:x(yD),sources:x(SD)});v({generatedAt:l().trim().min(1),range:Hw,filters:v({visibility:sb,status:lb,provider:Gc.nullable(),model:l().trim().min(1).nullable(),sessionId:l().trim().min(1).nullable(),turnId:l().trim().min(1).nullable()}),limit:S().int().positive(),hasMore:z(),records:x(fD)});const kD=I(["usage_spike","model_usage_spike","latency_regression","failure_cluster","missing_usage_frames"]);v({type:kD,title:l().trim().min(1),summary:l().trim().min(1),severity:I(["nit","concern","blocker"]),payload:$e(l(),Fe()).default({})});const wD=I(["slack","microsoft_teams","github","google","x","mcp"]),CD=I(["slack","microsoft_teams","github","google","x","mcp"]),ID=I(["native_bot","oauth_connector","mcp_endpoint"]),AD=v({kind:N("integration"),provider:wD,appIds:x(CD).min(1).max(4),setupSurfaces:x(ID).min(1).max(4),connectionIds:x(l().trim().min(1)).max(8).optional(),capabilities:x(l().trim().min(1)).max(64).optional()}).strict(),gl={maxAttachments:10,maxAttachmentBytes:12*1024*1024,maxAttachmentBase64Chars:Math.ceil(12*1024*1024*4/3)+16,maxTextChars:2e5},RD=I(["image","text","file"]),TD=v({sessionId:l().trim().min(1).max(200),turnId:l().trim().min(1).max(200),attachmentId:l().trim().min(1).max(200),storageName:l().trim().min(1).max(240),contentType:l().trim().min(1).max(160)}),ED=v({sessionId:l().trim().min(1).max(200),turnId:l().trim().min(1).max(200),attachmentId:l().trim().min(1).max(200),storageName:l().trim().min(1).max(1024),contentType:l().trim().min(1).max(160)}),$w=v({id:l().trim().min(1),name:l().trim().min(1).max(240),mediaType:l().trim().min(1).max(160),sizeBytes:S().int().nonnegative().max(gl.maxAttachmentBytes),kind:RD,lineCount:S().int().nonnegative().max(gl.maxAttachmentBytes+1).optional(),relativePath:l().trim().min(1).max(1024).optional(),text:l().max(gl.maxTextChars).optional(),contentsBase64:l().max(gl.maxAttachmentBase64Chars).optional()}),MD=$w.omit({text:!0,contentsBase64:!0}).extend({imagePreview:TD.optional(),filePreview:ED.optional()});v({experience:ab.optional(),provider:Cl.default(xl),modelRef:ma.optional(),openPondCommandAccessMode:pd.optional(),systemKind:Ew.nullable().optional(),hiddenFromDefaultSidebar:z().optional(),parentSessionId:l().trim().min(1).max(200).nullable().optional(),parentTurnId:l().trim().min(1).max(200).nullable().optional(),subagentRunId:l().trim().min(1).max(200).nullable().optional(),subagentRoleId:Fc.nullable().optional(),subagentDelegationMode:kf.nullable().optional(),appId:l().nullable().optional(),appName:l().nullable().optional(),workspaceKind:hd.optional(),workspaceId:l().nullable().optional(),workspaceName:l().nullable().optional(),localProjectId:l().nullable().optional(),cloudProjectId:l().nullable().optional(),cloudTeamId:l().nullable().optional(),currentProfile:Il.nullable().optional(),metadata:$e(l(),Fe()).optional(),cwd:l().nullable().optional(),title:l().optional()});v({teamId:l().trim().min(1),projectName:l().trim().min(1).max(120).optional(),branch:l().trim().min(1).max(120).optional(),chatSessionId:l().trim().min(1).max(200).optional(),displayPrompt:l().trim().min(1).max(2e3).optional()});v({branch:l().trim().min(1).max(120).optional()});v({prompt:l().min(1),metadata:$e(l(),Fe()).optional(),usageAttribution:mD.optional().nullable(),cwd:l().nullable().optional(),model:l().nullable().optional(),modelRef:ma.optional(),mentionedAppIds:x(l().trim().min(1)).max(8).optional(),mentionedConnectedApps:x(AD).max(8).optional(),openPondActionCatalog:x(Mw).max(100).optional(),attachments:x($w).max(gl.maxAttachments).optional(),createImproveRun:gd.optional().nullable(),approvalPolicy:I(["untrusted","on-failure","on-request","never"]).default("on-request"),sandbox:I(["read-only","workspace-write","danger-full-access"]).default("workspace-write"),codexPermissionMode:tb.default("default"),codexReasoningEffort:Rf.optional()});v({prompt:l().min(1),error:l().min(1),target:I(["cloud_workspace","hybrid_sandbox"])});v({reason:I(["manual"]).default("manual"),model:l().nullable().optional(),modelRef:ma.optional()});v({experience:ab.optional(),provider:Cl.optional(),modelRef:ma.nullable().optional(),openPondCommandAccessMode:pd.optional(),pinned:z().optional(),savedForLater:z().optional(),archived:z().optional(),order:S().optional(),title:l().optional(),parentSessionId:l().trim().min(1).max(200).nullable().optional(),parentTurnId:l().trim().min(1).max(200).nullable().optional(),subagentRunId:l().trim().min(1).max(200).nullable().optional(),subagentRoleId:Fc.nullable().optional(),subagentDelegationMode:kf.nullable().optional(),appId:l().nullable().optional(),appName:l().nullable().optional(),workspaceKind:hd.optional(),workspaceId:l().nullable().optional(),workspaceName:l().nullable().optional(),localProjectId:l().nullable().optional(),cloudProjectId:l().nullable().optional(),cloudTeamId:l().nullable().optional(),currentProfile:Il.nullable().optional(),metadata:$e(l(),Fe()).optional(),cwd:l().nullable().optional()});v({command:l().trim().min(1),cwd:l().trim().min(1).max(4096).nullable().optional(),timeoutSeconds:S().int().min(1).max(3600).optional()});v({appIds:x(l()).min(1)});v({defaultChatProvider:Cl.optional(),defaultChatModel:l().min(1).optional(),defaultChatModelRef:ma.nullable().optional(),subagents:Yu.optional(),codexPermissionMode:tb.optional(),codexReasoningEffort:Rf.optional(),openPondCommandAccessMode:pd.optional(),defaultBranchPrefix:l().trim().max(48).optional(),defaultNewProjectDirectory:l().trim().max(4096).optional(),defaultTeamId:l().trim().max(191).nullable().optional(),advancedWorkspaceControls:z().optional(),contextCompaction:tv.optional(),training:nv.optional(),sidebarWidth:S().int().min(244).max(560).optional(),diffPanelWidth:S().int().min(320).max(2400).optional(),sidebarSectionsCollapsed:ev.optional(),editor:tf.optional()});v({message:l().trim().min(1).max(4e3),surface:l().trim().min(1).max(120).default("app"),stack:l().max(12e3).nullable().optional(),context:$e(l(),Fe()).optional()}).strict();v({activeTemplateId:nb,templateName:l().trim().min(1).max(80),soul:l().trim().min(1).max(8e3),saveAsNew:z().optional().default(!1)});v({decision:I(["accept","acceptForSession","decline","cancel"])});v({branch:l().trim().min(1).max(240).nullable().optional(),surface:I(["desktop","terminal"])});v({handle:l().min(1),baseUrl:l().nullable().optional()});v({handle:l().min(1),baseUrl:l().nullable().optional()});v({handle:l().min(1).optional(),apiKey:l().min(1),baseUrl:l().nullable().optional(),apiBaseUrl:l().nullable().optional(),chatApiBaseUrl:l().nullable().optional(),environment:l().nullable().optional(),setActive:z().optional()});v({handle:l().min(1),currentBaseUrl:l().nullable().optional(),baseUrl:l().nullable().optional(),apiBaseUrl:l().nullable().optional(),chatApiBaseUrl:l().nullable().optional(),environment:l().nullable().optional(),setActive:z().optional()});v({appId:l(),exists:z(),configPath:l().nullable().optional(),envVar:l().nullable(),toolName:l().nullable(),version:Ua([l(),S()]).nullable(),source:I(["hosted_env","local_file","defaults","missing"]),currentConfig:$e(l(),Fe()).nullable(),defaults:$e(l(),Fe()).nullable(),schema:$e(l(),Fe()).nullable(),error:l().nullable().optional(),updatedAt:l()}).passthrough();const af=I(["create_sandbox_template_scaffold","resource_read","resource_search","list_files","read_files","search_files","preview_write_files","preview_write_file","preview_edit_file","preview_delete_file","write_files","write_file","edit_file","delete_file","workspace_status","validate_sandbox_template","build_sandbox_template","run_sandbox_template","git_init","git_status","git_diff","git_fetch","git_commit","git_push","publish_openpond_repo","sandbox_create","sandbox_templates","sandbox_template_launch","sandbox_status","sandbox_start","sandbox_list_files","sandbox_read_file","sandbox_search_files","sandbox_upload_file","sandbox_write_file","sandbox_edit_file","sandbox_delete_file","sandbox_mkdir","sandbox_move_file","sandbox_exec","sandbox_git_status","sandbox_git_diff","sandbox_git_export_patch","sandbox_git_apply_patch_local","sandbox_git_branch","sandbox_git_commit","sandbox_git_pull","sandbox_git_push","sandbox_preserve_source","sandbox_promote_source","sandbox_run_action","sandbox_open_port","sandbox_snapshot_catalog","sandbox_snapshot_create","sandbox_snapshot_update","sandbox_snapshot_validate","sandbox_snapshot_publish","sandbox_replays","sandbox_replay_start","sandbox_replay_get","sandbox_replay_logs","sandbox_replay_artifacts","sandbox_replay_cancel","sandbox_logs","sandbox_receipts","sandbox_prepare_agent","sandbox_save_agent_package","sandbox_save_output","work_agent_package_install","work_output_delete","work_output_read","sandbox_schedule_create","sandbox_stop"]);v({action:af,args:$e(l(),Fe()).optional().default({}),source:I(["ui_button","chat_action","terminal_command","hook"]).default("chat_action")});v({ok:z(),action:af,appId:l().nullable().optional(),output:l(),data:Fe().optional()});const vd=v({id:l().trim().min(1).max(200),title:l().trim().min(1).max(240),sourceTaskId:l().trim().min(1).max(200),sourceTurnId:l().trim().min(1).max(200),revision:S().int().positive().default(1),createdAt:l().datetime()}),bd=v({kind:I(["structural","visual","test","user_review"]),status:I(["passed","failed","not_run"]),label:l().trim().min(1).max(240),detail:l().trim().max(4e3).nullable().optional(),ref:l().trim().max(4096).nullable().optional()}),qw=v({kind:N("local"),path:l().trim().min(1).max(4096),deviceId:l().trim().min(1).max(200)}),Bw=v({kind:N("managed"),fileId:l().trim().min(1).max(200),downloadPath:l().trim().min(1).max(4096)}),PD=v({kind:N("external"),provider:l().trim().min(1).max(120),resourceId:l().trim().min(1).max(500),url:l().url().nullable()}),Vw=vd.extend({kind:N("file"),contentType:l().trim().min(1).max(200),sizeBytes:S().int().nonnegative(),sha256:l().regex(/^[a-f0-9]{64}$/),location:Ja("kind",[qw,Bw,PD]),validation:x(bd).max(32).default([])}),OD=vd.extend({kind:N("source_change"),projectId:l().trim().min(1).max(200),ref:l().trim().min(1).max(500),url:l().url().nullable(),validation:x(bd).max(32).default([])}),jD=vd.extend({kind:N("deployment"),deploymentId:l().trim().min(1).max(200),url:l().url(),validation:x(bd).max(32).default([])}),ND=vd.extend({kind:N("external_resource"),provider:l().trim().min(1).max(120),resourceId:l().trim().min(1).max(500),url:l().url(),contentType:l().trim().min(1).max(200).nullable(),validation:x(bd).max(32).default([])}),Fw=v({id:l().trim().min(1).max(191),label:l().trim().min(1).max(160).nullable(),description:l().trim().max(1e3).nullable(),inputSchema:$e(l(),Fe()).nullable(),outputSchema:$e(l(),Fe()).nullable(),schedulePolicy:$e(l(),Fe()).nullable()}),Kw=v({base:l().trim().min(1).max(200),resources:$e(l(),Fe()),modelPolicy:$e(l(),Fe()).nullable(),setup:$e(l(),Fe()).nullable()}),zD=v({id:l().trim().min(1).max(200),kind:I(["sdk_validation","sdk_eval"]),status:I(["passed","failed"]),summary:l().trim().min(1).max(2e3),artifactPath:l().trim().min(1).max(4096),artifactSha256:l().regex(/^[a-f0-9]{64}$/)}),DD=v({path:l().trim().min(1).max(4096),sizeBytes:S().int().nonnegative(),sha256:l().regex(/^[a-f0-9]{64}$/),contentsBase64:l()});v({schema:N("openpond.agent-package.v1"),agentId:l().trim().min(1).max(191),versionId:l().trim().min(1).max(200),digest:l().regex(/^[a-f0-9]{64}$/),title:l().trim().min(1).max(240),source:v({files:x(DD).min(1).max(1e3),totalSizeBytes:S().int().nonnegative()}),manifest:$e(l(),Fe()),actions:x(Fw).min(1).max(256),runtimeRequirements:Kw,receipts:x(zD).min(2).max(64)});const UD=vd.extend({kind:N("agent_package"),agentId:l().trim().min(1).max(191),versionId:l().trim().min(1).max(200),digest:l().regex(/^[a-f0-9]{64}$/),packageFileId:l().trim().min(1).max(200),manifestFileId:l().trim().min(1).max(200),actions:x(Fw).min(1).max(256),runtimeRequirements:Kw,validationReceiptIds:x(l().trim().min(1).max(200)).min(1).max(32),evalReceiptIds:x(l().trim().min(1).max(200)).min(1).max(32),sourceFileCount:S().int().positive(),sourceSizeBytes:S().int().nonnegative(),location:Ja("kind",[qw,Bw]),validation:x(bd).max(32).default([])}),RG=Ja("kind",[Vw,OD,jD,ND,UD]);v({outputs:x(Vw)});const LD=I(["sandbox_template","sandbox","generic_git","plain_folder"]),HD=I(["sandbox_template"]).nullable();v({productKind:LD,actions:v({files:z(),git:z(),sandboxRuntime:z(),sandboxTemplate:z()}),checks:v({validate:af.nullable(),build:af.nullable(),postEdit:HD}),ui:v({showSandboxTemplateActions:z(),showSandboxRuntimeActions:z()})});const $D=v({id:l(),name:l(),dnsName:l().nullable(),os:l().nullable(),online:z(),active:z(),isSelf:z(),tailscaleIps:x(l()),lastSeen:l().nullable()}),qD=v({installed:z(),running:z(),version:l().nullable(),backendState:l().nullable(),tailnetName:l().nullable(),magicDnsSuffix:l().nullable(),machineName:l().nullable(),dnsName:l().nullable(),authUrl:l().nullable(),tailscaleIps:x(l()),health:x(l()),error:l().nullable(),peers:x($D)}),BD=v({enabled:z(),reachable:z(),targetUrl:l().nullable(),httpsUrl:l().nullable(),httpsHost:l().nullable(),httpsPort:S().nullable(),setupUrl:l().nullable(),configText:l().nullable(),error:l().nullable()}),VD=v({localUrl:l(),localWebUrl:l(),remoteUrl:l().nullable(),remoteWebUrl:l().nullable(),tokenHash:l(),tailscaleUpCommand:l(),serveCommand:l(),disableCommand:l(),operatorCommand:l(),webUiAvailable:z(),updatedAt:l(),tailscale:qD,serve:BD});v({message:l(),status:VD});const Gw=I(["github","openpond_git"]),Zw=I(["private","public"]),FD=I(["actions","prompts","goals","evals","examples","tasksets","extensions"]),KD=v({agentIds:x(l().trim().min(1)).max(100),skillNames:x(l().trim().min(1)).max(200),optionalContent:x(FD).max(20).default([])}),Ww=v({provider:Gw,owner:l().trim().min(1).max(191).nullable().optional(),repository:l().trim().min(1).max(191),visibility:Zw.default("private")}),GD=v({ref:Il,selection:KD,target:Ww}),ZD=v({path:l(),sizeBytes:S().int().nonnegative(),category:l()});v({sourceHash:l(),sourceRevision:l().nullable(),clean:z(),blockedReasons:x(l()),warnings:x(l()),files:x(ZD),excludedFiles:x(l()),target:Ww,replacesExisting:z()});GD.extend({expectedSourceHash:l().trim().min(1),confirmed:N(!0)});v({provider:Gw,owner:l(),repository:l(),visibility:Zw,remoteUrl:l(),webUrl:l(),revision:l()});const WD=I(["cron","rate"]),Yw=I(["queued","running","succeeded","failed","skipped"]),Jw=v({id:l(),localProjectId:l(),localProjectName:l(),agentRootPath:l(),agentName:l(),scheduleName:l(),scheduleType:WD,scheduleExpression:l(),timezone:l().nullable(),targetAction:l(),input:$e(l(),Fe()).optional().default({}),enabledByDefault:z(),enabled:z(),sourceHash:l(),manifestHash:l().nullable(),agentVersionId:l().nullable().optional(),agentPackageDigest:l().nullable().optional(),nextRunAt:l().nullable(),lastRunAt:l().nullable(),lastRunStatus:Yw.nullable(),lastRunId:l().nullable(),lastError:l().nullable(),createdAt:l(),updatedAt:l()}),Xw=v({id:l(),scheduleId:l(),localProjectId:l(),scheduleName:l(),scheduledFor:l(),trigger:I(["schedule","manual"]),status:Yw,targetAction:l(),agentVersionId:l().nullable().optional(),agentPackageDigest:l().nullable().optional(),startedAt:l().nullable(),completedAt:l().nullable(),exitCode:S().int().nullable(),stdout:l().nullable(),stderr:l().nullable(),result:$e(l(),Fe()).nullable(),traceArtifactRef:l().nullable(),error:l().nullable(),createdAt:l(),updatedAt:l()});v({schedules:x(Jw),scheduler:v({running:z(),nextTickAt:l().nullable(),lastSyncAt:l().nullable(),scanRunning:z()})});v({runs:x(Xw)});v({enabled:z().optional()});v({input:$e(l(),Fe()).optional()});v({schedule:Jw,run:Xw});const YD=I(["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]),cb=v({version:N(1),kind:I(["once","daily","weekdays","weekly","monthly"]),timeZone:l().trim().min(1).max(100),startDate:l().regex(/^\d{4}-\d{2}-\d{2}$/),localTime:l().regex(/^([01]\d|2[0-3]):([0-5]\d)$/),weekdays:x(YD).min(1).max(7).optional(),dayOfMonth:S().int().min(1).max(31).optional(),end:Ja("kind",[v({kind:N("never")}),v({kind:N("on_date"),date:l().regex(/^\d{4}-\d{2}-\d{2}$/)}),v({kind:N("after_occurrences"),occurrences:S().int().min(1).max(1e5)})])}).superRefine((e,t)=>{e.kind==="weekly"&&!e.weekdays?.length&&t.addIssue({code:"custom",message:"Weekly recurrence requires at least one weekday.",path:["weekdays"]}),e.kind==="monthly"&&e.dayOfMonth===void 0&&t.addIssue({code:"custom",message:"Monthly recurrence requires a day of month.",path:["dayOfMonth"]})}),JD=v({id:l(),expression:l().nullable(),timeZone:l(),recurrence:cb.nullable(),configurationVersion:S().int(),enabled:z(),nextRunAt:l().nullable(),lastTriggeredAt:l().nullable(),delivery:$e(l(),Fe()).default({})}),XD=v({id:l(),definitionKey:l(),version:S().int(),name:l(),prompt:l(),modelId:l(),schedules:x(JD)}),QD=v({id:l(),definitionId:l(),scheduleId:l().nullable(),definitionName:l(),definitionVersion:S().int(),conversationId:l(),triggerKind:I(["manual","schedule","webhook","retry"]),status:l(),notificationStatus:l(),deliveryStatus:l(),deliveryError:l().nullable(),createdAt:l()});v({definitions:x(XD),runs:x(QD),asOf:l(),webBaseUrl:l().url().optional()});v({clientRequestId:l().trim().min(1).max(191),sourceTurnId:l().trim().min(1).max(191).nullable().optional(),name:l().trim().min(1).max(180),prompt:l().trim().min(1).max(2e4),recurrence:cb,modelId:l().trim().min(1).max(191).default("openpond-chat")});Ua([v({enabled:z()}),v({name:l().trim().min(1).max(180),prompt:l().trim().min(1).max(2e4),recurrence:cb})]);const ub=$e(l(),Fe());v({userId:l(),role:I(["owner","admin","member"]),name:l(),handle:l().nullable(),image:l().nullable()});const eU=v({userId:l(),role:I(["owner","admin","member"]),name:l(),handle:l().nullable(),image:l().nullable(),lastReadSequence:S().int().nonnegative()}),tU=v({id:l(),messageId:l(),refType:I(["hosted_ai_thread","goal","openpond_session","project","agent_run","message_reply"]),refId:l(),preview:ub,createdAt:l()}),Qw=v({id:l(),messageId:l().nullable(),clientAttachmentId:l(),kind:N("image"),name:l(),mediaType:I(["image/png","image/jpeg","image/webp","image/gif"]),sizeBytes:S().int().positive(),status:I(["pending","ready","failed"]),createdAt:l(),readyAt:l().nullable()});v({attachment:Qw,uploadUrl:l().url().nullable(),uploadHeaders:$e(l(),l()),expiresAt:l().nullable()});v({url:l().url(),expiresAt:l()});const db=v({id:l(),threadId:l(),teamId:l(),clientRequestId:l().nullable(),authorType:I(["user","agent","system"]),authorUserId:l().nullable(),authorAgentId:l().nullable(),sequence:S().int().nonnegative(),kind:I(["text","system","command_result"]),body:l(),metadata:ub,editedAt:l().nullable(),deletedAt:l().nullable(),createdAt:l(),refs:x(tU),attachments:x(Qw)}),nU=v({id:l(),teamId:l(),kind:I(["general","dm","group","channel"]),title:l().nullable(),createdByUserId:l(),lastMessageId:l().nullable(),lastMessageSequence:S().int().nonnegative(),lastMessageAt:l(),createdAt:l(),updatedAt:l(),unreadCount:S().int().nonnegative(),pinnedAt:l().nullable(),mutedAt:l().nullable(),archivedAt:l().nullable(),participants:x(eU),lastMessage:db.nullable()});v({thread:nU,messages:x(db),hasMoreBefore:z()});v({threadId:l(),mutedAt:l().nullable()});const aU=I(["pending","running","completed","failed","interrupted","cancelled"]),p_=v({id:l(),conversationId:l(),threadId:l(),teamId:l(),requestedByUserId:l(),executorUserId:l().nullable(),providerId:l(),modelId:l(),clientRequestId:l(),baseMessageSequence:S().int().nonnegative(),status:aU,partialBody:l().nullable(),userMessageId:l(),assistantMessageId:l().nullable(),errorCode:l().nullable(),cancelledByUserId:l().nullable(),leaseExpiresAt:l().nullable(),heartbeatAt:l().nullable(),createdAt:l(),updatedAt:l()}),oU=v({id:l(),conversationId:l(),sequence:S().int().nonnegative(),role:I(["user","assistant","system","action"]),body:l(),createdByUserId:l().nullable(),createdAt:l()});v({conversationId:l(),parentThreadId:l(),parentMessageId:l(),teamId:l(),title:l().nullable(),providerId:l().nullable(),modelId:l(),createdByUserId:l(),messages:x(oU),turns:x(p_),activeTurn:p_.nullable(),createdAt:l(),updatedAt:l()});const eC=v({id:S().int().nonnegative(),teamId:l(),threadId:l(),conversationId:l().nullable(),type:I(["thread.created","message.created","message.updated","message.deleted","read.updated","ai_thread.created","ai_turn.updated"]),payload:ub,createdAt:l()});v({events:x(eC),cursor:S().int().nonnegative(),hasMore:z()});v({httpUrl:l().min(1),realtimeUrl:l().min(1),region:l().min(1),token:l().min(1),expiresAt:l().min(1),teamId:l().min(1),userId:l().min(1)});const mb=$e(l(),Fe()),ni=l().nullable(),iU=I(["draft","published","archived"]),fb=I(["owner","admin","member"]),tC=I(["active","left"]),nC=I(["mentions","all","none"]),aC=I(["public_preview","members"]),rU=I(["members","admins"]),sU=v({canPreview:z(),canJoin:z(),canLeave:z(),canRead:z(),canPost:z(),canUpload:z(),canMention:z(),canManage:z(),requiresRulesAcceptance:z(),currentRulesVersionId:l().nullable()}),oC=v({id:l(),communityId:l(),version:S().int().positive(),title:l(),requiresReacceptance:z(),publishedAt:l()}),lU=oC.extend({bodyMarkdown:l(),contentHash:l()}),cU=v({role:fb,status:tC,notificationMode:nC}),uU=v({id:l(),communityId:l(),userId:l(),role:fb,status:tC,notificationMode:nC,joinedAt:l(),leftAt:ni,createdAt:l(),updatedAt:l()}),iC=v({id:l(),slug:l(),displayName:l(),description:l(),imageUrl:l().nullable(),status:iU,visibility:I(["public","private"]),joinPolicy:I(["open","closed"]),historyVisibility:aC,featuredAt:ni,publishedAt:ni,archivedAt:ni,memberCount:S().int().nonnegative(),membership:cU.nullable(),capabilities:sU,currentRules:oC.nullable()});v({items:x(iC),nextCursor:l().nullable()});const rC=v({lastReadSequence:S().int().nonnegative(),lastReadAt:ni.optional(),mutedAt:ni,pinnedAt:ni}),pb=v({id:l(),communityId:l(),chatThreadId:l().nullable(),slug:l(),displayName:l(),topic:l(),position:S().int().nonnegative(),visibility:aC,postingPolicy:rU,isDefault:z(),archivedAt:ni,lastMessageSequence:S().int().nonnegative(),unreadCount:S().int().nonnegative(),readState:rC.nullable()});iC.omit({currentRules:!0}).extend({currentRules:lU.nullable(),channels:x(pb),previewMessageLimit:S().int().positive()});const dU=v({id:l(),messageId:l(),refType:I(["hosted_ai_thread","goal","openpond_session","project","agent_run","message_reply"]),refId:l(),preview:mb,createdAt:l()}),sC=v({id:l(),messageId:l().nullable(),clientAttachmentId:l(),kind:N("image"),name:l(),mediaType:I(["image/png","image/jpeg","image/webp","image/gif"]),sizeBytes:S().int().positive(),status:I(["pending","ready","failed"]),createdAt:l(),readyAt:ni});v({attachment:sC,uploadUrl:l().url().nullable(),uploadHeaders:$e(l(),l()),expiresAt:ni});v({url:l().url(),expiresAt:l()});const lC=v({id:l(),threadId:l(),teamId:Tk(),clientRequestId:l().nullable(),authorType:I(["user","agent","system"]),authorUserId:l().nullable(),authorAgentId:l().nullable(),sequence:S().int().nonnegative(),kind:I(["text","system","command_result"]),body:l(),metadata:mb,editedAt:ni,deletedAt:ni,createdAt:l(),refs:x(dU),attachments:x(sC)});v({messages:x(lC),hasMoreBefore:z(),channelId:l(),readState:rC.omit({lastReadAt:!0}).nullable(),preview:z()});const mU=v({userId:l(),handle:l().nullable(),name:l().nullable(),role:fb});v({items:x(mU),nextCursor:l().nullable()});const cC=v({id:S().int().nonnegative(),communityId:l(),channelId:l(),threadId:l(),type:I(["thread.created","message.created","message.updated","message.deleted","read.updated"]),payload:mb,createdAt:l()});v({events:x(cC),cursor:S().int().nonnegative(),hasMore:z()});v({httpUrl:l().min(1),realtimeUrl:l().min(1),region:l().min(1),token:l().min(1),expiresAt:l().min(1),communityId:l().min(1),userId:l().min(1),channel:l().min(1)});v({membership:uU,channels:x(pb)});v({channels:x(pb)});const _o=l().trim().min(1).max(240),Ts=l().trim().min(1),uC=$e(l(),Fe()).default({}),dC=I(["nominated","needs_review","approved_for_creation","creating","needs_task_review","baselining","ready_for_export","rejected","dismissed","retired","blocked"]),mC=I(["no_training","prompting","retrieval","sft","preference","grpo_rft","sdft_opsd","sdpo","agentic_rl"]),fU=v({id:_o,kind:I(["repeated_success","accepted_correction","agent_action_recurrence","outcome_linked_change","frontier_cost","expert_label","runtime_feedback"]),sourceRefIds:x(_o).min(1).max(1e4),occurredAt:Ts,signature:l().trim().min(1).max(2e3),summary:l().trim().min(1).max(5e3),confidence:S().min(0).max(1),consented:z(),metadata:uC}),pU=v({frequency:S().min(0).max(1),businessValue:S().min(0).max(1),frontierCost:S().min(0).max(1),signalQuality:S().min(0).max(1),verifiability:S().min(0).max(1),repeatability:S().min(0).max(1),privacyRisk:S().min(0).max(1),overall:S().min(0).max(1)}),hU=v({tactic:mC,eligible:z(),reasons:x(l().trim().min(1).max(5e3)).min(1).max(100),blockers:x(l().trim().min(1).max(5e3)).max(100).default([]),requiredSignals:x(l().trim().min(1).max(500)).max(100).default([]),generatedBy:I(["decision_table","baseline_reassessment"])}),fC=v({schemaVersion:N("openpond.taskCandidate.v1"),id:_o,profileId:_o,status:dC,fingerprint:l().trim().min(1).max(512),title:l().trim().min(1).max(500),summary:l().trim().min(1).max(1e4),workflowSignature:l().trim().min(1).max(2e3),evidence:x(fU).min(1).max(1e5),scorecard:pU,recommendation:hU,mergedIntoId:_o.nullable(),createdAt:Ts,updatedAt:Ts,metadata:uC}),Mf=v({schemaVersion:N("openpond.taskMinerConfig.v1"),enabled:z().default(!1),localOnly:z().default(!0),observationWindowDays:S().int().min(1).max(365).default(30),minimumRecurrence:S().int().min(2).max(100).default(3),clustering:N("hybrid_deterministic_first").default("hybrid_deterministic_first"),consentRequired:z().default(!0)});v({items:x(fC),generatedAt:Ts,config:Mf});v({status:dC.optional(),mergeIntoId:_o.nullable().optional()});v({profileId:_o,sourceIds:x(_o).max(1e5).default([]),sessionIds:x(_o).max(1e5).default([]),config:Mf.optional()});const gU=v({schemaVersion:N("openpond.taskMinerRun.v1"),id:_o,profileId:_o,status:I(["queued","running","cancelling","cancelled","succeeded","failed"]),config:Mf,sourceIds:x(_o).max(1e5),sessionIds:x(_o).max(1e5).default([]),progress:v({stage:I(["queued","ingesting","preparing","clustering","persisting","complete"]),processedSources:S().int().nonnegative(),totalSources:S().int().nonnegative(),candidatesFound:S().int().nonnegative(),skippedSources:S().int().nonnegative().default(0)}),candidateIds:x(_o).max(1e5),cancelRequested:z(),error:l().trim().min(1).max(2e4).nullable(),createdAt:Ts,startedAt:Ts.nullable(),completedAt:Ts.nullable(),updatedAt:Ts}),ai=l().trim().min(1).max(240),Er=l().trim().min(1),Ps=l().trim().min(8).max(256),pC=l().trim().min(1).max(1e3).refine(e=>!e.startsWith("/")&&!e.startsWith("\\")&&!e.split(/[\\/]/).includes(".."),"Artifact paths must be relative and stay inside the Dataset."),Ds=I(["train","validation","test","frozen_eval"]),vU=v({name:l().trim().min(1).max(500),semanticRole:I(["row_id","cluster_id","prompt","messages","demonstration","chosen","rejected","expected_output","privileged_context","reward","feedback","tag","metadata"]),logicalType:I(["string","integer","float","boolean","json","messages"]),nullable:z(),policy:I(["visible","privileged","metadata"])}),bU=v({schemaVersion:N("openpond.datasetSemanticSchema.v1"),fields:x(vU).min(1).max(1e4),schemaHash:Ps}),yU=v({id:ai,split:Ds,path:pC,contentHash:Ps,schemaHash:Ps,sizeBytes:S().int().nonnegative(),rowCount:S().int().positive(),rowGroupCount:S().int().positive()}),hC=v({schemaVersion:N("openpond.datasetArtifact.v1"),id:ai,tasksetId:ai,tasksetRevision:S().int().positive(),contentHash:Ps,format:N("parquet"),schema:bU,shards:x(yU).min(1).max(1e5),rowCount:S().int().positive(),splitCounts:$e(Ds,S().int().nonnegative()),sourceReceiptRefs:x(ai).min(1).max(1e5),mappingHash:Ps,qualityReportHash:Ps,createdAt:Er}),SU=v({schemaVersion:N("openpond.datasetArtifactSummary.v1"),artifactId:ai,tasksetId:ai,tasksetRevision:S().int().positive(),format:N("parquet"),rowCount:S().int().positive(),splitCounts:$e(Ds,S().int().nonnegative()),sizeBytes:S().int().nonnegative(),contentHash:Ps,available:z(),unavailableReason:l().trim().min(1).max(2e3).nullable(),createdAt:Er}),_U=v({schemaVersion:N("openpond.datasetCatalogItem.v1"),tasksetId:ai,tasksetRevision:S().int().positive(),artifactId:ai.nullable(),name:l().trim().min(1).max(500),status:I(["draft","awaiting_disclosure_approval","awaiting_materialization_approval","materializing","validating","needs_review","baselining","ready","blocked","failed","archived"]),storageKind:I(["inline","parquet"]),rowCount:S().int().nonnegative(),splitCounts:$e(Ds,S().int().nonnegative()),sizeBytes:S().int().nonnegative().nullable(),available:z(),unavailableReason:l().trim().min(1).max(2e3).nullable(),createdAt:Er,updatedAt:Er});v({schemaVersion:N("openpond.datasetCatalog.v1"),profileId:ai,datasets:x(_U),generatedAt:Er});v({schemaVersion:N("openpond.datasetArtifactRegistry.v1"),manifest:hC,profileId:ai,storageRoot:l().trim().min(1).max(4e3),relativeManifestPath:pC,available:z(),unavailableReason:l().trim().min(1).max(2e3).nullable(),verifiedAt:Er.nullable(),createdAt:Er,updatedAt:Er});v({split:Ds.nullable().default(null),cursor:l().trim().min(1).max(2e3).nullable().default(null),limit:S().int().min(1).max(100).default(25),columns:x(l().trim().min(1).max(500)).max(100).default([])});v({schemaVersion:N("openpond.datasetRowPage.v1"),tasksetId:ai,tasksetRevision:S().int().positive(),artifactHash:Ps,split:Ds.nullable(),rows:x($e(l(),Fe())).max(100),nextCursor:l().max(2e3).nullable(),totalRows:S().int().nonnegative(),returnedRows:S().int().nonnegative()});const xU=v({schemaVersion:N("openpond.datasetStorageSettings.v1"),datasetStorePath:l().trim().min(1).max(4e3),updatedAt:Er}),kU=v({id:ai,label:l().trim().min(1).max(500),path:l().trim().min(1).max(4e3),datasetStorePath:l().trim().min(1).max(4e3),kind:I(["local","network","removable","cache"]),configured:z(),mounted:z(),writable:z(),totalBytes:S().int().nonnegative().nullable(),freeBytes:S().int().nonnegative().nullable()});v({schemaVersion:N("openpond.datasetStorageState.v1"),settings:xU,storageRoots:x(kU)});v({datasetStorePath:l().trim().min(1).max(4e3)});const rv=l().trim().min(1).max(240),wU=l().trim().min(1),Pf=l().trim().min(8).max(256),CU=$e(l(),Fe()).default({}),IU=l().trim().min(7).max(256),AU=I(["pending","approved","review","blocked"]),hb=v({id:rv,profileId:rv,title:l().trim().min(1).max(500),sourceHash:Pf,occurredAt:wU,licensingStatus:AU,secretScanStatus:I(["pending","passed","blocked"]),piiScanStatus:I(["pending","passed","review","blocked"]),metadata:CU}),RU=hb.extend({schemaVersion:N("openpond.huggingFaceDatasetSource.v1"),kind:N("huggingface"),repositoryId:l().trim().regex(/^[^/\s]+\/[^/\s]+$/).max(500),repositoryUrl:l().url().max(2e3),revision:IU,configuration:l().trim().min(1).max(500),upstreamSplits:x(l().trim().min(1).max(500)).min(1).max(1e3),gated:z(),private:z(),declaredLicense:l().trim().min(1).max(500).nullable(),sourceFileHashes:x(Pf).min(1).max(1e5)}),TU=hb.extend({schemaVersion:N("openpond.uploadedFileDatasetSource.v1"),kind:N("uploaded_file"),originalFileNames:x(l().trim().min(1).max(500)).min(1).max(1e3),mediaTypes:x(l().trim().min(1).max(200)).min(1).max(1e3),sourceFileHashes:x(Pf).min(1).max(1e3),totalBytes:S().int().nonnegative(),parserVersion:l().trim().min(1).max(200)}),EU=hb.extend({schemaVersion:N("openpond.generatedDatasetSource.v1"),kind:N("generated"),generatorId:rv,generatorVersion:l().trim().min(1).max(200),seed:S().int(),generatorHash:Pf}),MU=Ja("kind",[RU,TU,EU]),rt=l().trim().min(1).max(240),ft=l().regex(/^[a-f0-9]{64}$/),Wn=l().datetime({offset:!0}),Yt=v({id:rt,contentHash:ft}).strict(),of=Yt.extend({revision:S().int().positive()}).strict(),PU=v({id:rt,purpose:l().trim().min(1).max(500),audience:I(["orchestrator","environment","privileged_scorer","trainer","infrastructure"]),required:z(),ttlSeconds:S().int().positive().max(86400),scopes:x(l().trim().min(1).max(500)).max(100).default([])}).strict(),OU=v({declarationId:rt,leaseRef:l().trim().min(8).max(1e3),audience:PU.shape.audience,expiresAt:Wn}).strict(),jU=v({schemaVersion:N("openpond.harnessActionBinding.v1"),actionId:rt,modelToolName:l().trim().min(1).max(64).regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/),description:l().trim().min(1).max(1e3),inputSchema:$e(l(),Fe()),actionSchemaHash:ft,agentRelease:Yt,implementationHash:ft,runtimeBindingId:rt,capabilityReceiptHash:ft,sideEffect:I(["read","write"]),studentVisible:z(),timeoutMs:S().int().positive().max(36e5),episodeArgumentBindings:x(v({argument:rt,source:N("case_id")}).strict()).max(20).default([])}).strict(),ct=l().trim().min(1).max(240),Yn=l().trim().min(1),js=l().trim().min(8).max(256),gC=l().trim().regex(/^[a-f0-9]{64}$/),wo=$e(l(),Fe()).default({}),Ya=ct.nullable();function gb(e){const t=e.trim().replaceAll("\\","/");return!t||t.startsWith("/")||t==="."||t===".."?!1:!t.split("/").some(a=>!a||a==="."||a==="..")}function NU(e){const t=e.trim();return t.length>0&&t!=="."&&t!==".."&&!t.includes("/")&&!t.includes("\\")&&!t.includes("\0")}const Uc=Ds,zU=I(["draft","awaiting_disclosure_approval","awaiting_materialization_approval","materializing","validating","needs_review","baselining","ready","blocked","failed","archived"]),DU=I(["general","benchmark"]),UU=v({schemaVersion:N("openpond.tasksetBenchmark.v1"),definitionId:ct,releaseId:ct,releaseHash:gC,managedReleasePath:l().trim().min(1).max(1e3).refine(gb,"Benchmark release paths must remain relative."),adaptationSplit:Uc,evaluationSplit:Uc,primaryMetric:I(["foreground_tokens","success_rate","latency_ms","cost_usd"]),qualityGate:I(["none","non_regression","all_pass"]),source:I(["builtin","imported"]),metadata:wo}),LU=I(["slash_train","session_menu","bulk_selection","training_page","task_candidate"]),HU=I(["defaults","customize"]),$U=I(["automated","manual"]),vb=I(["demonstrations","preferences","verifiable_reward","rubric","discovery"]),Ka=l().trim().max(1e5),bb=Ja("kind",[v({kind:N("demonstrations"),behavior:Ka,examples:x(v({id:ct,prompt:Ka,response:Ka})).max(1e3).default([])}),v({kind:N("preferences"),preference:Ka,pairs:x(v({id:ct,prompt:Ka,chosen:Ka,rejected:Ka,rationale:Ka})).max(1e3).default([])}),v({kind:N("verifiable_reward"),task:Ka,rules:x(v({id:ct,points:S().finite(),condition:Ka})).max(1e3).default([]),otherwisePoints:S().finite().default(0)}),v({kind:N("rubric"),task:Ka,criteria:x(v({id:ct,label:l().trim().max(500),description:Ka})).max(1e3).default([]),positiveExample:Ka,negativeExample:Ka,boundaryExample:Ka})]),qU=v({status:I(["pending","granted","denied","revoked"]),scope:I(["metadata_only","selected_turns","full_session"]),grantedBy:Ya,grantedAt:Yn.nullable(),purpose:N("task_authoring_and_evaluation")}),vC=v({schemaVersion:N("openpond.trainingSource.v1"),id:ct,profileId:ct,sessionId:ct,turnIds:x(ct).max(1e3).default([]),workspaceId:Ya,sourceHash:js,clusterKey:ct,title:l().trim().min(1).max(500),occurredAt:Yn,consent:qU,connectedAppIds:x(ct).max(100).default([]),secretScanStatus:I(["pending","passed","blocked"]),piiScanStatus:I(["pending","passed","review","blocked"]),licensingStatus:I(["pending","approved","review","blocked"]),metadata:wo}),BU=Ua([vC,MU]);v({schemaVersion:N("openpond.trainingSourceEstimate.v1"),sessionId:ct,messageCount:S().int().nonnegative(),estimatedTokens:S().int().nonnegative(),textBytes:S().int().nonnegative()});v({query:l().max(500).default(""),offset:S().int().nonnegative().default(0),limit:S().int().min(1).max(100).default(20),candidates:x(v({sessionId:ct,title:l().trim().min(1).max(500),updatedAt:Yn})).max(500).default([])});const VU=v({sessionId:ct,title:l().trim().min(1).max(500),updatedAt:Yn,snippet:l().max(2e3).nullable()});v({schemaVersion:N("openpond.trainingChatSearchResult.v1"),query:l(),offset:S().int().nonnegative(),limit:S().int().positive(),total:S().int().nonnegative(),hasMore:z(),indexedChats:S().int().nonnegative(),totalChats:S().int().nonnegative(),indexing:z(),entries:x(VU)});const bC=v({policyVisibleFields:x(ct).max(1e3).default([]),privilegedFields:x(ct).max(1e3).default([]),hiddenGraderRefs:x(ct).max(100).default([]),connectedAppScopes:x(ct).max(100).default([])}),FU=v({id:ct,sourceRefId:ct,artifactRef:l().trim().min(1).max(4e3).refine(gb,"Task asset references must be safe relative paths."),fileName:l().trim().min(1).max(500).refine(NU,"Task asset file names must not contain path separators."),mediaType:l().trim().min(1).max(200),sha256:gC,sizeBytes:S().int().nonnegative().max(25e7),split:Uc,metadata:wo}),KU=v({path:l().trim().min(1).max(1e3).refine(gb,"Required output paths must stay inside the Work output directory."),mediaType:l().trim().min(1).max(200),schemaRef:ct.nullable().optional(),maxBytes:S().int().positive().max(1e7).optional(),metadata:wo}),GU=v({schemaVersion:N("openpond.taskData.v1"),id:ct,clusterKey:ct,split:Uc,input:$e(l(),Fe()),expectedOutput:$e(l(),Fe()).nullable(),policyVisibleContext:$e(l(),Fe()).default({}),privilegedContextRef:Ya,sourceRefs:x(ct).min(1).max(100),assets:x(FU).max(1e3).optional(),requiredOutputs:x(KU).max(100).optional(),tags:x(ct).max(100).default([]),metadata:wo}),Wc=v({id:ct,taskId:Ya,sourceRefs:x(ct).min(1).max(100),artifactRef:ct,approved:z(),confidence:S().min(0).max(1),metadata:wo}),yC=Wc.extend({kind:N("demonstration"),prompt:l().max(1e5).nullable().default(null),response:l().max(2e5).nullable().default(null)}),SC=Wc.extend({kind:N("preference"),prompt:l().max(1e5),chosen:l().max(2e5),rejected:l().max(2e5),rationale:l().max(1e5).nullable().default(null)}),_C=Wc.extend({kind:N("correction"),original:l().max(2e5),corrected:l().max(2e5),rationale:l().max(1e5).nullable().default(null)}),xC=Wc.extend({kind:N("feedback"),feedback:l().max(1e5),polarity:I(["positive","negative","mixed","neutral"])}),kC=Wc.extend({kind:N("reward"),task:l().max(1e5),rules:x(v({id:ct,points:S().finite(),condition:l().trim().min(1).max(1e5)})).min(1).max(1e3),otherwisePoints:S().finite(),executable:z()}),wC=Wc.extend({kind:N("label"),labelKind:N("rubric"),task:l().max(1e5),criteria:x(v({id:ct,label:l().trim().min(1).max(500),description:l().trim().min(1).max(1e5)})).min(1).max(1e3),calibrationExamples:v({positive:l().trim().min(1).max(2e5),negative:l().trim().min(1).max(2e5),boundary:l().trim().min(1).max(2e5)})});Ja("kind",[yC,SC,_C,xC,kC,wC]);const ZU=v({demonstrations:x(yC).max(1e5).default([]),preferences:x(SC).max(1e5).default([]),corrections:x(_C).max(1e5).default([]),feedback:x(xC).max(1e5).default([]),rewards:x(kC).max(1e5).default([]),labels:x(wC).max(1e5).default([])}),WU=v({protocolVersion:N("openpond.taskEnvironment.v1"),kind:I(["chat","agent","program","stateful_harness","work"]),entrypoint:l().trim().min(1).max(1e3),stateful:z(),deterministicSeeds:z(),toolNames:x(ct).max(200).default([]),actionBindings:x(jU).max(200).optional(),lifecycle:x(I(["create","reset","step","grade","cleanup"])).min(1),defaultTimeoutMs:S().int().positive().max(36e5),networkPolicy:I(["none","declared_read_only","declared_scoped"]),metadata:wo}),CC=v({schemaVersion:N("openpond.tasksetCapabilities.v1"),taskKind:I(["chat","single_agent","multi_agent","custom_program"]),supportedSignals:x(I(["demonstration","preference","correction","feedback","reward","label"])),compatibleMethods:x(I(["none","retrieval","sft","dpo","grpo","ppo","sdft","opd","opsd","sdpo"])),rewardKinds:x(I(["none","exact","deterministic","model_judge","human"])),requiresTools:z(),requiresState:z(),requiresPrivilegedGrading:z(),environmentPlacements:x(I(["local","remote","colocated","provider_native"])),exportable:z(),portabilityBlockers:x(l().trim().min(1).max(2e3)).default([])}),IC=I(["policy_failure","grader_failure","environment_failure","infrastructure_failure","timeout","cancelled"]),Of=v({id:ct,version:l().trim().min(1).max(100),label:l().trim().min(1).max(500),weight:S().min(0).max(1e3).default(1),hardGate:z().default(!1),rewardEligible:z().default(!1),privileged:z().default(!1),metadata:wo}),YU=Of.extend({kind:I(["content","schema","file","diff","test","runtime_event","state"]),config:$e(l(),Fe())}),JU=Of.extend({kind:N("model_judge"),rubric:l().trim().min(1).max(5e4),judge:ma,calibrationFixtureRefs:x(ct).min(1).max(500),calibrationStatus:I(["pending","passed","failed"]),temperature:S().min(0).max(2).default(0)}),XU=Of.extend({kind:N("human"),rubric:l().trim().min(1).max(5e4),reviewerRole:l().trim().min(1).max(500)}),QU=Of.extend({kind:N("custom_verifier"),module:l().trim().min(1).max(1e3),exportName:ct,timeoutMs:S().int().positive().max(3e5),networkPolicy:N("none")}),AC=Ua([YU,JU,XU,QU]),yb=I(["positive","negative","boundary","adversarial","prompt_injection","infrastructure_failure"]),e4=v({id:ct,taskId:ct,label:yb,output:$e(l(),Fe()),infrastructureError:l().trim().min(1).max(1e4).nullable(),expectedPassed:z(),expectedRewardEligible:z(),metadata:wo}),t4=v({id:ct,taskIndex:S().int().nonnegative(),label:yb,output:$e(l(),Fe()),infrastructureError:l().trim().min(1).max(1e4).nullable(),expectedPassed:z(),expectedRewardEligible:z(),metadata:wo}),n4=v({path:l().trim().min(1).max(1e3),role:I(["environment","verifier","fixture"]),content:l().max(25e4)});v({schemaVersion:N("openpond.taskAttempt.v1"),id:ct,tasksetId:ct,taskId:ct,split:Uc,attempt:S().int().nonnegative(),seed:S().int(),modelRef:ma.nullable(),startedAt:Yn,completedAt:Yn,output:$e(l(),Fe()),runtimeEventRefs:x(ct).max(1e4).default([]),artifactRefs:x(ct).max(1e4).default([]),privilegedOutcomeRef:Ya,infrastructureError:l().trim().min(1).max(1e4).nullable(),costUsd:S().nonnegative().nullable(),latencyMs:S().int().nonnegative(),userInterventions:S().int().nonnegative().default(0),metadata:wo});v({schemaVersion:N("openpond.taskAttemptArtifact.v1"),id:ct,tasksetId:ct,taskId:ct,attemptId:ct,kind:I(["raw_model_response","runtime_trace","environment_state","grader_evidence","output_artifact"]),path:l().trim().min(1).max(4e3),mediaType:l().trim().min(1).max(200).nullable().optional(),sha256:js,sizeBytes:S().int().nonnegative(),createdAt:Yn,metadata:wo});const a4=v({graderId:ct,graderVersion:l().trim().min(1).max(100),score:S().min(0).max(1),passed:z(),hardGate:z(),rewardEligible:z(),feedback:l().trim().max(2e4).nullable(),evidenceRefs:x(ct).max(1e4).default([]),judge:ma.nullable().optional().default(null),calibrationStatus:I(["not_applicable","pending","passed","failed"])});v({schemaVersion:N("openpond.gradeResult.v1"),id:ct,attemptId:ct,graderSetHash:js,score:S().min(0).max(1).nullable(),passed:z(),components:x(a4).min(1).max(1e3),failureClass:IC.nullable(),feedback:x(l().trim().min(1).max(2e4)).max(1e3).default([]),rewardEligible:z(),createdAt:Yn});I(["stable_hash_top_n","rft_easy_curriculum_v1"]);const o4=v({schemaVersion:N("openpond.graderAuditReport.v1"),id:ct,tasksetId:ct,tasksetHash:js,fixtureRefs:x(ct).min(1).max(1e5),gradeRefs:x(ct).min(1).max(1e5),passed:z(),hackingChecksPassed:z(),leakageChecksPassed:z(),infrastructureSafetyPassed:z(),failures:x(v({fixtureId:ct,label:yb,gradeId:ct,reason:l().trim().min(1).max(5e3)})).max(1e5),createdAt:Yn}),RC=v({primaryMethod:I(["sft","dpo","grpo","ppo","sdft","opsd","sdpo"]),bootstrap:v({method:N("sft"),purpose:N("trajectory_bootstrap"),demonstrationRefs:x(ct).min(1).max(1e5),limitations:x(l().trim().min(1).max(5e3)).min(1).max(100)}).nullable()}),TC=I(["taskset_not_ready","demonstrations_missing","preference_pairs_missing","preference_pairs_invalid","executable_reward_missing","reward_not_calibrated","reward_model_missing","value_model_required","frozen_eval_missing"]),i4=v({method:I(["sft","dpo","grpo","ppo"]),status:I(["recommended","compatible","needs_dataset_work"]),reasonCodes:x(TC).default([]),reasons:x(l().trim().min(1).max(5e3)).default([])}),EC=v({schemaVersion:N("openpond.tasksetReadiness.v1"),tasksetId:ct,tasksetHash:js,ready:z(),recommendedMethod:I(["none","retrieval","sft","dpo","grpo","ppo","sdft","opd","opsd","sdpo"]),trainingPath:RC.nullable().default(null),methodReadiness:x(i4).default([]),compatibleDestinationClasses:x(I(["export","custom","hosted_managed"])),blockers:x(v({code:ct,message:l().trim().min(1).max(5e3),path:l().trim().max(2e3).nullable()})).default([]),warnings:x(l().trim().min(1).max(5e3)).default([]),generatedAt:Yn}),r4=v({schemaVersion:N("openpond.capabilityDiagnosis.v1"),summary:l().trim().min(1).max(1e4),stableBehavior:x(l().trim().min(1).max(5e3)).max(100).default([]),changingKnowledge:x(l().trim().min(1).max(5e3)).max(100).default([]),requiredContext:x(l().trim().min(1).max(5e3)).max(100).default([]),requiredTools:x(ct).max(100).default([]),intervention:mC,trainingEligible:z(),rationale:x(l().trim().min(1).max(5e3)).min(1).max(100),confidence:S().min(0).max(1)}),s4=v({id:ct,sourceId:ct,sourceTurnId:Ya,split:Uc,origin:I(["extracted","corrected","synthetic","expert_authored"]),inputPrompt:l().trim().min(1).max(1e5),expectedOutputText:l().trim().min(1).max(2e5).nullable(),rationale:l().trim().min(1).max(5e3)}),MC=v({attempt:S().int().positive(),summary:l().trim().min(1).max(5e3),createdAt:Yn}),l4=v({schemaVersion:N("openpond.taskAuthoringProvenance.v1"),model:ma.nullable(),modelConfig:wo,skillHash:js,promptTemplateVersion:l().trim().min(1).max(200),buildIntent:vb.default("demonstrations"),buildSpecification:bb.nullable().default(null),evidenceHashes:x(js).max(1e5),tasksetSdkVersion:l().trim().min(1).max(100),sourceCommit:l().trim().min(1).max(256).nullable(),repairHistory:x(MC).max(1e3),createdAt:Yn}),h_=v({schemaVersion:N("openpond.taskset.v1"),id:ct,revision:S().int().positive().default(1),profileId:ct,profileRelease:of.nullable().optional(),createImproveRunId:Ya.default(null),name:l().trim().min(1).max(500),objective:l().trim().min(1).max(2e4),purpose:DU.default("general"),benchmark:UU.nullable().default(null),status:zU,sourceRefs:x(BU).min(1).max(1e5),datasetArtifact:hC.nullable().optional(),policy:bC,environment:WU,capabilities:CC,tasks:x(GU).max(1e6),graders:x(AC).min(1).max(1e3),graderFixtures:x(e4).min(1).max(1e5),learningSignals:ZU,authoringProvenance:l4,readiness:EC.nullable(),contentHash:js,createdAt:Yn,updatedAt:Yn,metadata:wo}).superRefine((e,t)=>{e.purpose==="benchmark"&&!e.benchmark&&t.addIssue({code:"custom",message:"Benchmark Tasksets require an immutable benchmark binding.",path:["benchmark"]}),e.purpose!=="benchmark"&&e.benchmark&&t.addIssue({code:"custom",message:"Only benchmark Tasksets may carry a benchmark binding.",path:["benchmark"]}),e.datasetArtifact&&e.tasks.length>0&&t.addIssue({code:"custom",message:"Artifact-backed Tasksets may not duplicate canonical rows inline.",path:["tasks"]}),!e.datasetArtifact&&e.tasks.length===0&&t.addIssue({code:"custom",message:"A Taskset requires inline tasks or a Dataset artifact manifest.",path:["tasks"]})}),c4=v({schemaVersion:N("openpond.taskDesignProposal.v1"),id:ct,name:l().trim().min(1).max(500),objective:l().trim().min(1).max(2e4),diagnosis:r4.default({schemaVersion:"openpond.capabilityDiagnosis.v1",summary:"Reproduce the selected approved behavior.",stableBehavior:[],changingKnowledge:[],requiredContext:[],requiredTools:[],intervention:"sft",trainingEligible:!0,rationale:["The selected examples were supplied as demonstrations."],confidence:.5}),taskKind:CC.shape.taskKind,sourceIds:x(ct).min(1).max(1e5),assumptions:x(l().trim().min(1).max(5e3)).max(1e3),successCriteria:x(l().trim().min(1).max(5e3)).min(1).max(1e3),proposedGraders:x(AC).max(1e3).default([]),graderFixtures:x(t4).max(1e5).default([]),generatedFiles:x(n4).max(1e3).default([]),proposedExamples:x(s4).max(1e5).default([]),proposedMethod:EC.shape.recommendedMethod,trainingPath:RC.nullable().default(null),policy:bC,warnings:x(l().trim().min(1).max(5e3)).default([]),createdAt:Yn}),u4=5;function TG(e,t="New model"){const a=e?.trim().split(/\s+/).filter(Boolean)??[];return a.length===0?t:a.slice(0,u4).join(" ")}const yd=v({schemaVersion:N("openpond.baseModelPreference.v1"),modelId:ct,revision:l().trim().min(1).max(256).nullable(),tokenizerRevision:l().trim().min(1).max(256).nullable(),chatTemplateHash:l().trim().min(8).max(256).nullable(),modelAssetId:Ya,source:I(["managed","local","builtin"])}),d4=v({schemaVersion:N("openpond.taskCreationRequest.v1"),id:ct,profileId:ct,surface:LU,mode:HU,entryMode:$U.default("manual"),resourceIntent:I(["workproduct","dataset"]).default("workproduct"),buildIntent:vb.default("demonstrations"),buildSpecification:bb.nullable().default(null),objective:l().trim().min(1).max(2e4).nullable(),methodHint:I(["sft","dpo","grpo","ppo"]).nullable().default(null),preferredBaseModelId:ct.nullable().default(null),preferredBaseModel:yd.nullable().default(null),sourceIds:x(ct).max(1e5),candidateId:Ya,analysisModel:ma.nullable(),analysisReasoningEffort:Rf.nullable().default(null),createImproveRunId:Ya.default(null),targetIntent:v({kind:I(["agent","skill","extension","model","configuration"]).nullable(),id:Ya,displayName:l().trim().min(1).max(500).nullable(),operation:I(["create","improve"])}).default({kind:"model",id:null,displayName:null,operation:"create"}),disclosure:v({status:I(["not_required","pending","approved","declined"]),content:N("raw_excerpts"),sourceIds:x(ct).max(1e5),providerModel:ma.nullable(),approvalId:Ya,approvedAt:Yn.nullable()}).default({status:"not_required",content:"raw_excerpts",sourceIds:[],providerModel:null,approvalId:null,approvedAt:null}),createdAt:Yn}),PC=v({schemaVersion:N("openpond.taskCreationSnapshot.v1"),id:ct,request:d4,state:I(["planning","awaiting_disclosure_approval","awaiting_questions","recommendation_ready","awaiting_materialization_approval","materializing","validating","ready","blocked","failed","cancelled"]),proposal:c4.nullable(),materializedTasksetId:Ya,disclosureApprovalId:Ya,materializationApprovalId:Ya,blockingQuestions:x(v({id:ct,kind:I(["objective","consent","success_signal","privacy_licensing","interpretation"]),prompt:l().trim().min(1).max(5e3),answer:l().trim().min(1).max(2e4).nullable()})).default([]),transcript:x(v({id:ct,role:I(["user","assistant","system","tool"]),text:l().max(1e5),createdAt:Yn})).max(1e4).default([]),repairHistory:x(MC).max(1e3).default([]),blockedReason:l().trim().min(1).max(1e4).nullable(),createdAt:Yn,updatedAt:Yn});v({schemaVersion:N("openpond.taskCreationTranscript.v1"),creationId:ct,profileId:ct,messages:PC.shape.transcript,updatedAt:Yn});function m4(e){return e.schemaVersion==="openpond.trainingSource.v1"}const Rc=l().trim().min(1).max(240),Vm=l().trim().min(1),sv=l().trim().min(8).max(256),OC=$e(l(),Fe()).default({}),f4=I(["created","inspecting","awaiting_source_review","awaiting_mapping","awaiting_materialization_approval","materializing","validating","ready","cancelling","cancelled","failed"]),jC=v({schemaVersion:N("openpond.huggingFaceDatasetLocator.v1"),repositoryId:l().trim().regex(/^[^/\s]+\/[^/\s]+$/).max(500),repositoryUrl:l().url().max(2e3),requestedRevision:l().trim().min(1).max(256).nullable()}),p4=v({path:l().trim().min(1).max(1e3),logicalType:l().trim().min(1).max(500),nullable:z(),sampleValues:x(Fe()).max(5)}),h4=v({configuration:l().trim().min(1).max(500),split:l().trim().min(1).max(500),rowCount:S().int().nonnegative().nullable(),sizeBytes:S().int().nonnegative().nullable()}),g4=v({schemaVersion:N("openpond.huggingFaceDatasetInspection.v1"),id:Rc,locator:jC,resolvedRevision:l().trim().min(7).max(256),title:l().trim().min(1).max(500),description:l().max(2e4).nullable(),declaredLicense:l().trim().min(1).max(500).nullable(),gated:z(),private:z(),configurations:x(l().trim().min(1).max(500)).min(1).max(1e3),splits:x(h4).min(1).max(1e4),columns:x(p4).min(1).max(1e4),previewRows:x($e(l(),Fe())).max(25),sourceFiles:x(v({path:l().trim().min(1).max(2e3),configuration:l().trim().min(1).max(500),split:l().trim().min(1).max(500),revision:l().trim().min(7).max(256),sizeBytes:S().int().nonnegative().nullable(),contentHash:sv.nullable()})).max(1e5),inspectedAt:Vm,metadata:OC}),v4=I(["row_id","cluster_id","prompt","messages","demonstration","chosen","rejected","expected_output","privileged_context","reward","feedback","tag","metadata"]),b4=v({sourcePath:l().trim().min(1).max(1e3),target:v4,transform:I(["identity","string","json","messages","numeric","math_final_answer"]),policy:I(["visible","privileged","metadata"]),required:z()}),NC=v({schemaVersion:N("openpond.datasetImportMapping.v1"),sourceSchemaHash:sv,configuration:l().trim().min(1).max(500),upstreamSplits:x(l().trim().min(1).max(500)).min(1).max(1e3),preset:I(["prompt_only","prompt_completion","messages","preference","prompt_expected_answer","prompt_privileged_solution","prompt_feedback"]),bindings:x(b4).min(1).max(1e4),nullPolicy:I(["reject","drop","preserve"]),invalidRowPolicy:I(["reject_import","drop_with_receipt"]),splitPolicy:v({seed:S().int(),assignments:$e(l(),Ds),validationPercent:S().min(0).max(100),frozenEvalPercent:S().min(0).max(100)}),importerVersion:l().trim().min(1).max(200),mappingHash:sv}),y4=v({phase:I(["idle","metadata","download","mapping","parquet_write","verification","publish"]),completedBytes:S().int().nonnegative(),totalBytes:S().int().nonnegative().nullable(),completedRows:S().int().nonnegative(),totalRows:S().int().nonnegative().nullable(),message:l().trim().min(1).max(2e3).nullable()}),S4=v({schemaVersion:N("openpond.datasetImportJob.v1"),id:Rc,profileId:Rc,sourceKind:I(["huggingface","uploaded_file"]),status:f4,locator:jC.nullable(),inspection:g4.nullable(),mapping:NC.nullable(),progress:y4,targetStorageRoot:l().trim().min(1).max(4e3).nullable(),tasksetId:Rc.nullable(),tasksetRevision:S().int().positive().nullable(),artifactId:Rc.nullable(),error:l().trim().min(1).max(2e4).nullable(),cancellationRequested:z(),createdAt:Vm,updatedAt:Vm,completedAt:Vm.nullable(),metadata:OC});v({profileId:Rc,url:l().trim().min(1).max(2e3)});v({name:l().trim().min(1).max(500),objective:l().trim().min(1).max(2e4),mapping:NC,targetStorageRoot:l().trim().min(1).max(4e3).nullable(),licenseApproved:z().default(!1)});const Rs=rt.nullable(),Ir=S().int().nonnegative(),_4=l().regex(/^[a-f0-9]{40}$/),x4=v({name:l().trim().min(1).max(160),startedAt:Wn,completedAt:Wn,durationMs:S().nonnegative(),clock:I(["monotonic","provider","wall"]),outcome:I(["succeeded","failed","cancelled"])}).strict(),k4=v({schemaVersion:N("openpond.correlatedTelemetryReceipt.v1"),stage:I(["training","evaluation","deployment","inference"]),correlation:v({modelRunId:Rs,modelVersionId:Rs,policyVersion:Ir.nullable(),taskId:Rs,rolloutGroupId:Rs,providerResourceId:Rs,deploymentId:Rs,inferenceRequestId:Rs}).strict(),spans:x(x4).max(1e4),usage:v({promptTokens:Ir.nullable(),generatedTokens:Ir.nullable(),gpuSeconds:S().nonnegative().nullable(),workerActiveSeconds:S().nonnegative().nullable(),optimizerSteps:Ir.nullable(),rolloutGroups:Ir.nullable(),successfulTrajectories:Ir.nullable(),failedTrajectories:Ir.nullable(),peakGpuMemoryBytes:Ir.nullable(),peakGpuUtilizationPercent:S().min(0).max(100).nullable()}).strict(),resource:v({provider:rt,resourceIds:x(rt).max(1e3),gpuType:l().trim().min(1).max(300).nullable(),gpuCount:Ir.nullable(),baseProfileId:Rs,baseRepository:l().trim().min(1).max(512).nullable(),baseRevision:_4.nullable(),adapterContentHash:ft.nullable()}).strict(),cost:v({currency:N("USD"),providerReportedUsd:S().nonnegative().nullable(),quotedHourlyUsd:S().nonnegative().nullable(),estimatedUsd:S().nonnegative().nullable(),methodologyVersion:l().trim().min(1).max(160),pricingInputs:$e(l().trim().min(1).max(160),S().finite()),unitEstimates:$e(l().trim().min(1).max(160),S().nonnegative())}).strict(),recordedAt:Wn,contentHash:ft}).strict(),w4=I(["base_reference","lora_adapter"]),C4=v({schemaVersion:N("openpond.modelVersion.v1"),id:rt,modelId:rt,profileId:rt,version:S().int().nonnegative(),kind:w4,status:I(["available","failed"]),baseModel:yd,taskset:of,releaseGraph:v({resolvedBundleHash:ft,profileRelease:of,harnessRelease:Yt,agentRelease:Yt.nullable(),grader:v({id:rt,contentHash:ft}).strict()}).strict(),artifactLineageId:rt.nullable(),adapterStatus:I(["not_trained","trained"]),createdAt:Wn,contentHash:ft}).strict().superRefine((e,t)=>{e.kind==="base_reference"&&(e.version!==0||e.adapterStatus!=="not_trained"||e.artifactLineageId!==null)&&t.addIssue({code:"custom",message:"A base-reference Model Version must be version 0 without adapter lineage."}),e.kind==="lora_adapter"&&(e.version===0||e.adapterStatus!=="trained"||!e.artifactLineageId)&&t.addIssue({code:"custom",message:"A LoRA Model Version must be version 1+ with adapter lineage."})}),I4=v({schemaVersion:N("openpond.modelRunReceipt.v1"),provider:rt,providerRunId:rt,assignmentHash:ft,resultHash:ft,transcriptHash:ft,traceHash:ft.nullable(),resolvedBundleHash:ft,artifactPath:l().trim().min(1).max(2e3),cleanup:v({computeReleased:z(),tunnelClosed:z()}).strict(),telemetry:k4.nullable().default(null),contentHash:ft}).strict(),vc=v({inputTokens:S().int().nonnegative(),outputTokens:S().int().nonnegative(),totalTokens:S().int().nonnegative(),costUsd:S().nonnegative().nullable()}).strict(),g_=l().regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/),Sb=v({phase:I(["baseline","adaptation","candidate_adaptation","candidate"]),taskId:rt,attemptId:rt,sessionId:rt.nullable(),turnId:rt.nullable(),passed:z(),score:S().min(0).max(1).nullable(),failureClass:IC.nullable(),inputTokens:S().int().nonnegative(),outputTokens:S().int().nonnegative(),totalTokens:S().int().nonnegative(),latencyMs:S().int().nonnegative(),costUsd:S().nonnegative().nullable(),startedAt:Wn}).strict(),v_=v({targetTaskCount:S().int().nonnegative(),comparedTaskCount:S().int().nonnegative(),passedTaskCount:S().int().nonnegative(),failedTaskCount:S().int().nonnegative(),lowerTaskCount:S().int().nonnegative(),higherTaskCount:S().int().nonnegative(),unchangedTaskCount:S().int().nonnegative()}).strict(),zC=v({target:N("all_tasks_lower"),targetTaskCount:S().int().nonnegative(),comparedTaskCount:S().int().nonnegative(),passedTaskCount:S().int().nonnegative(),failedTaskCount:S().int().nonnegative(),lowerTaskCount:S().int().nonnegative(),higherTaskCount:S().int().nonnegative(),unchangedTaskCount:S().int().nonnegative(),baselineTokens:S().int().nonnegative(),refinedTokens:S().int().nonnegative(),tokenDelta:S().int(),tokenDeltaPercent:S().finite().nullable(),complete:z(),passed:z(),cohorts:v({adaptation:v_,heldOut:v_}).strict()}).strict(),_b=v({baseline:vc,adaptation:vc,candidateAdaptation:vc,candidate:vc,refiner:vc,grader:vc}).strict(),A4=v({usage:_b,observedSpendUsd:S().nonnegative(),attempts:x(Sb).max(1e4)}).strict(),R4=v({id:rt,contentHash:ft,artifactPath:l().trim().min(1).max(2e3)}).strict(),T4=v({schemaVersion:N("openpond.modelEvaluationReceipt.v1"),benchmarkId:rt,resultManifest:v({id:rt,contentHash:ft,artifactPath:l().trim().min(1).max(2e3)}).strict(),stages:v({baseline:Yt,adaptation:Yt,refiner:Yt,candidateAdaptation:Yt,candidate:Yt,comparison:Yt}).strict(),usage:_b,quality:v({baselinePassRate:S().min(0).max(1),candidatePassRate:S().min(0).max(1),adaptationBaselinePassRate:S().min(0).max(1),adaptationCandidatePassRate:S().min(0).max(1),adaptationCandidatePassed:z(),heldOutCandidatePassed:z(),passed:z()}).strict(),foregroundTokenDelta:S().int(),foregroundTokenDeltaPercent:S().finite().nullable(),taskEfficiency:zC.optional(),efficiency:v({grossForegroundTokenSavings:S().int(),overheadTokens:S().int().nonnegative(),firstPassNetTokenSavings:S().int(),breakEvenReuseCount:S().int().nonnegative().nullable(),amortizedTokenSavings:S().int(),amortizedReuseCount:S().int().positive()}).strict(),budget:v({maximumSpendUsd:S().nonnegative(),observedSpendUsd:S().nonnegative(),enforced:z()}).strict(),evidenceSnapshot:Yt,lineage:v({adaptationEvidenceHash:ft,refinerInputHash:ft,refinerOutcomeHash:ft,validationHash:ft,applyReceiptHash:ft,candidateRelease:Yt,valid:z()}).strict(),invalidReasons:x(l().trim().min(1).max(2e3)).max(100),attempts:x(Sb).max(1e4).default([]),terminalClassification:I(["improved","no_improvement","regressed","inconclusive","cancelled","infrastructure_failure"]),profileGit:v({ref:l().trim().min(1).max(2e3),commit:g_,baseCommit:g_}).strict().nullable(),contentHash:ft}).strict(),E4=v({schemaVersion:N("openpond.modelEvaluationStopReceipt.v1"),benchmarkId:rt,terminalClassification:N("inconclusive"),stopReason:I(["candidate_harness_unchanged","candidate_lineage_invalid"]),reason:l().trim().min(1).max(5e3),stoppedAfter:N("refiner"),baselineHarness:Yt,candidateHarness:Yt,refiner:v({id:rt,contentHash:ft,outcomeCount:S().int().nonnegative()}).strict(),usage:_b,budget:v({maximumSpendUsd:S().nonnegative(),observedSpendUsd:S().nonnegative(),enforced:z()}).strict(),evidenceSnapshot:Yt,attempts:x(Sb).max(1e4),contentHash:ft}).strict(),M4=v({benchmarkId:rt,model:ma,upstreamModel:v({providerId:rt,modelId:l().trim().min(1).max(300),revision:l().trim().min(1).max(300),pricing:v({version:l().trim().min(1).max(300),source:l().trim().min(1).max(300),effectiveAt:Wn,inputUsdPerMillionTokens:S().nonnegative(),cachedInputUsdPerMillionTokens:S().nonnegative(),outputUsdPerMillionTokens:S().nonnegative()}).strict().optional()}).strict(),reasoningEffort:l().trim().min(1).max(100).nullable(),seeds:x(S().int()).min(1).max(100),repetitions:S().int().positive().max(20),maximumSpendUsd:S().nonnegative(),attemptPlan:x(v({stage:I(["baseline","adaptation","candidate_adaptation","candidate"]),split:l().trim().min(1).max(100),taskIds:x(rt).min(1).max(1e5),attemptCount:S().int().positive()}).strict()).length(4)}).strict(),P4=v({schemaVersion:N("openpond.modelRun.v1"),id:rt,modelId:rt,modelVersionId:rt,profileId:rt,kind:I(["rollout_smoke","training","evaluation"]),status:I(["prepared","running","succeeded","failed","cancelled"]),method:I(["sft","dpo","grpo","ppo","sdft","opd","opsd","sdpo"]).nullable(),destinationId:rt.nullable(),taskset:of,harnessRelease:Yt.nullable().optional(),quote:v({maximumSpendUsd:S().nonnegative(),hourlyCostUsd:S().nonnegative().nullable()}).strict().nullable(),evaluation:M4.nullable().default(null),evaluationProgress:v({stage:I(["baseline","adaptation","refiner","candidate_adaptation","candidate","comparison"]),completedAttempts:S().int().nonnegative(),totalAttempts:S().int().positive(),accounting:A4.nullable().default(null),evidenceSnapshot:R4.nullable().default(null)}).strict().nullable().default(null),reward:v({raw:S(),components:$e(l(),S())}).strict().nullable(),receipt:Ua([I4,T4,E4]).nullable(),adapterArtifactLineageId:rt.nullable(),failure:l().trim().min(1).max(5e3).nullable(),startedAt:Wn,completedAt:Wn.nullable(),updatedAt:Wn}).strict().superRefine((e,t)=>{e.status==="succeeded"&&!e.receipt&&t.addIssue({code:"custom",message:"A successful Model Run requires a canonical receipt."}),e.kind==="evaluation"&&(e.method!==null||e.destinationId!==null||!e.evaluation||e.adapterArtifactLineageId!==null)&&t.addIssue({code:"custom",message:"An evaluation Model Run requires evaluation configuration and cannot claim training method, destination, or adapter lineage."}),e.kind==="evaluation"&&e.receipt&&e.receipt.schemaVersion!=="openpond.modelEvaluationReceipt.v1"&&e.receipt.schemaVersion!=="openpond.modelEvaluationStopReceipt.v1"&&t.addIssue({code:"custom",message:"An evaluation Model Run requires an evaluation receipt."}),e.kind!=="evaluation"&&(e.method===null||e.destinationId===null||e.quote===null)&&t.addIssue({code:"custom",message:"A training or rollout Model Run requires method, destination, and quote."}),e.kind==="rollout_smoke"&&e.adapterArtifactLineageId!==null&&t.addIssue({code:"custom",message:"A rollout smoke cannot claim adapter artifacts."})});function EG(e){const t=new Map;for(const A of e.attempts){const H=`${A.phase}\0${A.taskId}`,W=t.get(H);(!W||A.startedAt>W.startedAt||A.startedAt===W.startedAt&&A.attemptId>W.attemptId)&&t.set(H,A)}const a=[...t.values()],i=[["adaptation","adaptation","candidate_adaptation"],["held_out","baseline","candidate"]].flatMap(([A,H,W])=>{const B=new Map(a.filter(M=>M.phase===W).map(M=>[M.taskId,M]));return a.filter(M=>M.phase===H).flatMap(M=>{const j=B.get(M.taskId);return j?[{cohort:A,taskId:M.taskId,baseline:M,refined:j,tokenDelta:j.totalTokens-M.totalTokens}]:[]})}),s=new Set(a.filter(A=>A.phase==="baseline"||A.phase==="adaptation").map(A=>A.taskId)).size,u=e.targetTaskCount??s;if(!Number.isInteger(u)||u<0)throw new Error("Benchmark task-efficiency target must be a non-negative integer.");const d={adaptation:new Set(a.filter(A=>A.phase==="adaptation").map(A=>A.taskId)).size,held_out:new Set(a.filter(A=>A.phase==="baseline").map(A=>A.taskId)).size},f=(A,H)=>({targetTaskCount:H,comparedTaskCount:A.length,passedTaskCount:A.filter(W=>W.tokenDelta<0).length,failedTaskCount:A.filter(W=>W.tokenDelta>=0).length,lowerTaskCount:A.filter(W=>W.tokenDelta<0).length,higherTaskCount:A.filter(W=>W.tokenDelta>0).length,unchangedTaskCount:A.filter(W=>W.tokenDelta===0).length}),b=f(i,u),p=i.reduce((A,H)=>A+H.baseline.totalTokens,0),y=i.reduce((A,H)=>A+H.refined.totalTokens,0),k=y-p,w=i.length===u;return{summary:zC.parse({target:"all_tasks_lower",...b,baselineTokens:p,refinedTokens:y,tokenDelta:k,tokenDeltaPercent:p>0?k/p*100:null,complete:w,passed:w&&b.passedTaskCount===u,cohorts:{adaptation:f(i.filter(A=>A.cohort==="adaptation"),d.adaptation),heldOut:f(i.filter(A=>A.cohort==="held_out"),d.held_out)}}),pairs:i}}const Fm=l().trim().min(1).max(240),Km=l().trim().min(8).max(256),DC=I(["grpo","dapo","gspo-token"]),ed=v({id:Fm,revision:l().trim().min(1).max(256),tokenizerRevision:l().trim().min(1).max(256),chatTemplateHash:Km}),O4=v({maxRollouts:S().int().positive().max(1e6),maxEnvironmentExecutions:S().int().positive().max(1e6),maxInputTokens:S().int().positive(),maxOutputTokens:S().int().positive(),maxOptimizerSteps:S().int().positive().max(1e6),wallTimeMs:S().int().positive(),maximumCostUsd:S().nonnegative().nullable()}),j4=v({method:N("grpo"),groupSize:S().int().min(2).max(128),normalization:N("group_standardized"),loss:DC}),UC=v({method:N("ppo"),valueModel:ed,gamma:S().min(0).max(1),gaeLambda:S().min(0).max(1),policyClip:S().positive().max(1),valueClip:S().positive().max(10),valueLossCoefficient:S().nonnegative().max(10),ppoEpochs:S().int().positive().max(100),minibatchSize:S().int().positive().max(1e5)}),N4=Ja("method",[j4,UC]),LC=v({schemaVersion:N("openpond.policyOptimization.v1"),policyModel:ed,referenceModel:ed,dataset:v({tasksetId:Fm,tasksetHash:Km,split:N("train"),selectionStrategy:I(["stable_hash_top_n","rft_easy_curriculum_v1"]),selectionSeed:S().int(),maxExamples:S().int().positive().max(1e5)}),sampler:v({temperature:S().min(0).max(2),topP:S().min(0).max(1),maxOutputTokens:S().int().positive().max(32768),maxTurns:S().int().positive().max(1e3),concurrency:S().int().positive().max(1e3)}),environment:v({id:Fm,version:l().trim().min(1).max(256),toolContractHash:Km}),reward:v({graderId:Fm,graderHash:Km}),kl:v({coefficient:S().nonnegative().nullable(),referenceConstraint:N("fixed_reference")}),budgets:O4,checkpointEverySteps:S().int().positive(),seed:S().int(),evaluationSplit:N("frozen_eval"),optimizer:N4}),Ke=l().trim().min(1).max(240),Vt=l().trim().min(1),Nt=l().trim().min(8).max(256),Sd=$e(l(),Fe()).default({}),HC=v({schemaVersion:N("openpond.localModelChatConfiguration.v1").default("openpond.localModelChatConfiguration.v1"),profile:I(["efficient","full_harness","custom"]).default("efficient"),systemPromptMode:I(["lean","full_harness","custom"]).default("lean"),customSystemPrompt:l().max(2e4).nullable().default(null),contextWindowTokens:S().int().min(128).max(32768).default(1024),maxOutputTokens:S().int().min(1).max(512).default(64),temperature:S().min(0).max(2).default(0),repetitionPenalty:S().min(.5).max(2).default(1.1),noRepeatNgramSize:S().int().min(0).max(10).default(3),compaction:I(["off","when_needed"]).default("when_needed"),keepWarmSeconds:S().int().min(0).max(3600).default(300),updatedAt:Vt.nullable().default(null)}),z4=HC.parse({}),D4=v({schemaVersion:N("openpond.managedAdapterServingProjection.v1"),teamId:Ke.nullable().default(null),source:N("sandbox_managed_rl"),sourceRef:Ke,canonicalArtifactId:Ke.nullable(),canonicalArtifactState:I(["imported_unvalidated","evaluating","promotable","rejected","deleted"]).nullable(),canonicalDeploymentId:Ke.nullable(),canonicalDeploymentState:I(["requested","deploying","ready","degraded","deleting","deleted","failed"]).nullable(),state:I(["pending","imported","ready","failed"]),customerBindingAllowed:z().default(!1),artifactContentHash:Nt.nullable().default(null),baseProfileId:Ke.nullable().default(null),publishedAt:Vt.nullable(),lastSyncedAt:Vt,lastError:l().trim().min(1).max(5e3).nullable()});function MG(e){const t=e.managedServing;return!!(t?.source==="sandbox_managed_rl"&&t.canonicalArtifactState==="promotable"&&t.customerBindingAllowed)}function U4(e){return e.state==="ready"&&e.canonicalArtifactState==="promotable"&&e.canonicalDeploymentState==="ready"&&e.customerBindingAllowed&&!!e.teamId&&!!e.canonicalArtifactId&&!!e.canonicalDeploymentId}function PG(e){if(e.promotable&&e.frozenEvaluationArtifactId)return{kind:"source_frozen_evaluation",evaluationArtifactId:e.frozenEvaluationArtifactId,canonicalArtifactId:null,canonicalDeploymentId:null};const t=e.managedServing;return t?.source==="sandbox_managed_rl"&&U4(t)&&t.canonicalArtifactId&&t.canonicalDeploymentId?{kind:"sandbox_customer_binding",evaluationArtifactId:null,canonicalArtifactId:t.canonicalArtifactId,canonicalDeploymentId:t.canonicalDeploymentId}:null}const xb="openpond.crossSystemOperations.v1",OG="1.0.0",$C="openpond.crossSystemTools.v1",L4=["search_crm","query_billing","search_support","run_python"],H4=I(["train","validation","frozen_eval"]),$4=I(["easy","medium","hard"]),q4=I(["renewal_risk_v2"]);I(["renewal_exposure","collections_prioritization","invoice_reconciliation","sla_escalation","contract_billing_mismatch"]);v({seed:S().int().nonnegative(),split:H4,difficulty:$4,scenarioProfile:q4.optional()});const mg={anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}],default:null},fg={type:"integer",minimum:1,maximum:50,default:25},kb=[{name:"search_crm",description:"Search synthetic CRM accounts and contacts. Results are scoped, projected, paginated, and budgeted.",parameters:{type:"object",additionalProperties:!1,required:["query","fields","cursor","limit"],properties:{query:{type:"string",minLength:1,maxLength:500},fields:{type:"array",minItems:1,maxItems:12,uniqueItems:!0,items:{type:"string",enum:["account_id","name","aliases","contact_ids","contract_value_usd_cents","renewal_date","tier","active_contract_id","contract_term_months"]}},cursor:mg,limit:fg}}},{name:"query_billing",description:"Query synthetic invoices and payments for explicit account IDs and a bounded date range.",parameters:{type:"object",additionalProperties:!1,required:["account_ids","date_range","status","cursor","limit"],properties:{account_ids:{type:"array",minItems:1,maxItems:50,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:100}},date_range:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",format:"date"},to:{type:"string",format:"date"}}},status:{type:"array",minItems:1,maxItems:6,uniqueItems:!0,items:{type:"string",enum:["open","overdue","paid","disputed","scheduled","void"]}},cursor:mg,limit:fg}}},{name:"search_support",description:"Search synthetic support cases for explicit account IDs, severity, and state filters.",parameters:{type:"object",additionalProperties:!1,required:["account_ids","severity","state","cursor","limit"],properties:{account_ids:{type:"array",minItems:1,maxItems:50,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:100}},severity:{type:"array",minItems:1,maxItems:4,uniqueItems:!0,items:{type:"string",enum:["P1","P2","P3","P4"]}},state:{type:"array",minItems:1,maxItems:5,uniqueItems:!0,items:{type:"string",enum:["new","investigating","waiting_customer","resolved","closed"]}},cursor:mg,limit:fg}}},{name:"run_python",description:"Run standard-library-only Python in the persistent synthetic attempt sandbox with strict limits and no network.",parameters:{type:"object",additionalProperties:!1,required:["code"],properties:{code:{type:"string",minLength:1,maxLength:1e4}}}}],_d=Q4({schemaVersion:$C,tools:kb}),B4=[`Use only the four registered synthetic Cross-System Operations tools. Contract ${_d}.`,"Treat every filter as exact. An overdue-only query_billing call returns invoice rows; payment rows are included only when paid is requested.","For cross-system joins, retrieve the bounded projected rows and use run_python for date filtering, set intersection, and arithmetic before answering.","Finish with ANSWER: JSON."].join(" "),V4=15;function F4(e="auto"){return[B4,"LOCAL TOOL PROTOCOL (strict):","Use only the registered functions below. Never invent, rename, or call any other tool.","For one tool call, output exactly one JSON object and no prose:",'{"type":"tool_call","name":"registered_name","arguments":{}}',"Tool results arrive as exactly one JSON object:",'{"type":"tool_result","name":"registered_name","ok":true,"result":{},"error":null}','After one tool result, either call one registered tool again or answer normally. A JSON final may use {"type":"final","content":"..."}.',`Tool choice: ${JSON.stringify(e)}. Maximum tool turns: ${V4}.`,`Registered tool signatures: ${kb.map(K4).join("; ")}`].join(`
|
|
132
|
-
`)}F4();function K4(e){const t=rf(e.parameters),a=rf(t.properties),i=qC(t.required),s=Object.fromEntries(i.map(u=>[u,Gm(a[u])]));return`${e.name}(${JSON.stringify(s)})`}function Gm(e){const t=rf(e),a=lv(t.anyOf);if(a.length)return a.map(Gm).join("|");const i=lv(t.enum);if(i.length)return i.join("|");if(t.type==="array")return[Gm(t.items)];if(t.type==="object"){const s=rf(t.properties),u=qC(t.required);return Object.fromEntries(u.map(d=>[d,Gm(s[d])]))}return typeof t.type=="string"?t.type:"unknown"}function rf(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function lv(e){return Array.isArray(e)?e:[]}function qC(e){return lv(e).filter(t=>typeof t=="string")}const sf=I(L4),G4=Ja("kind",[v({kind:N("model"),turn:S().int().nonnegative(),content:l().max(1e5)}),v({kind:N("tool_call"),turn:S().int().nonnegative(),callId:l().trim().min(1).max(240),name:sf,arguments:$e(l(),Fe())}),v({kind:N("tool_result"),turn:S().int().nonnegative(),callId:l().trim().min(1).max(240),name:sf,ok:z(),result:Fe(),rows:S().int().nonnegative(),bytes:S().int().nonnegative(),durationMs:S().int().nonnegative(),error:l().trim().min(1).max(2e4).nullable()}),v({kind:N("final"),turn:S().int().nonnegative(),content:l().max(1e5)})]),Z4=v({schemaVersion:N(xb),id:l().trim().min(1).max(240),worldId:l().trim().min(1).max(240),taskId:l().trim().min(1).max(240),toolContractHash:N(_d),modelRef:v({providerId:l().trim().min(1),modelId:l().trim().min(1)}).nullable(),status:I(["completed","budget_exhausted","cancelled","infrastructure_failure"]),steps:x(G4).max(1e3),startedAt:l().trim().min(1),completedAt:l().trim().min(1),infrastructureError:l().trim().min(1).max(2e4).nullable(),metadata:$e(l(),Fe()).default({})}),W4=v({schemaVersion:N(xb),trajectoryId:l().trim().min(1).max(240),outcome:I(["correct","incorrect","parse_failure","budget_exhausted","tool_schema_violation","infrastructure_failure","cancelled"]),reward:S().min(0).max(1.15).nullable(),rewardEligible:z(),exactAnswer:z(),components:v({exactAnswer:S().min(0).max(1),efficiency:S().min(0).max(.1),conciseOutput:S().min(0).max(.05)}),metrics:v({toolCalls:S().int().nonnegative(),rowsRead:S().int().nonnegative(),bytesRead:S().int().nonnegative(),consecutiveRetrievalCalls:S().int().nonnegative(),wallTimeMs:S().int().nonnegative(),parseFailures:S().int().nonnegative(),budgetExhausted:z()}),parsedAnswer:Fe().nullable(),feedback:x(l().trim().min(1).max(5e3)).max(100)}),Y4=v({id:l().trim().min(1).max(240),type:N("function"),function:v({name:sf,arguments:l().max(2e4)})}),BC=v({role:I(["system","user","assistant","tool"]),content:l().max(2e5).nullable(),tool_call_id:l().trim().min(1).max(240).optional(),tool_calls:x(Y4).max(4).optional()});v({schemaVersion:N(xb),id:l().trim().min(1).max(240),taskId:l().trim().min(1).max(240),worldId:l().trim().min(1).max(240),trajectoryId:l().trim().min(1).max(240),toolContractHash:N(_d),approval:v({status:N("approved"),approvedBy:l().trim().min(1).max(240),approvedAt:l().trim().min(1)}),messages:x(BC).min(3).max(1e3)});const J4=v({tasksetTaskId:l().trim().min(1).max(240),environmentTaskId:l().trim().min(1).max(240),family:I(["renewal_exposure","collections_prioritization","invoice_reconciliation","sla_escalation","contract_billing_mismatch"]),prompt:l().trim().min(1).max(1e5),finalAnswer:l().trim().min(1).max(2e5),trajectoryId:l().trim().min(1).max(240),trajectoryHash:l().trim().min(8).max(256),toolNames:x(sf).min(1).max(100),toolCallCount:S().int().positive(),messageCount:S().int().min(3),reward:S().min(0).max(1.15),messages:x(BC).min(3).max(1e3)}),X4=v({status:N("approved"),approvedBy:l().trim().min(1).max(240),approvedAt:l().trim().min(1),previewHash:l().trim().min(8).max(256),trajectoryCount:S().int().positive()});v({schemaVersion:N("openpond.crossSystemExpertBootstrapPreview.v1"),tasksetId:l().trim().min(1).max(240),tasksetHash:l().trim().min(8).max(256),tasksetRevision:S().int().positive(),previewHash:l().trim().min(8).max(256),toolContractHash:N(_d),status:I(["ready_for_review","approved"]),approval:X4.nullable(),tasks:x(J4).min(1).max(100)});function Q4(e){const t=cv(e);let a=2166136261,i=2654435769;for(let s=0;s<t.length;s+=1){const u=t.charCodeAt(s);a=Math.imul(a^u,16777619),i=Math.imul(i^u,2246822507)}return`${$C}:${b_(a)}${b_(i)}`}function cv(e){return Array.isArray(e)?`[${e.map(cv).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[a])=>t.localeCompare(a)).map(([t,a])=>`${JSON.stringify(t)}:${cv(a)}`).join(",")}}`:JSON.stringify(e)}function b_(e){return(e>>>0).toString(16).padStart(8,"0")}const e3=v({schemaVersion:N("openpond.singleTurnPolicyTrajectory.v1"),id:Ke,taskId:Ke,status:I(["completed","infrastructure_failure"]),promptHash:Nt,responseText:l().max(2e6),infrastructureError:l().trim().min(1).max(1e4).nullable(),startedAt:Vt,completedAt:Vt,metadata:Sd}),t3=v({schemaVersion:N("openpond.ppoTrajectory.v1"),id:Ke,taskId:Ke,policyModelId:Ke,referenceModelId:Ke,valueModelId:Ke,steps:x(v({index:S().int().nonnegative(),observationHash:Nt,actionTokenIds:x(S().int().nonnegative()).min(1),terminated:z(),truncated:z(),reward:S(),policyLogProbability:S(),referenceLogProbability:S(),valuePrediction:S(),return:S(),advantage:S(),mask:S().min(0).max(1)})).min(1).max(1e5),createdAt:Vt}),n3=v({schemaVersion:N("openpond.exactAnswerVerifierResult.v1"),outcome:I(["correct","incorrect","parse_failure","infrastructure_failure"]),graderSetHash:Nt,score:S().min(0).max(1).nullable(),passed:z(),rewardEligible:z(),expectedAnswerHash:Nt,extractedAnswer:l().max(2e4).nullable(),feedback:x(l().trim().min(1).max(2e4)).max(1e3)}),a3=v({schemaVersion:N("openpond.rolloutTrajectoryReceipt.v1"),id:Ke,jobId:Ke,planId:Ke,tasksetId:Ke,tasksetHash:Nt,taskId:Ke,split:N("train"),correlationId:Ke,provider:Ke,providerTrace:v({invocationId:Ke,experimentId:Ke,rolloutId:Ke,runId:Ke,rowId:Ke}),optimizerMethod:I(["grpo","ppo"]).default("grpo"),evidenceLevels:v({requested:I(["trajectory","aggregate","provider_reported"]),observed:I(["trajectory","aggregate","provider_reported"]),providerReported:I(["trajectory","aggregate","provider_reported"])}).default({requested:"trajectory",observed:"trajectory",providerReported:"provider_reported"}),budgetUsage:v({rollouts:S().int().nonnegative(),environmentExecutions:S().int().nonnegative(),inputTokens:S().int().nonnegative(),outputTokens:S().int().nonnegative(),optimizerSteps:S().int().nonnegative(),costUsd:S().nonnegative()}).default({rollouts:0,environmentExecutions:0,inputTokens:0,outputTokens:0,optimizerSteps:0,costUsd:0}),environment:v({id:Ke,version:l().trim().min(1).max(256),worldId:Ke,worldHash:Nt,toolContractHash:Nt}),policy:v({modelId:Ke,checkpointId:Ke.nullable(),completionParametersHash:Nt}),status:I(["received","running","succeeded","failed"]),failureClass:I(["policy_failure","parse_failure","tool_schema_violation","budget_exhausted","cancelled","environment_failure","infrastructure_failure"]).nullable(),reward:v({eligible:z(),raw:S().min(0).max(1.15).nullable(),normalized:S().min(0).max(1).nullable(),components:$e(l(),S())}),trajectory:Ua([Z4,e3,t3]).nullable(),verifier:Ua([W4,n3]).nullable(),providerStatus:$e(l(),Fe()).default({}),receivedAt:Vt,startedAt:Vt.nullable(),completedAt:Vt.nullable(),updatedAt:Vt}),jG="dataset-exact-answer",NG="dataset-exact-answer-v1",zG="no-tools-v1",Us=I(["sft","dpo","grpo","ppo","sdft","opd","opsd","sdpo"]),jf=I(["lora","full"]),Or=I(["openpond_managed"]),o3=v({schemaVersion:N("openpond.sftRecipe.v1"),method:N("sft"),parameterization:N("lora"),baseModel:v({id:Ke,revision:l().trim().min(1).max(256),tokenizerRevision:l().trim().min(1).max(256),chatTemplateHash:Nt}),dataset:v({trainSplit:N("train"),validationSplit:I(["validation","frozen_eval"]),completionOnly:z(),maxSequenceLength:S().int().positive().max(32768),maxExamples:S().int().positive().max(1e5).default(1e3),selectionStrategy:N("stable_hash_top_n").default("stable_hash_top_n"),selectionSeed:S().int().default(17)}),lora:v({rank:S().int().positive().max(256),alpha:S().positive().max(1024),dropout:S().min(0).max(1),targetModules:x(Ke).min(1).max(100)}),optimizer:v({learningRate:S().positive(),epochs:S().positive().max(100),maxSteps:S().int().positive().max(1e6),batchSize:S().int().positive().max(1e4),gradientAccumulationSteps:S().int().positive().max(1e4),seed:S().int()}),resourceLimits:v({cpuThreads:S().int().positive().max(256),memoryBytes:S().int().positive(),wallTimeMs:S().int().positive()})});v({id:Ke,input:$e(l(),Fe()),expectedOutput:$e(l(),Fe()),tags:x(Ke).max(100).default([])});v({id:Ke,prompt:l().min(1).max(5e5),chosen:l().min(1).max(5e5),rejected:l().min(1).max(5e5),sourceRefs:x(Ke).min(1).max(1e4)});v({id:Ke,input:$e(l(),Fe()),tags:x(Ke).max(100).default([])});const i3=v({schemaVersion:N("openpond.rftRecipe.v1"),method:N("grpo"),parameterization:N("lora"),baseModel:v({id:Ke,revision:l().trim().min(1).max(256),tokenizerRevision:l().trim().min(1).max(256),chatTemplateHash:Nt}),dataset:v({trainSplit:N("train"),validationSplit:I(["validation","frozen_eval"]),maxPromptTokens:S().int().positive().max(32768),maxExamples:S().int().positive().max(1e5).default(1e3),selectionStrategy:I(["stable_hash_top_n","rft_easy_curriculum_v1"]).default("stable_hash_top_n")}),lora:v({rank:S().int().positive().max(256)}),rollout:v({groupSize:S().int().min(2).max(64),concurrency:S().int().positive().max(32),maxTurns:S().int().positive().max(100),maxOutputTokens:S().int().positive().max(8192),temperature:S().min(0).max(2),topP:S().positive().max(1),seed:S().int()}),optimizer:v({learningRate:S().positive(),maxSteps:S().int().positive().max(1e5)}),loss:v({method:DC.default("grpo"),klBeta:S().min(0).nullable().default(null)}).default({method:"grpo",klBeta:null}),reward:v({graderId:Ke,graderHash:Nt,environmentId:Ke,environmentVersion:l().trim().min(1).max(256),toolContractHash:Nt}),resourceLimits:v({wallTimeMs:S().int().positive().max(1440*60*1e3),maxRollouts:S().int().positive().max(1e5),maxPayloadBytes:S().int().positive().max(10*1024*1024)}),policyOptimization:LC.nullable().default(null)}),r3=v({schemaVersion:N("openpond.dpoRecipe.v1"),method:N("dpo"),parameterization:N("lora"),policyModel:ed,referenceModel:ed,dataset:v({trainSplit:N("train"),validationSplit:I(["validation","frozen_eval"]),maxPairs:S().int().positive().max(1e5),maxPromptTokens:S().int().positive().max(32768),maxCompletionTokens:S().int().positive().max(32768),selectionStrategy:N("stable_hash_top_n"),selectionSeed:S().int()}),lora:v({rank:S().int().positive().max(256),alpha:S().positive().max(1024),dropout:S().min(0).max(1),targetModules:x(Ke).min(1).max(100)}),loss:v({variant:N("sigmoid"),beta:S().positive().max(10),labelSmoothing:S().min(0).max(.5).default(0)}),optimizer:v({learningRate:S().positive(),epochs:S().positive().max(100),maxSteps:S().int().positive().max(1e6),batchSize:S().int().positive().max(1e4),gradientAccumulationSteps:S().int().positive().max(1e4),seed:S().int()}),referenceLogprobs:v({cacheSchemaVersion:N("openpond.dpoReferenceLogprobs.v1"),cacheKey:Nt,invalidationHash:Nt}),resourceLimits:v({cpuThreads:S().int().positive().max(256),memoryBytes:S().int().positive(),wallTimeMs:S().int().positive()})}),s3=v({schemaVersion:N("openpond.ppoRecipe.v1"),method:N("ppo"),parameterization:N("lora"),policyOptimization:LC.extend({optimizer:UC}),lora:v({rank:S().int().positive().max(256),alpha:S().positive().max(1024),dropout:S().min(0).max(1),targetModules:x(Ke).min(1).max(100)}),valueHead:v({initialization:N("policy_hidden_state_linear"),optimizerLearningRate:S().positive(),artifactName:N("value_head.safetensors")}),policyLearningRate:S().positive(),resume:v({checkpointId:Ke.nullable(),policyHash:Nt,referenceHash:Nt,valueModelHash:Nt,optimizerStateHash:Nt.nullable()}),resourceLimits:v({cpuThreads:S().int().positive().max(256),memoryBytes:S().int().positive(),wallTimeMs:S().int().positive()})}),l3=v({schemaVersion:N("openpond.unsupportedRecipe.v1"),method:Us.exclude(["sft","dpo","grpo","ppo"]),parameterization:jf,unsupportedReason:l().trim().min(1).max(5e3)}),wb=Ua([o3,r3,i3,s3,l3]),c3=v({schemaVersion:N("openpond.trainingDestinationCapabilities.v1"),destinationId:Or,available:z(),methods:x(Us),parameterizations:x(jf),modelAllowlist:x(Ke).default([]),maxDatasetBytes:S().int().nonnegative().nullable(),environmentPlacements:x(I(["none","local","remote","colocated","provider_native"])),nonProduction:z(),unavailableReason:l().trim().min(1).max(5e3).nullable(),checkedAt:Vt}),u3=v({destinationId:Or,available:z(),methods:x(Us),parameterizations:x(jf),nonProduction:z(),unavailableReason:l().trim().min(1).max(5e3).nullable()}),d3=v({schemaVersion:N("openpond.baseModelCandidate.v1"),selectionKey:Ke,label:l().trim().min(1).max(500),sourceLabel:l().trim().min(1).max(500),preference:yd,available:z(),nonProduction:z(),unavailableReason:l().trim().min(1).max(5e3).nullable(),methods:x(Us),executionOptions:x(u3).min(1)}),m3=v({code:Ke,severity:I(["warning","error"]),path:l().trim().max(2e3).nullable(),message:l().trim().min(1).max(5e3)}),f3=v({schemaVersion:N("openpond.trainingCompatibility.v1"),compatible:z(),destinationId:Or,tasksetId:Ke,recipeMethod:Us,issues:x(m3),checkedAt:Vt}),p3=Ua([TC,I(["destination_unavailable","destination_method_unsupported","destination_model_unsupported","destination_parameterization_unsupported","experimental_destination"])]);v({method:Us,state:I(["recommended","compatible","needs_dataset_work","destination_unavailable","experimental_destination"]),reasonCodes:x(p3).default([]),reasons:x(l().trim().min(1).max(5e3)).default([]),destinationId:Or.nullable().default(null)});const h3=I(["small","standard","custom","small_experiment"]),g3=v({schemaVersion:N("openpond.modelProject.v1"),id:Ke,profileId:Ke,name:l().trim().min(1).max(200),objective:l().trim().max(5e3).nullable(),defaultBaseModel:yd.nullable(),defaultDestinationId:Or.nullable(),createdAt:Vt,updatedAt:Vt}),v3=v({schemaVersion:N("openpond.modelRunDraft.v1"),id:Ke,profileId:Ke,modelId:Ke,status:I(["draft","ready_to_run","launched","cancelled"]),title:l().trim().min(1).max(200),datasetMode:I(["existing","build"]).nullable(),tasksetRef:v({id:Ke,revision:S().int().positive(),contentHash:Nt}).nullable(),harnessRelease:Yt.nullable().optional(),tasksetRelease:Yt.nullable().optional(),datasetCreationId:Ke.nullable(),buildIntent:vb.nullable(),buildSpecification:bb.nullable(),baseModel:yd.nullable(),method:Us.nullable(),destinationId:Or.nullable(),managedRolloutPlacement:I(["local","remote"]).optional(),runPreset:h3.nullable(),recipe:wb.nullable(),createdAt:Vt,updatedAt:Vt}),VC=v({schemaVersion:N("openpond.trainingPlan.v1"),id:Ke,modelId:Ke,tasksetId:Ke,tasksetHash:Nt,harnessRelease:Yt.nullable().optional(),modelImprovementQualification:Yt.nullable().optional(),destinationId:Or,recipe:wb,environmentPlacement:I(["none","local","remote","colocated","provider_native"]),compatibility:f3,dataPolicy:v({exportApproved:z(),approvedSourceIds:x(Ke),retentionDays:S().int().nonnegative().nullable(),region:l().trim().min(1).max(200).nullable()}),estimatedCostUsd:S().nonnegative().nullable(),createdAt:Vt,contentHash:Nt}),b3=v({path:l().trim().min(1).max(2e3),sha256:Nt,sizeBytes:S().int().nonnegative(),role:I(["manifest","task_data","grader","environment","recipe","policy","provenance"])}),Cb=v({schemaVersion:N("openpond.trainingBundle.v1"),id:Ke,planId:Ke,tasksetId:Ke,tasksetHash:Nt,recipeHash:Nt,files:x(b3).min(1).max(1e6),totalSizeBytes:S().int().nonnegative(),sourceIds:x(Ke),excludedSourceIds:x(Ke),containsRawChats:N(!1),containsSecrets:N(!1),containsHiddenGraderAssets:N(!1),createdAt:Vt,contentHash:Nt});v({schemaVersion:N("openpond.trainingBundleExport.v1"),manifest:Cb,files:x(v({path:l().trim().min(1).max(2e3),sha256:Nt,sizeBytes:S().int().nonnegative(),encoding:N("base64"),content:l()})).min(1),contentHash:Nt});v({schemaVersion:N("openpond.trainingPreparedStart.v1"),plan:VC,bundle:Cb,approvalActor:Ke.nullable(),preparedAt:Vt});v({schemaVersion:N("openpond.trainingApproval.v1"),id:Ke,planId:Ke,bundleHash:Nt,harnessRelease:Yt.nullable().optional(),modelImprovementQualification:Yt.nullable().optional(),destinationId:Or,modelId:Ke,method:Us,parameterization:jf,maximumCostUsd:S().nonnegative().nullable(),approvedBy:Ke,approvedAt:Vt});const y3=I(["queued","starting","running","cancelling","cancelled","succeeded","failed","reconciling"]),FC=v({schemaVersion:N("openpond.trainingJob.v1"),id:Ke,planId:Ke,bundleHash:Nt,approvalId:Ke,destinationId:Or,status:y3,nonProduction:z(),workerPid:S().int().positive().nullable(),startedAt:Vt.nullable(),completedAt:Vt.nullable(),error:l().trim().min(1).max(2e4).nullable(),createdAt:Vt,updatedAt:Vt,metadata:Sd}),S3=v({schemaVersion:N("openpond.trainingJobEvent.v1"),id:Ke,jobId:Ke,sequence:S().int().nonnegative(),type:I(["queued","start","progress","metric","checkpoint","cancel","complete","failure","reconcile"]),timestamp:Vt,payload:Sd}),_3=v({schemaVersion:N("openpond.sftStepMetric.v1"),step:S().int().nonnegative(),maxSteps:S().int().positive(),timestamp:Vt,epoch:S().nonnegative().nullable(),loss:S().nullable(),learningRate:S().nonnegative().nullable(),gradientNorm:S().nonnegative().nullable(),entropy:S().nonnegative().nullable(),meanTokenAccuracy:S().min(0).max(1).nullable(),preferenceAccuracy:S().min(0).max(1).nullable().default(null),preferenceMargin:S().nullable().default(null),chosenReward:S().nullable().default(null),rejectedReward:S().nullable().default(null),chosenLogProbability:S().nullable().default(null),rejectedLogProbability:S().nullable().default(null),reward:S().nullable().default(null),policyLoss:S().nullable().default(null),advantageLoss:S().nullable().default(null),inputTokensSeen:S().int().nonnegative().nullable(),memoryBytes:S().int().nonnegative().nullable(),elapsedSeconds:S().nonnegative().nullable()}),x3=v({schemaVersion:N("openpond.policyOptimizationMetric.v1"),method:I(["grpo","ppo"]),step:S().int().nonnegative(),timestamp:Vt,learningRate:S().nonnegative().nullable().default(null),policyLoss:S().nullable(),valueLoss:S().nullable(),meanReward:S().nullable(),meanReturn:S().nullable(),kl:S().nullable(),entropy:S().nullable(),policyClipFraction:S().min(0).max(1).nullable(),valueClipFraction:S().min(0).max(1).nullable(),explainedVariance:S().nullable(),rolloutLearnerLag:S().int().nonnegative().nullable(),inputTokens:S().int().nonnegative(),outputTokens:S().int().nonnegative(),environmentExecutions:S().int().nonnegative(),costUsd:S().nonnegative().nullable()}),k3=v({schemaVersion:N("openpond.managedTrainingRunEvidence.v1"),provider:Ke,providerRunId:Ke,state:Ke,progress:v({targetOptimizerSteps:S().int().nonnegative(),committedOptimizerSteps:S().int().nonnegative()}),reward:v({finalMean:S().nullable(),trajectoryCount:S().int().nonnegative(),eligibleTrajectoryCount:S().int().nonnegative()}),usage:v({inputTokens:S().int().nonnegative(),outputTokens:S().int().nonnegative(),environmentExecutions:S().int().nonnegative()}),resource:v({provider:Ke,gpuType:l().trim().min(1).max(300).nullable(),gpuCount:S().int().nonnegative().nullable(),hourlyCostUsd:S().nonnegative().nullable()}),cost:v({totalUsd:S().nonnegative().nullable()}),checkpoint:v({id:Ke,policyVersion:S().int().nonnegative(),sha256:Nt.nullable(),sizeBytes:S().int().nonnegative().nullable()}).nullable(),evaluations:x(v({kind:I(["baseline","candidate"]),policyVersion:S().int().nonnegative(),score:S().nullable(),threshold:S().nullable(),passed:z().nullable()})),canonicalPublication:v({state:Ke.nullable(),artifactId:Ke.nullable()}),syncedAt:Vt}),y_=v({count:S().int().nonnegative(),scoredCount:S().int().nonnegative(),meanScore:S().min(0).max(1).nullable(),passedCount:S().int().nonnegative(),passRate:S().min(0).max(1).nullable()}),S_=v({status:I(["scored","unavailable"]),score:S().min(0).max(1).nullable(),passed:z(),rewardEligible:z(),failureClass:I(["policy_failure","grader_failure","environment_failure","infrastructure_failure","timeout","cancelled"]).nullable(),feedback:x(l().trim().min(1).max(2e4)).max(1e3),components:x(v({graderId:Ke,score:S().min(0).max(1),passed:z(),feedback:l().trim().max(2e4).nullable()})).max(1e3)}),w3=v({taskId:Ke,input:$e(l(),Fe()),baseOutput:$e(l(),Fe()).nullable(),trainedOutput:$e(l(),Fe()).nullable(),baseGrade:S_.nullable(),trainedGrade:S_.nullable()}),C3=v({schemaVersion:N("openpond.trainingEvaluationSummary.v1"),jobId:Ke,tasksetId:Ke,base:y_,trained:y_,meanScoreDelta:S().min(-1).max(1).nullable(),examples:x(w3).max(1e6)});v({schemaVersion:N("openpond.trainingRunDetail.v1"),job:FC,events:x(S3),stepMetrics:x(_3),policyMetrics:x(x3).default([]),managedEvidence:k3.nullable().default(null),evaluation:C3.nullable(),generatedAt:Vt});const I3=v({schemaVersion:N("openpond.trainingArtifact.v1"),id:Ke,jobId:Ke,kind:I(["adapter","checkpoint","metrics","log","manifest","evaluation"]),path:l().trim().min(1).max(4e3),sha256:Nt,sizeBytes:S().int().nonnegative(),baseModelId:Ke.nullable(),baseModelRevision:l().trim().min(1).max(256).nullable(),tokenizerRevision:l().trim().min(1).max(256).nullable(),chatTemplateHash:Nt.nullable(),nonProduction:z(),createdAt:Vt,metadata:Sd}),A3=v({schemaVersion:N("openpond.modelArtifactLineage.v1"),id:Ke,modelId:Ke,artifactId:Ke,jobId:Ke,tasksetId:Ke,tasksetHash:Nt,graderHash:Nt,planHash:Nt,bundleHash:Nt,recipeHash:Nt,workerVersion:l().trim().min(1).max(256),trainerVersion:l().trim().min(1).max(256),importedAt:Vt,frozenEvaluationArtifactId:Ke.nullable(),promotable:z(),pinned:z().default(!1),status:I(["imported","rejected"]).default("imported"),rejectedAt:Vt.nullable().default(null),rejectionReason:l().trim().min(1).max(5e3).nullable().default(null),chatConfiguration:HC.default(z4),managedServing:D4.nullable().default(null)}),R3=I(["chat_manual","agent","extension","authoring_optimizer"]),T3=v({schemaVersion:N("openpond.modelBinding.v1"),id:Ke,profileId:Ke,role:R3,roleTargetId:Ke,modelArtifactLineageId:Ke,tasksetId:Ke,evaluationArtifactId:Ke.nullable(),status:I(["active","rolled_back"]),priorBindingId:Ke.nullable(),rollbackTargetBindingId:Ke.nullable(),promotedBy:Ke,promotedAt:Vt,rolledBackAt:Vt.nullable(),metadata:Sd});v({schemaVersion:N("openpond.trainingActivity.v1"),profileId:Ke,active:z(),activeCounts:v({jobs:S().int().nonnegative(),creations:S().int().nonnegative(),minerRuns:S().int().nonnegative(),datasetImports:S().int().nonnegative()}),revision:Nt,generatedAt:Vt});v({schemaVersion:N("openpond.trainingState.v1"),profileId:Ke,sources:x(vC),creations:x(PC),tasksets:x(h_),benchmarkRuns:x(Dh()).default([]),benchmarkComparisons:x(Dh()).default([]),datasetImports:x(S4).default([]),datasetArtifacts:x(SU).default([]),graderAuditReports:x(o4),evaluationResults:x(Dh()).default([]),candidates:x(fC),minerConfig:Mf,minerRuns:x(gU).default([]),modelProjects:x(g3).default([]),modelRunDrafts:x(v3).default([]),modelVersions:x(C4).default([]),modelRuns:x(P4).default([]),modelTasksets:x(h_).default([]),plans:x(VC),bundles:x(Cb),jobs:x(FC),artifacts:x(I3),models:x(A3),rolloutReceipts:x(a3).default([]),modelBindings:x(T3).default([]),destinations:x(c3),baseModelCandidates:x(d3).default([]),activityRevision:Nt.optional(),generatedAt:Vt});const E3=I(["trajectory","reward","demonstration","preference","correction","critique","targeted_feedback","grader_evidence","infrastructure_failure"]),M3=v({datasetRelease:Yt,harnessRelease:Yt,evidenceSetRelease:Yt.nullable(),profileRelease:Yt.nullable(),model:v({source:l().trim().min(1).max(200),revision:l().trim().min(1).max(500),artifactHash:ft.nullable()}).strict(),environmentHash:ft,graderHash:ft,toolContractHash:ft,verificationReceiptHash:ft.nullable()}).strict(),jr=v({schemaVersion:N("openpond.learningSignal.v1"),id:rt,taskId:rt.nullable(),episodeId:rt.nullable(),policyVersion:S().int().nonnegative().nullable(),lineage:M3,approved:z(),verifier:I(["deterministic","model_judge","human","none"]),createdAt:Wn,contentHash:ft,metadata:$e(l(),Fe()).default({})}).strict(),P3=v({schemaVersion:N("openpond.optimizerTrainingSample.v1"),tokenIds:x(S().int().nonnegative()).min(2).max(32768),mask:x(z()).min(2).max(32768),logprobs:x(S().finite()).min(2).max(32768),temperatures:x(S().positive().finite()).min(2).max(32768),envName:l().trim().min(1).max(200),modelRequestId:l().trim().min(1).max(1e3),promptTokenCount:S().int().positive(),completionTokenCount:S().int().positive(),servedPolicyVersion:S().int().nonnegative()}).strict().superRefine((e,t)=>{const a=e.tokenIds.length;for(const[i,s]of[["mask",e.mask],["logprobs",e.logprobs],["temperatures",e.temperatures]])s.length!==a&&t.addIssue({code:"custom",path:[i],message:`${i} must align with tokenIds`});e.promptTokenCount+e.completionTokenCount!==a&&t.addIssue({code:"custom",path:["completionTokenCount"],message:"prompt and completion token counts must span tokenIds"}),e.mask.filter(i=>!i).length!==e.promptTokenCount&&t.addIssue({code:"custom",path:["mask"],message:"promptTokenCount must equal the non-trainable mask count"}),e.mask.filter(i=>i).length!==e.completionTokenCount&&t.addIssue({code:"custom",path:["mask"],message:"completionTokenCount must equal the trainable mask count"})}),O3=jr.extend({kind:N("trajectory"),payload:v({traceRef:l().trim().min(1).max(2e3),traceHash:ft,terminal:z(),failureClass:I(["policy_failure","grader_failure","environment_failure","infrastructure_failure","timeout","cancelled"]).nullable(),optimizerSample:P3.nullable().optional()}).strict()}).strict(),j3=jr.extend({kind:N("reward"),payload:v({reward:S().finite(),components:$e(l(),S().finite()),eligible:z(),graderEvidenceRefs:x(rt).max(1e3)}).strict()}).strict(),N3=jr.extend({kind:N("demonstration"),payload:v({prompt:l().max(5e5),response:l().max(1e6)}).strict()}).strict(),z3=jr.extend({kind:N("preference"),payload:v({prompt:l().max(5e5),chosen:l().max(1e6),rejected:l().max(1e6),rationale:l().max(5e5).nullable()}).strict()}).strict(),D3=jr.extend({kind:N("correction"),payload:v({original:l().max(1e6),corrected:l().max(1e6),rationale:l().max(5e5).nullable()}).strict()}).strict(),U3=jr.extend({kind:N("critique"),payload:v({response:l().max(1e6),critique:l().max(5e5),severity:I(["note","warning","error"])}).strict()}).strict(),L3=jr.extend({kind:N("targeted_feedback"),payload:v({turnIndex:S().int().nonnegative(),target:I(["reasoning","tool","answer","policy"]),feedback:l().max(5e5)}).strict()}).strict(),H3=jr.extend({kind:N("grader_evidence"),payload:v({graderId:rt,score:S().finite().nullable(),passed:z(),privilegedArtifactRefs:x(l().trim().min(1).max(2e3))}).strict()}).strict(),$3=jr.extend({kind:N("infrastructure_failure"),approved:N(!1),verifier:N("none"),payload:v({code:rt,phase:rt,retryable:z(),rewardEligible:N(!1)}).strict()}).strict(),KC=Ja("kind",[O3,j3,N3,z3,D3,U3,L3,H3,$3]);v({schemaVersion:N("openpond.learningSignalBatch.v1"),manifestId:rt,manifestHash:ft,sequence:S().int().nonnegative(),signals:x(KC).min(1).max(1e5),contentHash:ft}).strict();const Ib=v({adapterId:rt,placement:I(["local","remote","colocated","provider_native"]),capabilityReceipt:ft,runtimeVersion:l().trim().min(1).max(200),dataPlane:v({provider:rt,dataPlaneId:rt,cellId:rt,runnerPoolId:rt,runtimeImageDigest:l().regex(/^sha256:[a-f0-9]{64}$/),capabilityReceipt:ft}).strict().nullable()}).strict(),Ab=v({adapterId:rt,kind:I(["local","ssh","managed","custom"]),deviceOrPool:l().trim().min(1).max(1e3),capabilityReceipt:ft,provider:rt.nullable()}).strict(),Rb=v({adapterId:rt,workerVersion:l().trim().min(1).max(200),workerImageDigest:l().regex(/^sha256:[a-f0-9]{64}$/).nullable(),upstreamRevision:l().trim().min(1).max(500),capabilityReceipt:ft}).strict(),q3=v({schemaVersion:N("openpond.harnessRunManifest.v1"),id:rt,harnessRelease:Yt,datasetRelease:Yt,evidenceSets:x(Yt).max(1e4),model:v({source:l().trim().min(1).max(200),revision:l().trim().min(1).max(500),artifactHash:ft.nullable(),tokenizerRevision:l().trim().min(1).max(500),chatTemplateHash:ft}).strict(),recipe:v({method:l().trim().min(1).max(100),version:l().trim().min(1).max(200),configHash:ft}).strict(),runtimeTarget:Ib,computeTarget:Ab,engine:Rb,resolvedBundleHash:ft,secretLeaseRefs:x(OU).max(1e3),approval:v({approvalHash:ft,approvedAt:Wn,maximumSpendUsd:S().nonnegative().nullable()}).strict(),createdAt:Wn}).strict(),B3=q3.extend({contentHash:ft}).strict(),V3=v({schemaVersion:N("openpond.resolvedTrainingBundle.v1"),projection:N("trainer"),harnessRelease:Yt,datasetRelease:Yt,evidenceSetRelease:Yt.nullable(),files:x(v({path:l().trim().min(1).max(2e3),sha256:ft,sizeBytes:S().int().nonnegative()}).strict()).max(1e5)}).strict();V3.extend({contentHash:ft}).strict();const F3=v({id:rt,turn:S().int().nonnegative(),kind:I(["message","tool_call","terminal"]),name:rt.nullable(),arguments:$e(l(),Fe()),content:l().max(1e6).nullable(),contentHash:ft}).strict(),K3=v({actionId:rt,turn:S().int().nonnegative(),terminal:z(),output:$e(l(),Fe()),artifactRefs:x(l().trim().min(1).max(2e3)),contentHash:ft}).strict(),G3=v({sequence:S().int().nonnegative(),type:I(["created","reset","action","observation","terminal","graded","feedback","failure","collected","destroyed"]),timestamp:Wn,payloadHash:ft,metadata:$e(l(),Fe()).default({})}).strict(),__=v({graderId:rt,graderVersion:l().trim().min(1).max(200),score:S().finite().nullable(),passed:z(),rewardEligible:z(),failureClass:I(["policy_failure","grader_failure","environment_failure","infrastructure_failure","timeout","cancelled"]).nullable(),feedback:x(l().max(5e5)),visibleEvidenceRefs:x(l().trim().min(1).max(2e3)),privilegedEvidenceRefs:x(l().trim().min(1).max(2e3)),contentHash:ft}).strict();v({schemaVersion:N("openpond.harnessRunTrace.v1"),manifest:Yt,taskId:rt,seed:l().trim().min(1).max(500),events:x(G3).max(1e6),actions:x(F3).max(1e5),observations:x(K3).max(1e5),graderEvidence:x(__).max(1e4),learningSignals:x(KC).max(1e5),terminal:z(),failureClass:__.shape.failureClass,artifactHash:ft,contentHash:ft}).strict();const Os=l().trim().min(1).max(1e5),Z3=I(["no_action","harness_maintenance","runtime","product","taskset","model_improvement"]),W3=I(["none","runtime_service","product_team","human_review","evaluation_system","training_system"]),GC=I(["observation","trigger","route_decision","refiner_outcome","proposal","validation","apply_receipt","harness_advance","rollback","work_outcome","taskset","evaluation","training_qualification","model_candidate"]),Y3=v({kind:I(["personal","team"]),id:it}).strict(),Tb=v({policy:ht,state:I(["authorized","revoked","deleted","expired"]),checkedAt:tn}).strict(),J3=v({evidence:ht,kind:GC,sourceRef:it,sourcePolicy:Tb,occurrenceKey:mt,occurredAt:tn}).strict(),X3=v({evidence:ht,sourcePolicy:Tb.nullable(),reason:I(["outside_scope","before_watermark","duplicate","resolved","revoked","deleted","expired","sensitive","unverified","budget"])}).strict(),x_=v({cursor:mt,throughCreatedAt:tn}).strict(),Q3=v({fingerprint:mt,recurrenceFamily:l().trim().min(1).max(1e3),statement:Os,independentOccurrences:S().int().positive().max(1e6),unresolvedOccurrences:S().int().positive().max(1e6)}).strict().refine(e=>e.unresolvedOccurrences<=e.independentOccurrences,"unresolved occurrences cannot exceed independent occurrences"),ZC=I(["harness","runtime","product","retrieval","tools","evaluation","model"]),eL=v({layer:ZC,status:I(["not_applicable","unresolved","resolved","blocked"]),reason:Os,evidenceRefs:x(ht).max(1e3)}).strict(),WC=v({schemaVersion:N("openpond.harnessEvaluationReviewReceipt.v1"),id:it,ownerScope:Y3,workspaceRef:it,harnessRelease:ht,previousWatermark:x_.nullable(),nextWatermark:x_,selectedEvidence:x(J3).max(1e4),excludedEvidence:x(X3).max(1e4),claim:Q3.nullable(),classification:Z3,triage:x(eL).max(16),reason:Os,nextAuthority:W3,maxEstimatedCostUsd:S().finite().nonnegative(),tasksetProposal:ht.nullable(),evaluation:ht.nullable(),trainingQualification:ht.nullable(),policyVersion:it,createdAt:tn,metadata:ko}).strict().superRefine((e,t)=>{const a=e.selectedEvidence.map(i=>`${i.evidence.id}:${i.evidence.contentHash}`);new Set(a).size!==a.length&&t.addIssue({code:"custom",message:"selected review evidence must be unique",path:["selectedEvidence"]}),e.selectedEvidence.some(i=>i.sourcePolicy.state!=="authorized")&&t.addIssue({code:"custom",message:"selected review evidence must be authorized at review time",path:["selectedEvidence"]}),e.classification==="no_action"?(e.nextAuthority!=="none"&&t.addIssue({code:"custom",message:"no-action review receipts require no next authority",path:["nextAuthority"]}),(e.tasksetProposal||e.evaluation||e.trainingQualification)&&t.addIssue({code:"custom",message:"no-action review receipts cannot carry downstream refs"})):(!e.claim||e.selectedEvidence.length===0)&&t.addIssue({code:"custom",message:"actionable review receipts require a claim and selected evidence"}),e.classification==="runtime"&&e.nextAuthority!=="runtime_service"&&t.addIssue({code:"custom",message:"runtime classifications route to runtime-service authority",path:["nextAuthority"]}),e.classification==="product"&&e.nextAuthority!=="product_team"&&t.addIssue({code:"custom",message:"product classifications route to product-team authority",path:["nextAuthority"]}),e.classification==="taskset"&&e.nextAuthority!=="human_review"&&t.addIssue({code:"custom",message:"Taskset classifications require human review"}),e.classification==="model_improvement"&&(!e.evaluation||!e.trainingQualification||!["human_review","training_system"].includes(e.nextAuthority))&&t.addIssue({code:"custom",message:"model-improvement classifications require Evaluation and qualification refs plus explicit authority"})}),tL=WC.extend({contentHash:mt}).strict();function xd(e){const t=WC.parse(e);return tL.parse({...t,contentHash:Kt(t)})}v({id:it,evidence:ht,kind:GC,sourceRef:it,occurredAt:tn,payload:$e(l(),Fe())}).strict();const nL=v({schemaVersion:N("openpond.harnessEvaluationReviewModelDecision.v1"),decision:N("no_action"),reason:Os,ignoredEvidence:x(v({id:it,reason:l().trim().min(1).max(2e3)}).strict()).max(1e3)}).strict(),aL=v({schemaVersion:N("openpond.harnessEvaluationReviewModelDecision.v1"),decision:N("review"),classification:I(["harness_maintenance","runtime","product","taskset"]),selectedEvidenceIds:x(it).min(1).max(1e3),ignoredEvidence:x(v({id:it,reason:l().trim().min(1).max(2e3)}).strict()).max(1e3),recurrenceFamily:l().trim().min(1).max(1e3),statement:Os,triageLayer:ZC,expectedOutcome:Os,counterevidence:l().trim().max(1e4),confidence:S().min(0).max(1),reason:Os}).strict();Ja("decision",[nL,aL]);v({schemaVersion:N("openpond.harnessEvaluationReviewNavigationDecision.v1"),selectedEvidenceIds:x(it).min(1).max(50),reason:Os}).strict();const Nf=v({name:l().trim().min(1).max(64).regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/),description:l().trim().min(1).max(2e3),inputSchema:$e(l(),Fe()),inputSchemaHash:mt,sideEffect:I(["read","write"]),timeoutMs:S().int().positive().max(36e5)}).strict(),Eb=v({id:it,required:z(),scopes:x(l().trim().min(1).max(500)).max(100).default([]),portability:I(["portable","host_adapter","local_only","hosted_only"])}).strict(),oL=v({portable:z(),blockers:x(l().trim().min(1).max(2e3)).max(1e3),localOnlyAssetRefs:x(it).max(1e4),hostPrivateAssetRefs:x(it).max(1e4)}).strict(),iL=v({schemaVersion:N("openpond.agentSnapshot.v2"),id:it,sourceRelease:ht.nullable(),instructions:x(Vi).max(1e4),skills:x(Vi).max(1e4),agents:x(Vi).max(1e4),toolDeclarations:x(Nf).max(200),capabilityRequirements:x(Eb).max(200),dependencyLock:Vi,portability:oL,metadata:ko}).strict();iL.extend({contentHash:mt}).strict();const YC=v({create:N(!0),reset:N(!0),step:N(!0),collect:N(!0),destroy:N(!0),resetScope:I(["task","attempt"])}).strict(),JC=v({visibleEvidence:x(it).max(1e3),privilegedEvidence:x(it).max(1e3),privateVerifierIsolation:z()}).strict(),rL=v({schemaVersion:N("openpond.harnessRelease.v2"),id:it,agentSnapshot:ht,program:Vi,tools:x(Nf).max(200),lifecycle:YC,graderInterface:JC,files:x(Vi).max(1e5),metadata:ko}).strict();rL.extend({contentHash:mt}).strict();const sL=v({id:it,turn:S().int().nonnegative(),kind:I(["message","tool_call","terminal"]),name:it.nullable(),arguments:$e(l(),Fe()),content:l().max(1e6).nullable()}).strict(),lL=v({actionId:it,turn:S().int().nonnegative(),terminal:z(),output:$e(l(),Fe()),artifactRefs:x(nf).max(1e5)}).strict(),cL=v({sequence:S().int().nonnegative(),type:I(["created","reset","action","observation","terminal","failure","collected","destroyed"]),payloadHash:mt,metadata:ko}).strict();v({schemaVersion:N("openpond.harnessTrace.v1"),manifest:ht,taskId:it,seed:l().trim().min(1).max(500),events:x(cL).max(1e6),actions:x(sL).max(1e5),observations:x(lL).max(1e5),terminal:z(),failureClass:Tf.nullable(),output:$e(l(),Fe()),contentHash:mt}).strict();const zf=l().trim().min(1).max(1e5),kd=$e(l(),Fe()).default({}),uL=I(["completed_tool_batch","before_model_step","turn_completed","turn_paused"]),XC=v({kind:uL,eventSequence:S().int().nonnegative(),occurredAt:tn}).strict(),QC=v({id:it,sequence:S().int().nonnegative().nullable(),contentHash:mt}).strict(),dL=I(["tool_failure","retry","recovery","validation","user_turn","reusable_success","completion_detour"]),mL=I(["open","recovered","terminal"]),fL=v({name:l().trim().min(1).max(500),invocationKey:mt}).strict(),pL=v({schemaVersion:N("openpond.improvementObservation.v1"),id:it,runRef:it,turnId:it,harnessRelease:ht,overlay:Tr.nullable(),eventRefs:x(QC).min(1).max(100),kind:dL,state:mL,tool:fL.nullable(),deterministicClass:l().trim().min(1).max(500).nullable(),summary:zf,createdAt:tn,metadata:kd}).strict().superRefine((e,t)=>{new Set(e.eventRefs.map(a=>a.id)).size!==e.eventRefs.length&&t.addIssue({code:"custom",message:"observation event refs must be unique",path:["eventRefs"]}),["tool_failure","retry","recovery","completion_detour"].includes(e.kind)&&e.tool===null&&t.addIssue({code:"custom",message:`${e.kind} observations require a tool identity`,path:["tool"]})});pL.extend({contentHash:mt}).strict();const hL=v({schemaVersion:N("openpond.refinementTriggerPolicy.v1"),maxEstimatedCostUsd:S().finite().nonnegative(),cooldownMs:S().int().nonnegative(),maxPendingPlans:S().int().min(1).max(100),maxEvidenceEvents:S().int().min(1).max(1e3),maxProposalEdits:S().int().min(1).max(1e3),maxProposalBytes:S().int().min(1).max(1e7)}).strict(),gL=I(["no_action","route_deterministically","queue_refiner"]),vL=v({schemaVersion:N("openpond.refinementTriggerDecision.v1"),id:it,runRef:it,turnId:it,harnessRelease:ht,overlay:Tr.nullable(),observations:x(ht).max(100),decision:gL,deterministicRoute:Qu.nullable(),suggestedRoutes:x(Qu).max(8),reason:zf,deduplicationKey:mt,policy:hL,estimatedMaxCostUsd:S().finite().nonnegative(),pendingPlanCount:S().int().nonnegative(),boundary:XC,cooldownUntil:tn.nullable(),createdAt:tn,metadata:kd}).strict().superRefine((e,t)=>{e.estimatedMaxCostUsd>e.policy.maxEstimatedCostUsd&&t.addIssue({code:"custom",message:"estimated Refiner cost exceeds the trigger policy budget",path:["estimatedMaxCostUsd"]}),e.pendingPlanCount>e.policy.maxPendingPlans&&t.addIssue({code:"custom",message:"pending plan count exceeds the trigger policy limit",path:["pendingPlanCount"]}),e.observations.length>e.policy.maxEvidenceEvents&&t.addIssue({code:"custom",message:"trigger observations exceed the evidence budget",path:["observations"]}),e.decision==="route_deterministically"&&e.deterministicRoute===null&&t.addIssue({code:"custom",message:"deterministic decisions require a route",path:["deterministicRoute"]}),e.decision!=="route_deterministically"&&e.deterministicRoute!==null&&t.addIssue({code:"custom",message:"only deterministic decisions may declare a deterministic route",path:["deterministicRoute"]}),e.decision==="no_action"&&e.suggestedRoutes.length>0&&t.addIssue({code:"custom",message:"no-action decisions cannot suggest routes",path:["suggestedRoutes"]}),e.decision!=="no_action"&&e.observations.length===0&&t.addIssue({code:"custom",message:"actionable trigger decisions require observations",path:["observations"]})});vL.extend({contentHash:mt}).strict();const bL=I(["runtime_service","refiner_model","human_review","evaluation_system","training_system"]),yL=v({schemaVersion:N("openpond.improvementRouteDecision.v1"),id:it,trigger:ht,route:Qu,authority:bL,automatic:z(),reason:zf,createdAt:tn,metadata:kd}).strict().superRefine((e,t)=>{e.automatic&&["human_review","evaluation_system","training_system"].includes(e.authority)&&t.addIssue({code:"custom",message:`${e.authority} routes cannot be marked automatic`,path:["automatic"]}),e.route==="training"&&e.automatic&&e.authority!=="training_system"&&t.addIssue({code:"custom",message:"automatic training routes require training-system authority",path:["authority"]})});yL.extend({contentHash:mt}).strict();const SL=v({schemaVersion:N("openpond.harnessRefinerOutcome.v1"),id:it,trigger:ht,decision:I(["no_action","proposed"]),proposal:ht.nullable(),reason:zf,evidenceRefs:x(ht).max(100),estimatedCostUsd:S().finite().nonnegative(),createdAt:tn,metadata:kd}).strict().superRefine((e,t)=>{e.decision==="proposed"!=(e.proposal!==null)&&t.addIssue({code:"custom",message:"proposed Refiner outcomes require a proposal; no-action outcomes cannot include one",path:["proposal"]})});SL.extend({contentHash:mt}).strict();const _L=I(["applied","retained","declined","conflict","rolled_back"]),xL=v({schemaVersion:N("openpond.improvementApplyReceipt.v1"),id:it,proposal:ht,beforeOverlay:Tr,afterOverlay:Tr.nullable(),decision:_L,boundary:XC,validationRefs:x(ht).max(100),outcomeEvidenceRefs:x(QC).max(1e3),rollbackOf:ht.nullable(),createdAt:tn,metadata:kd}).strict().superRefine((e,t)=>{e.decision==="applied"!=(e.afterOverlay!==null)&&t.addIssue({code:"custom",message:"applied receipts require an after-overlay; other decisions cannot include one",path:["afterOverlay"]}),e.decision==="rolled_back"!=(e.rollbackOf!==null)&&t.addIssue({code:"custom",message:"only rollback receipts require rollbackOf",path:["rollbackOf"]})});xL.extend({contentHash:mt}).strict();const Yc=v({provider:it,model:it,revision:l().trim().min(1).max(500).nullable().default(null),artifactHash:mt.nullable().default(null),tokenizerRevision:l().trim().min(1).max(500).nullable().default(null),chatTemplateHash:mt.nullable().default(null)}).strict(),kL=v({schemaVersion:N("openpond.localHarnessRefinerDecision.v1"),decision:N("no_action"),reason:l().trim().min(1).max(1e4)}).strip(),wL=v({schemaVersion:N("openpond.localHarnessRefinerDecision.v1"),decision:N("route"),route:I(["runtime","product","taskset","training"]),summary:l().trim().min(1).max(2e3),expectedOutcome:l().trim().min(1).max(1e4),reason:l().trim().min(1).max(1e4)}).strip(),CL=v({schemaVersion:N("openpond.localHarnessRefinerDecision.v1"),decision:N("propose"),route:I(["memory","prompt","skill","agent"]),operation:I(["create","update","delete"]),target:l().trim().min(1).max(2e3),summary:l().trim().min(1).max(2e3),createContent:l().min(1).max(2e4).nullable(),find:l().min(1).max(8e3).nullable(),replace:l().max(8e3).nullable(),expectedOutcome:l().trim().min(1).max(1e4),reason:l().trim().min(1).max(1e4)}).strip().superRefine((e,t)=>{e.operation==="create"&&(e.createContent===null||e.find!==null||e.replace!==null)&&t.addIssue({code:"custom",message:"create proposals require createContent and null find/replace",path:["createContent"]}),e.operation==="update"&&(e.createContent!==null||e.find===null||e.replace===null)&&t.addIssue({code:"custom",message:"update proposals require one exact find/replace edit and null createContent",path:["find"]}),e.operation==="delete"&&(e.createContent!==null||e.find!==null||e.replace!==null)&&t.addIssue({code:"custom",message:"delete proposals require null createContent/find/replace",path:["createContent"]})}),IL=Ja("decision",[kL,wL,CL]),k_=I(["memory","instruction","skill","agent"]),AL=v({trigger:$e(l(),Fe()),observations:x($e(l(),Fe())).max(20),task:v({prompt:l().max(8100).nullable(),assistantOutput:l().max(8100).nullable(),assistantOutputLinkCount:S().int().nonnegative(),previousAssistantOutput:l().max(8100).nullable()}).strict(),eventExcerpts:x($e(l(),Fe())).max(20),artifactDiagnostics:x($e(l(),Fe())).max(20),recentOutcomes:x(v({id:l().trim().min(1).max(2e3),decision:I(["no_action","proposed"]),reason:l().trim().min(1).max(1e4),createdAt:l().trim().min(1).max(100),triggerId:l().trim().min(1).max(2e3)}).strict()).max(8),sourceFiles:x(v({path:l().trim().min(1).max(2e3),kind:k_,content:l().max(6e4),loaded:z()}).strict()).max(100),sourceCatalog:x(v({path:l().trim().min(1).max(2e3),kind:k_,loaded:z()}).strict()).max(1e3),additionalEvidence:Fe().nullable().optional()}).strict(),RL=v({id:l().trim().min(1).max(240),revision:S().int().nonnegative(),contentHash:mt}).strict();v({schemaVersion:N("openpond.hostedHarnessRefinerRequest.v1"),requestId:l().trim().min(1).max(240),idempotencyKey:l().trim().min(1).max(240),evidenceHash:mt,harness:v({admittedRelease:ht,currentRelease:ht,overlay:RL,workspace:v({id:l().trim().min(1).max(240),revision:S().int().nonnegative(),sourceRevision:mt,channelRevision:S().int().nonnegative()}).strict(),capabilities:v({memory:z(),prompt:z(),skill:z(),agent:z()}).strict()}).strict(),evidence:AL}).strict();const TL=v({promptTokens:S().int().nonnegative(),completionTokens:S().int().nonnegative(),totalTokens:S().int().nonnegative()}).strict();v({schemaVersion:N("openpond.hostedHarnessRefinerResponse.v1"),requestId:l().trim().min(1).max(240),evidenceHash:mt,admittedRelease:ht,currentRelease:ht,decision:IL,serviceRevision:l().trim().min(1).max(240),usage:TL}).strict();const EL=l().trim().min(1).max(2e3).refine(e=>{const t=e.replaceAll("\\","/");return!t.startsWith("/")&&!t.includes("\0")&&!t.split("/").some(a=>!a||a==="."||a==="..")},"path must be a safe relative path"),ML=I(["instruction","skill","skill_resource","agent","dependency_lock","program","asset"]),PL=v({id:rt,kind:ML,path:EL,parentId:rt.nullable(),mediaType:l().trim().min(1).max(200),visibility:I(["policy","verifier","host_private"]),portability:I(["portable","local_only"])}).strict().superRefine((e,t)=>{e.kind==="skill_resource"!=(e.parentId!==null)&&t.addIssue({code:"custom",message:"only Skill resources require parentId",path:["parentId"]})});v({schemaVersion:N("openpond.harnessSourceManifest.v1"),name:l().trim().min(1).max(240),files:x(PL).min(2).max(1e5),toolDeclarations:x(Nf).max(200),capabilityRequirements:x(Eb).max(200),lifecycle:YC,graderInterface:JC,runtimeProtocol:l().trim().min(1).max(500),metadata:$e(l(),Fe()).default({})}).strict().superRefine((e,t)=>{const a=new Set,i=new Map,s=new Set;for(const[u,d]of e.files.entries())a.has(d.id)&&t.addIssue({code:"custom",message:"file ids must be unique",path:["files",u,"id"]}),s.has(d.path)&&t.addIssue({code:"custom",message:"file paths must be unique",path:["files",u,"path"]}),a.add(d.id),i.set(d.id,d.kind),s.add(d.path);for(const[u,d]of e.files.entries())d.parentId&&!a.has(d.parentId)?t.addIssue({code:"custom",message:"parentId must reference a declared Skill",path:["files",u,"parentId"]}):d.parentId&&i.get(d.parentId)!=="skill"&&t.addIssue({code:"custom",message:"parentId must reference a primary Skill file",path:["files",u,"parentId"]});e.files.filter(u=>u.kind==="dependency_lock").length!==1&&t.addIssue({code:"custom",message:"exactly one dependency lock is required",path:["files"]}),e.files.filter(u=>u.kind==="program").length!==1&&t.addIssue({code:"custom",message:"exactly one Harness program is required",path:["files"]})});const OL=v({schemaVersion:N("openpond.trainingEngineCapabilities.v1"),adapterId:rt,available:z(),methods:x(l().trim().min(1).max(100)),signalKinds:x(E3),modelFamilies:x(l().trim().min(1).max(200)),precisions:x(I(["fp32","fp16","bf16","tf32","int8","int4"])),topologies:x(l().trim().min(1).max(200)),workerProtocolVersion:l().trim().min(1).max(200),upstreamRevision:l().trim().min(1).max(500),workerImageDigest:l().regex(/^sha256:[a-f0-9]{64}$/).nullable().default(null),capabilityReceipt:ft,checkedAt:Wn,unavailableReason:l().trim().min(1).max(5e3).nullable()}).strict(),jL=v({schemaVersion:N("openpond.computeTargetCapabilities.v1"),adapterId:rt,kind:I(["local","ssh","managed","custom"]),provider:rt.nullable(),available:z(),devices:x(v({id:rt,kind:I(["cpu","gpu","accelerator"]),vendor:l().trim().min(1).max(200),name:l().trim().min(1).max(500),memoryBytes:S().int().nonnegative().nullable(),runtime:l().trim().min(1).max(200)}).strict()),supportsWorkerImages:z(),supportsArtifactTransfer:z(),supportsCancellation:z(),capabilityReceipt:ft,checkedAt:Wn,unavailableReason:l().trim().min(1).max(5e3).nullable()}).strict(),NL=v({schemaVersion:N("openpond.harnessRuntimeCapabilities.v1"),adapterId:rt,available:z(),placements:x(I(["local","remote","colocated","provider_native"])),lifecycle:x(I(["create","reset","step","grade","collect","destroy"])),deterministicReplay:z(),privilegedIsolation:z(),capabilityReceipt:ft,checkedAt:Wn,unavailableReason:l().trim().min(1).max(5e3).nullable()}).strict();v({schemaVersion:N("openpond.resolvedTrainingPlan.v1"),manifest:B3,recipe:wb,runtime:Ib,compute:Ab,engine:Rb,execution:v({trainingPlanId:rt,approvalId:rt}).strict().nullable(),maximumSpendUsd:S().nonnegative().nullable(),approvalHash:ft,contentHash:ft}).strict().superRefine((e,t)=>{const a=[["runtime",e.runtime,e.manifest.runtimeTarget],["compute",e.compute,e.manifest.computeTarget],["engine",e.engine,e.manifest.engine]];for(const[i,s,u]of a)JSON.stringify(s)!==JSON.stringify(u)&&t.addIssue({code:"custom",path:[i],message:`${i} must exactly match the Harness Run Manifest`});e.recipe.method!==e.manifest.recipe.method&&t.addIssue({code:"custom",path:["recipe","method"],message:"Recipe method must match the Harness Run Manifest"}),e.approvalHash!==e.manifest.approval.approvalHash&&t.addIssue({code:"custom",path:["approvalHash"],message:"Approval hash must match the Harness Run Manifest"}),e.maximumSpendUsd!==e.manifest.approval.maximumSpendUsd&&t.addIssue({code:"custom",path:["maximumSpendUsd"],message:"Maximum spend must match the Harness Run Manifest"})});v({schemaVersion:N("openpond.adapterValidationReceipt.v1"),adapterId:rt,valid:z(),issues:x(v({code:rt,path:l().trim().max(2e3).nullable(),message:l().trim().min(1).max(5e3)}).strict()),capabilityReceipt:ft,planHash:ft,createdAt:Wn,contentHash:ft}).strict();v({runId:rt,adapterId:rt,routeId:rt.optional(),providerJobId:l().trim().min(1).max(1e3).nullable(),tenantId:rt.optional(),leaseId:rt.nullable(),manifestHash:ft.optional(),inputBundleHash:ft.optional(),createdAt:Wn}).strict();v({runId:rt,state:I(["queued","preparing","running","cancelling","cancelled","succeeded","failed"]),phase:l().trim().min(1).max(200),progress:S().min(0).max(1).nullable(),updatedAt:Wn,errorCode:rt.nullable()}).strict();v({runId:rt,manifestHash:ft,artifacts:x(v({kind:I(["checkpoint","adapter","metrics","trace","evaluation","receipt"]),objectRef:l().trim().min(1).max(2e3),sha256:ft,sizeBytes:S().int().nonnegative()}).strict()),contentHash:ft}).strict();const uv=I(["ready","model_download_required","compute_setup_required","provider_managed","unsupported"]),zL=v({id:rt,label:l().trim().min(1).max(500),description:l().trim().min(1).max(2e3),destinationId:rt,computeAdapterId:rt,runtimeAdapterId:rt,engineAdapterId:rt,methods:x(l().trim().min(1).max(100)),capabilityPills:x(l().trim().min(1).max(100)),executionMode:I(["local_worker","provider_native"]),approvalPolicy:v({providerId:wl,providerLabel:l().trim().min(1).max(200),settingsActionLabel:l().trim().min(1).max(500).nullable(),exportApprovalRequired:z(),exportDescription:l().trim().min(1).max(2e3).nullable(),preparationRequired:z(),minimumSpendUsd:S().nonnegative(),maximumSpendUsd:S().positive(),defaultMaximumSpendUsd:S().positive(),minimumRetentionDays:S().int().positive(),maximumRetentionDays:S().int().positive(),defaultRetentionDays:S().int().positive(),methodRequirement:l().trim().min(1).max(2e3).nullable()}).strict().nullable(),limits:v({maximumSequenceLength:S().int().positive(),maximumOutputTokens:S().int().positive(),maximumTrainingExamples:S().int().positive().nullable()}).strict(),defaults:v({loraRank:S().int().positive(),maxSteps:S().int().positive(),rolloutGroupSize:S().int().min(2).max(32),rolloutConcurrency:S().int().positive().max(32),rolloutOutputTokens:S().int().positive()}).strict(),available:z(),unavailableReason:l().trim().min(1).max(5e3).nullable()}).strict(),DL=v({selectionKey:rt,label:l().trim().min(1).max(500),source:I(["local","builtin","huggingface","managed","search"]),modelId:l().trim().min(1).max(1e3),revision:l().trim().min(1).max(500).nullable(),tokenizerRevision:l().trim().min(1).max(500).nullable(),chatTemplateHash:ft.nullable(),modelAssetId:rt.nullable(),expectedBytes:S().int().nonnegative().nullable(),cached:z(),known:z(),searchResolved:z(),computeAdapterIds:x(rt),engineAdapterIds:x(rt),preparationState:uv,reason:l().trim().min(1).max(5e3).nullable(),compatibilities:x(v({targetId:rt,methods:x(l().trim().min(1).max(100)),state:uv,reason:l().trim().min(1).max(5e3).nullable()}).strict())}).strict();v({schemaVersion:N("openpond.trainingCatalog.v1"),models:x(DL).max(1e5),engines:x(OL),compute:x(jL),runtimes:x(NL),targets:x(zL),generatedAt:Wn,contentHash:ft}).strict();v({schemaVersion:N("openpond.trainingPreparationPlan.v1"),modelRunId:rt,state:uv,reason:l().trim().min(1).max(5e3).nullable(),runtime:Ib.nullable(),compute:Ab.nullable(),engine:Rb.nullable(),downloads:x(v({kind:N("model"),label:l().trim().min(1).max(500),expectedBytes:S().int().nonnegative(),digest:l().trim().min(8).max(500),cached:z(),state:I(["ready","required","downloading","cancelled","failed"]),progress:S().min(0).max(1).nullable(),cancellable:z(),diskImpactBytes:S().int().nonnegative()}).strict()),dataMovement:x(v({direction:I(["upload","download","none"]),label:l().trim().min(1).max(500),bytes:S().int().nonnegative().nullable()}).strict()),quoteUsd:S().nonnegative().nullable(),maximumSpendUsd:S().nonnegative().nullable(),retentionDays:S().int().nonnegative().nullable(),sideEffectsStarted:N(!1),contentHash:ft}).strict();const UL=v({adapterId:it,placement:I(["local","remote","colocated","provider_native"]),runtimeVersion:l().trim().min(1).max(200),capabilityReceipt:mt}).strict(),LL=v({maxTurns:S().int().positive().max(1e5),timeoutMs:S().int().positive().max(864e5),maxOutputBytes:S().int().positive().max(25e7),maximumSpendUsd:S().nonnegative().nullable()}).strict(),HL=v({schemaVersion:N("openpond.runManifest.v1"),id:it,harnessRelease:ht,tasksetRelease:ht,model:Yc,runtimeTarget:UL,limits:LL,approval:v({id:it,contentHash:mt}).strict().nullable(),createdAt:tn,metadata:ko}).strict();HL.extend({contentHash:mt}).strict();const eI=v({schemaVersion:N("openpond.attemptReceipt.v1"),id:it,runManifest:ht,taskId:it,seed:l().trim().min(1).max(500),terminal:z(),failureClass:Tf.nullable(),outputHash:mt.nullable(),traceHash:mt,artifactRefs:x(nf).max(1e5),graderEvidenceRefs:x(nf).max(1e4),startedAt:tn,completedAt:tn,latencyMs:S().int().nonnegative(),costUsd:S().nonnegative().nullable(),legacyAttemptRef:it.nullable().default(null),metadata:ko}).strict(),tI=eI.extend({contentHash:mt}).strict(),$L=v({schemaVersion:N("openpond.evaluationResult.v1"),id:it,runManifest:ht,harnessRelease:ht,tasksetRelease:ht,model:Yc,receiptRefs:x(ht).min(1).max(1e6),attemptCount:S().int().positive(),rewardEligibleCount:S().int().nonnegative(),terminalCount:S().int().nonnegative(),meanScore:S().min(0).max(1).nullable(),failureCounts:$e(Tf,S().int().nonnegative()),metadata:ko}).strict();$L.extend({contentHash:mt}).strict();const qL=v({schemaVersion:N("openpond.harnessCompatibility.v1"),id:it,baseHarnessRelease:ht,candidateHarnessRelease:ht,tasksetRelease:ht,environmentHash:mt,toolContractHash:mt,policyHash:mt,graderInterfaceHash:mt,metadata:ko}).strict();qL.extend({contentHash:mt}).strict();function BL(e){const t=tI.safeParse(e);if(!t.success)return!1;const{contentHash:a,...i}=t.data;return Kt(eI.parse(i))===a}const td=I(["train","validation","test","frozen_eval"]),VL=v({policyVisibleFields:x(it).max(1e3).default([]),privilegedFields:x(it).max(1e3).default([]),hiddenGraderRefs:x(it).max(1e3).default([]),connectedAppScopes:x(it).max(100).default([])}).strict(),FL=v({protocolVersion:N("openpond.environment.v1"),kind:I(["text","agent","work","custom_program"]),entrypoint:l().trim().min(1).max(1e3),stateful:z(),deterministicSeeds:z(),lifecycle:x(I(["create","reset","step","collect","destroy"])).min(5).max(5),networkPolicy:I(["none","declared_read_only","declared_scoped"]),defaultTimeoutMs:S().int().positive().max(36e5)}).strict(),Df=v({id:it,version:l().trim().min(1).max(100),weight:S().nonnegative().max(1e3).default(1),hardGate:z().default(!1),rewardEligible:z().default(!1),privileged:z().default(!1)}),KL=Df.extend({kind:I(["content","schema","artifact","runtime_event","state"]),config:$e(l(),Fe())}).strict(),GL=Df.extend({kind:N("model_judge"),rubricRef:Vi,calibrationStatus:I(["pending","passed","failed"])}).strict(),ZL=Df.extend({kind:N("custom_verifier"),verifierRef:Vi,timeoutMs:S().int().positive().max(3e5),networkPolicy:N("none")}).strict(),WL=Df.extend({kind:N("human"),rubricRef:Vi,reviewerRole:l().trim().min(1).max(500)}).strict(),YL=Ua([KL,GL,ZL,WL]),JL=v({id:it,clusterKey:it,split:td,input:$e(l(),Fe()),expectedOutput:$e(l(),Fe()).nullable(),policyVisibleContext:$e(l(),Fe()).default({}),privilegedContextRef:it.nullable(),artifactRefs:x(Vi).max(1e3).default([]),tags:x(it).max(100).default([])}).strict(),XL=v({schemaVersion:N("openpond.tasksetRelease.v2"),id:it,revision:S().int().positive(),policy:VL,environment:FL,tools:x(Nf).max(200),capabilities:x(Eb).max(200),tasks:x(JL).min(1).max(1e6),graders:x(YL).min(1).max(1e3),metadata:ko}).strict(),QL=XL.extend({contentHash:mt}).strict();QL.parse({capabilities:[{id:"filesystem.workspace",portability:"host_adapter",required:!0,scopes:["inputs:read","work:read-write","outputs:write"]},{id:"network.web-read",portability:"host_adapter",required:!0,scopes:["search","fetch"]},{id:"artifact.pdf",portability:"host_adapter",required:!0,scopes:["create","render","inspect"]},{id:"artifact.spreadsheet",portability:"host_adapter",required:!0,scopes:["create","calculate","inspect"]}],contentHash:"05dbf9058c09b75bc950ca5cdf4ac03650dba7bb0cb74a3d9e152b16c110a2f7",environment:{defaultTimeoutMs:9e5,deterministicSeeds:!1,entrypoint:"openpond-work-v1",kind:"work",lifecycle:["create","reset","step","collect","destroy"],networkPolicy:"declared_read_only",protocolVersion:"openpond.environment.v1",stateful:!0},graders:[{hardGate:!0,id:"task-output-contract",kind:"custom_verifier",networkPolicy:"none",privileged:!0,rewardEligible:!0,timeoutMs:3e4,verifierRef:{contentHash:"5290dfae6969bd4581b1e1c111bdc1cb5f2828f7a91681635254b246c7590392",id:"verifiers-taskset-output-verifier-mjs",mediaType:"text/javascript",path:"verifiers/taskset-output-verifier.mjs",sizeBytes:1295,visibility:"verifier"},version:"1",weight:1},{calibrationStatus:"pending",hardGate:!0,id:"task-quality-judge",kind:"model_judge",privileged:!0,rewardEligible:!0,rubricRef:{contentHash:"455b3697c0617333a34b6521f167760fb8ae7e286059fa2ec327a5c97e66a2b3",id:"rubrics-task-quality-md",mediaType:"text/markdown",path:"rubrics/task-quality.md",sizeBytes:1496,visibility:"verifier"},version:"1",weight:1}],id:"harness-refiner-public-v1",metadata:{adaptationSplit:"validation",benchmark:"harness-refiner",frozenEvaluationSplit:"frozen_eval",primaryMetric:"paired_foreground_provider_tokens",protocolVersion:"1",qualityPolicy:"hard_non_regression",toolDeclarationSource:"openpond-production-model-tool-definitions",trainingSideEffect:!1},policy:{connectedAppScopes:[],hiddenGraderRefs:["rubrics-task-quality-md","verifiers-taskset-output-verifier-mjs"],policyVisibleFields:["input"],privilegedFields:["expectedOutput"]},revision:3,schemaVersion:"openpond.tasksetRelease.v2",tasks:[{artifactRefs:[{contentHash:"8879f8e31a916f165724a3c3e3e57db5baa858cd170ac6799064aa49bc623aa4",id:"fixtures-adaptation-board-launch-md",mediaType:"text/markdown",path:"fixtures/adaptation-board-launch.md",sizeBytes:642,visibility:"policy"}],clusterKey:"northstar-launch-packet",expectedOutput:{deliverable:"pdf",mustInclude:["three decision options","owners and dates","confirmed facts","open legal and finance gates"],mustNot:["present an open gate as approved","invent a recommended decision"],validation:["structural","visual"]},id:"adaptation-board-launch-brief",input:{attachments:["adaptation-board-launch.md"],prompt:"Please turn the attached Northstar launch packet into a polished two-page PDF decision brief for the executive meeting. Make the three options, owners, dates, confirmed facts, open gates, and risks easy to scan. The source records no final choice, so do not select, recommend, or imply a preferred option. Visually check the finished PDF before you send it back."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-adaptation-board-launch-brief",split:"validation",tags:["artifact-verification","decision-brief","adaptation"]},{artifactRefs:[{contentHash:"a3d44bb123a242d78d0f60d4d8ad352e499bef677eaf816a19d07359a172743f",id:"fixtures-adaptation-latency-incident-md",mediaType:"text/markdown",path:"fixtures/adaptation-latency-incident.md",sizeBytes:733,visibility:"policy"}],clusterKey:"checkout-latency-incident-packet",expectedOutput:{deliverable:"pdf",mustInclude:["incident window","confirmed impact","recovery","hypotheses labeled as hypotheses","unknowns","follow-up owners"],mustNot:["state either hypothesis as root cause","claim unresolved carts were recovered"],validation:["structural","visual"]},id:"adaptation-latency-incident-review",input:{attachments:["adaptation-latency-incident.md"],prompt:"Create a concise PDF incident review from the attached checkout latency packet. Clearly separate confirmed observations, recovery actions, hypotheses, unknowns, customer impact, and follow-up owners. Check that the rendered PDF is readable and complete."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-adaptation-latency-incident-review",split:"validation",tags:["artifact-verification","incident-review","adaptation"]},{artifactRefs:[{contentHash:"63bca96753ae1491a45ba13e1a06cfb48973cfbe4f392e8f181e7b9648fd9db4",id:"fixtures-adaptation-program-budget-md",mediaType:"text/markdown",path:"fixtures/adaptation-program-budget.md",sizeBytes:649,visibility:"policy"}],clusterKey:"harbor-program-budget-packet",expectedOutput:{deliverable:"spreadsheet",mustInclude:["summary sheet","detail sheet","formula-driven full-year forecast","formula-driven variance","owner column","overrun flag"],mustNot:["replace formulas with typed totals","reverse the variance sign"],validation:["structural","test"]},id:"adaptation-program-budget-workbook",input:{attachments:["adaptation-program-budget.md"],prompt:"Build an Excel workbook from the attached Harbor youth program budget. Include a one-page summary and a detail sheet with formulas for full-year forecast and variance, clearly flag forecast overruns, preserve the listed owners, and verify the calculations before returning it."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-adaptation-program-budget-workbook",split:"validation",tags:["artifact-verification","spreadsheet","adaptation"]},{artifactRefs:[],clusterKey:"northwind-invoice-correction-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","INV-1842","120 seats instead of 102","August 14","no payment due until corrected","accounts@example.com"],mustNot:["suggest the error was intentional","exceed 130 words","return only a checklist or file path instead of the message"],validation:[]},id:"adaptation-invoice-correction-email",input:{attachments:[],prompt:"Draft a courteous email to Northwind Labs explaining that invoice INV-1842 incorrectly lists 120 seats instead of 102. A corrected invoice will arrive by August 14, no payment is due until it arrives, and billing questions should go to accounts@example.com. Keep it under 130 words and do not suggest the error was intentional."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-invoice-correction-email",split:"validation",tags:["constraint-following","direct-deliverable","communication","adaptation"]},{artifactRefs:[],clusterKey:"nextjs-security-current-sources",expectedOutput:{deliverable:"report",mustInclude:["official advisory links","affected and fixed versions","date checked","limits on exposure inference"],mustNot:["declare exposure without project version and configuration","use an uncited vulnerability list"],validation:[]},id:"adaptation-nextjs-security-audit",input:{attachments:[],prompt:"Audit the currently supported Next.js release lines for security advisories published in the last twelve months. Use primary sources, explain which versions are affected and fixed, avoid inferring that a project is vulnerable without its exact version and configuration, and give me a concise linked report with the date checked."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-nextjs-security-audit",split:"validation",tags:["research-efficiency","primary-sources","security","adaptation"]},{artifactRefs:[],clusterKey:"juniper-workshop-reschedule-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","September 10","2:00 p.m. ET","facilitator unavailable","registrations carry over","recording","events@example.com"],mustNot:["blame the venue","exceed 120 words","return only a checklist or file path instead of the message"],validation:[]},id:"adaptation-workshop-reschedule-email",input:{attachments:[],prompt:"Draft a warm email to Juniper workshop registrants explaining that the September 3 session is moving to September 10 at 2:00 p.m. ET because the facilitator is unavailable. Existing registrations carry over, a recording will be shared, and questions should go to events@example.com. Keep it under 120 words and do not imply the venue caused the change."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-workshop-reschedule-email",split:"validation",tags:["constraint-following","direct-deliverable","communication","adaptation"]},{artifactRefs:[],clusterKey:"boston-dc-accessibility-sources",expectedOutput:{deliverable:"report",mustInclude:["official operator sources","outbound and return plan","accessibility details","disruption check","time checked","items needing confirmation"],mustNot:["guarantee availability not confirmed by booking","hide access limitations"],validation:[]},id:"adaptation-accessible-boston-dc-plan",input:{attachments:[],prompt:"Plan a wheelchair-accessible train trip from Boston to Washington, DC for September 17, 2026, returning September 19. Verify accessibility and disruption information from official sources, distinguish facts from anything that still needs confirmation, include direct links and the time checked, and keep the answer practical and concise."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-accessible-boston-dc-plan",split:"validation",tags:["research-efficiency","current-information","travel","adaptation"]},{artifactRefs:[],clusterKey:"chatgpt-x-reddit-public-sample",expectedOutput:{deliverable:"report",mustInclude:["links to public examples","dates","positive experiences","negative experiences","pattern versus anecdote","sampling limitations"],mustNot:["post or interact","represent a convenience sample as representative sentiment"],validation:[]},id:"adaptation-chatgpt-public-experiences",input:{attachments:[],prompt:"Research what people have publicly said about using ChatGPT on X and Reddit during the last thirty days. Give me a concise, linked summary of recurring positive and negative experiences, separate patterns from anecdotes, include dates, and explain any platform-access or sampling limitations. Do not post or interact with anyone."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-chatgpt-public-experiences",split:"validation",tags:["research-efficiency","current-information","social-research","adaptation"]},{artifactRefs:[],clusterKey:"acme-launch-delay-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","August 27","accessibility testing incomplete","August 22 expectation","pilot access remains","support email"],mustNot:["say testing failed","exceed 140 words","invent compensation","return only a checklist or file path instead of the message"],validation:[]},id:"adaptation-launch-delay-email",input:{attachments:[],prompt:"Draft a calm email to the Acme pilot customers explaining that the August 20 launch is moving to August 27 because final accessibility testing is not complete. Testing is expected to finish August 22, existing pilot access remains available, and questions should go to pilot-support@example.com. Keep it under 140 words and do not imply the test has failed."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-launch-delay-email",split:"validation",tags:["constraint-following","direct-deliverable","communication","adaptation"]},{artifactRefs:[],clusterKey:"cirrus-service-window-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","August 18","1:00 to 2:00 UTC","dashboard read-only","alerts continue","no data loss expected","status.example.com"],mustNot:["promise zero interruption","exceed 125 words","return only a checklist or file path instead of the message"],validation:[]},id:"adaptation-service-window-email",input:{attachments:[],prompt:"Draft a calm email to Cirrus customers about planned maintenance on August 18 from 1:00 to 2:00 UTC. The dashboard will be read-only, alerts will continue, no data loss is expected, and updates will appear at status.example.com. Keep it under 125 words and do not promise that there will be zero interruption."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-service-window-email",split:"validation",tags:["constraint-following","direct-deliverable","communication","adaptation"]},{artifactRefs:[{contentHash:"cb3aec594b140129ebd872c427053ba63a303cc36d160448afc9ed1a0289d3ca",id:"fixtures-frozen-clinic-relocation-md",mediaType:"text/markdown",path:"fixtures/frozen-clinic-relocation.md",sizeBytes:652,visibility:"policy"}],clusterKey:"riverside-clinic-relocation-packet",expectedOutput:{deliverable:"pdf",mustInclude:["three opening options","owners and dates","confirmed facts","permit and parking gates","delivery risk"],mustNot:["present either approval as complete","invent a chosen opening option"],validation:["structural","visual"]},id:"frozen-clinic-relocation-brief",input:{attachments:["frozen-clinic-relocation.md"],prompt:"Please turn the attached Riverside clinic relocation packet into a polished two-page PDF decision brief. Make the opening options, owners, dates, confirmed facts, unresolved approvals, and delivery risk easy to scan, and visually check the finished PDF before returning it."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-frozen-clinic-relocation-brief",split:"frozen_eval",tags:["artifact-verification","decision-brief","frozen-eval"]},{artifactRefs:[{contentHash:"80aad04ac67682165f098884fd1a86e9fb3ef15d2da3124401308dd23884b612",id:"fixtures-frozen-payment-incident-md",mediaType:"text/markdown",path:"fixtures/frozen-payment-incident.md",sizeBytes:672,visibility:"policy"}],clusterKey:"subscription-renewal-incident-packet",expectedOutput:{deliverable:"pdf",mustInclude:["incident window","attempt and timeout counts","recovery","hypothesis label","33 unresolved accounts","follow-up owners"],mustNot:["state the certificate hypothesis as confirmed","claim all accounts resolved"],validation:["structural","visual"]},id:"frozen-payment-incident-review",input:{attachments:["frozen-payment-incident.md"],prompt:"Create a concise PDF incident review from the attached subscription renewal incident packet. Separate confirmed impact and recovery from the root-cause hypothesis and unresolved customer accounts, preserve the owners, and check the rendered PDF for readability and completeness."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-frozen-payment-incident-review",split:"frozen_eval",tags:["artifact-verification","incident-review","frozen-eval"]},{artifactRefs:[{contentHash:"c58b740d57b031cfe22d475d30b39a1a49a43820f1840a1d8054731cef58c8e8",id:"fixtures-frozen-grant-budget-md",mediaType:"text/markdown",path:"fixtures/frozen-grant-budget.md",sizeBytes:661,visibility:"policy"}],clusterKey:"greenway-grant-budget-packet",expectedOutput:{deliverable:"spreadsheet",mustInclude:["summary sheet","detail sheet","formula-driven full-year forecast","formula-driven variance","owner column","overrun flag"],mustNot:["replace formulas with typed totals","reverse the variance sign"],validation:["structural","test"]},id:"frozen-grant-budget-workbook",input:{attachments:["frozen-grant-budget.md"],prompt:"Build an Excel workbook from the attached Greenway community grant budget. Include a one-page summary and detail sheet with formulas for full-year forecast and variance, flag forecast overruns, preserve owners, and verify all calculations before returning it."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-frozen-grant-budget-workbook",split:"frozen_eval",tags:["artifact-verification","spreadsheet","frozen-eval"]},{artifactRefs:[],clusterKey:"beacon-shipping-delay-message",expectedOutput:{deliverable:"message",mustInclude:["complete ready-to-post message copy","August 21","carrier missed transfer window","August 22 installation","Morgan","logistics channel"],mustNot:["say the equipment is lost","exceed 90 words","return only a checklist or file path instead of the message"],validation:[]},id:"frozen-shipping-delay-chat-message",input:{attachments:[],prompt:"Write a concise team chat message explaining that the Beacon equipment shipment is now expected August 21 instead of August 19 because the carrier missed its transfer window. The installation crew remains booked for August 22, Morgan owns the carrier follow-up, and the team should flag conflicts in the logistics channel. Keep it under 90 words and do not say the equipment is lost."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-shipping-delay-chat-message",split:"frozen_eval",tags:["constraint-following","direct-deliverable","communication","frozen-eval"]},{artifactRefs:[],clusterKey:"python-requests-security-current-sources",expectedOutput:{deliverable:"report",mustInclude:["primary advisory links","affected and fixed versions","date checked","dependency and usage caveat"],mustNot:["declare deployment exposure without evidence","use an uncited vulnerability list"],validation:[]},id:"frozen-python-requests-security-audit",input:{attachments:[],prompt:"Audit the supported Python Requests release lines for security advisories published in the last eighteen months. Use primary sources, identify affected and fixed versions, avoid claiming a specific deployment is exposed without its exact dependency graph and usage, and provide a concise linked report with the date checked."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-python-requests-security-audit",split:"frozen_eval",tags:["research-efficiency","primary-sources","security","frozen-eval"]},{artifactRefs:[],clusterKey:"cobalt-refund-support-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready reply copy","$48 duplicate charge","August 16","original payment method","five business days","CB-7714"],mustNot:["state the refund is already approved","exceed 110 words","return only a checklist or file path instead of the message"],validation:[]},id:"frozen-refund-support-reply",input:{attachments:[],prompt:"Write a helpful support reply to a Cobalt customer whose duplicate $48 charge is being reviewed. The review should finish by August 16, any confirmed duplicate will be refunded to the original payment method within five business days, and the case number is CB-7714. Keep it under 110 words and do not state that the refund has already been approved."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-refund-support-reply",split:"frozen_eval",tags:["constraint-following","direct-deliverable","communication","frozen-eval"]},{artifactRefs:[],clusterKey:"chicago-stl-accessibility-sources",expectedOutput:{deliverable:"report",mustInclude:["official operator sources","outbound and return plan","accessibility details","disruption check","time checked","items needing confirmation"],mustNot:["guarantee unconfirmed availability","hide access limitations"],validation:[]},id:"frozen-accessible-chicago-stl-plan",input:{attachments:[],prompt:"Plan a wheelchair-accessible train trip from Chicago to St. Louis for October 8, 2026, returning October 10. Verify accessibility and disruption information from official sources, distinguish confirmed facts from anything requiring booking confirmation, include direct links and the time checked, and keep it practical."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-accessible-chicago-stl-plan",split:"frozen_eval",tags:["research-efficiency","current-information","travel","frozen-eval"]},{artifactRefs:[],clusterKey:"new-jersey-youth-grant-sources",expectedOutput:{deliverable:"report",mustInclude:["authoritative source links","eligibility evidence","deadlines","date checked","only realistic matches"],mustNot:["include closed grants","include grants without verified nonprofit and program eligibility","pad the list"],validation:[]},id:"frozen-new-jersey-youth-grants",input:{attachments:[],prompt:"Find currently open grants that a New Jersey nonprofit running after-school programs could realistically apply for, with deadlines between now and December 31, 2026. Use authoritative sources, link each opportunity, verify eligibility and deadline, omit weak matches instead of padding the list, and state when you checked."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-new-jersey-youth-grants",split:"frozen_eval",tags:["research-efficiency","current-information","funding","frozen-eval"]},{artifactRefs:[],clusterKey:"maple-maintenance-followup-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","July 28","August 1 inspection","security concern","repair date within two business days"],mustNot:["make a legal threat","claim facts not supplied","exceed 130 words","return only a checklist or file path instead of the message"],validation:[]},id:"frozen-maintenance-followup-email",input:{attachments:[],prompt:"Draft a firm but courteous email to Maple Property Management following up on a bedroom window that has not closed securely since July 28. Maintenance inspected it August 1 but did not repair it. Ask for a repair date within two business days, mention the security concern, and keep the email under 130 words without making legal threats."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-maintenance-followup-email",split:"frozen_eval",tags:["constraint-following","direct-deliverable","communication","frozen-eval"]},{artifactRefs:[],clusterKey:"meridian-vendor-document-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","insurance certificate","August 7","onboarding blocked","Rosa","August 12"],mustNot:["threaten contract cancellation","exceed 120 words","return only a checklist or file path instead of the message"],validation:[]},id:"frozen-vendor-document-followup-email",input:{attachments:[],prompt:"Draft a firm but professional email to Meridian Freight following up on the insurance certificate promised for August 7. It has not arrived, carrier onboarding cannot finish without it, and Rosa needs the document or a confirmed delivery date by August 12. Keep it under 120 words and do not threaten to cancel the contract."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-vendor-document-followup-email",split:"frozen_eval",tags:["constraint-following","direct-deliverable","communication","frozen-eval"]}],tools:[{description:"Start Work compute only when it is needed, then return live sandbox status and the stable /workspace/inputs, /workspace/work, and /workspace/outputs layout.",inputSchema:{additionalProperties:!1,properties:{},type:"object"},inputSchemaHash:"042b35e50dd5dd505f0228e829f17a8aeaae50e49d865c4754cf9ba1edba9bd0",name:"work_environment",sideEffect:"write",timeoutMs:12e4},{description:"List files in the Work scratch, input, or completed-output area. This lazily starts Work compute.",inputSchema:{additionalProperties:!1,properties:{area:{enum:["inputs","work","outputs"],type:"string"},path:{description:"Optional relative path inside the selected area.",type:"string"},recursive:{type:"boolean"}},required:["area"],type:"object"},inputSchemaHash:"a3a68e8aeb4f23710aa21fe95d4a361a14c08bcbb61a2a959a60b7b00c82807f",name:"work_list_files",sideEffect:"read",timeoutMs:12e4},{description:"Read a bounded file from Work inputs, scratch space, or completed-output candidates.",inputSchema:{additionalProperties:!1,properties:{area:{enum:["inputs","work","outputs"],type:"string"},maxBytes:{maximum:1e6,minimum:1,type:"integer"},path:{minLength:1,type:"string"}},required:["area","path"],type:"object"},inputSchemaHash:"deb9cd248f2734751286054c381ac9572b248370181970ced6563a73c905a4f0",name:"work_read_file",sideEffect:"read",timeoutMs:12e4},{description:"Write a UTF-8 Work scratch file or completed-output candidate. Use area=outputs only for a finished result that is ready to validate and save.",inputSchema:{additionalProperties:!1,properties:{area:{enum:["work","outputs"],type:"string"},content:{type:"string"},path:{minLength:1,type:"string"}},required:["area","path","content"],type:"object"},inputSchemaHash:"6a19df98686e99a324564006b0b92082f185ac4b430e9285829f781251dd145b",name:"work_write_file",sideEffect:"write",timeoutMs:12e4},{description:"Edit a Work scratch file or output candidate by exact text replacement after reading it.",inputSchema:{additionalProperties:!1,properties:{area:{enum:["work","outputs"],type:"string"},newText:{type:"string"},oldText:{minLength:1,type:"string"},path:{minLength:1,type:"string"},replaceAll:{type:"boolean"}},required:["area","path","oldText","newText"],type:"object"},inputSchemaHash:"f507d9d9abbd8cf1556f6e925c159234295c3fa01800c5556767f96be8b011db",name:"work_edit_file",sideEffect:"write",timeoutMs:12e4},{description:"Run a bounded shell command from /workspace/work. Write finished deliverables to ../outputs and inspect them; the runtime preserves output files automatically when the turn ends.",inputSchema:{additionalProperties:!1,properties:{command:{minLength:1,type:"string"},timeoutSeconds:{maximum:3600,minimum:1,type:"integer"}},required:["command"],type:"object"},inputSchemaHash:"5ba3a52cddb3f575218bed855020e91eef14092d75922c963a24c6bc97fadeda",name:"work_exec",sideEffect:"write",timeoutMs:3e5},{description:"Explicitly copy one completed file from /workspace/outputs to durable OpenPond output storage before turn completion. Normal Work turns preserve output files automatically.",inputSchema:{additionalProperties:!1,properties:{path:{description:"Path relative to /workspace/outputs, for example report.md.",minLength:1,type:"string"},suggestedName:{maxLength:180,minLength:1,type:"string"},validation:{items:{additionalProperties:!1,properties:{detail:{maxLength:4e3,type:"string"},kind:{enum:["structural","visual","test","user_review"],type:"string"},label:{maxLength:240,minLength:1,type:"string"},ref:{maxLength:4096,type:"string"},status:{enum:["passed","failed","not_run"],type:"string"}},required:["kind","status","label"],type:"object"},maxItems:32,type:"array"}},required:["path"],type:"object"},inputSchemaHash:"ca853f64b300c74441b522db03facbcc9c5bb89c86189dae24182bab39510a83",name:"work_save_output",sideEffect:"write",timeoutMs:12e4},{description:"Stop Work compute after durable outputs have been saved. Saved OutputRefs remain available.",inputSchema:{additionalProperties:!1,properties:{},type:"object"},inputSchemaHash:"042b35e50dd5dd505f0228e829f17a8aeaae50e49d865c4754cf9ba1edba9bd0",name:"work_stop",sideEffect:"write",timeoutMs:12e4},{description:"Search the web for current or external information. The app renders clickable source pills automatically. Cite by source title or source name in prose by default; when the user explicitly requests URLs or linked evidence, use the result URLs in clickable Markdown links.",inputSchema:{additionalProperties:!1,properties:{domains:{description:"Optional domain filters.",items:{type:"string"},maxItems:10,type:"array"},limit:{description:"Maximum number of results to return.",maximum:10,minimum:1,type:"integer"},query:{description:"Search query.",minLength:1,type:"string"},recencyDays:{description:"Only return results from this many recent days when supported.",minimum:0,type:"integer"}},required:["query"],type:"object"},inputSchemaHash:"2a138bf9b526a624ac2442669fccb277fac2ba818821b3a2da1dd27d62954056",name:"web_search",sideEffect:"read",timeoutMs:12e4},{description:"Fetch and extract readable text from a known HTTP(S) URL. Use this when the user provides a URL or a search result has an exact page to inspect; use web_search when discovering unknown pages by query.",inputSchema:{additionalProperties:!1,properties:{maxBytes:{description:"Maximum UTF-8 bytes of extracted text to return. Defaults to 20000.",maximum:1e5,minimum:1,type:"integer"},url:{description:"HTTP or HTTPS URL to fetch.",minLength:1,type:"string"}},required:["url"],type:"object"},inputSchemaHash:"0afe31d8dbe05643e4a19ca0897c606e379f37d741b4f61816ad8ba4d48b61b3",name:"web_fetch",sideEffect:"read",timeoutMs:12e4}]});const nI=I(["foreground_tokens","success_rate","latency_ms","cost_usd"]),aI=I(["baseline","candidate"]),e5=v({split:td,taskIds:x(it).min(1).max(1e5),seeds:x(l().trim().min(1).max(500)).min(1).max(100),repetitions:S().int().positive().max(20),runtimeTargetHash:mt,environmentHash:mt,toolContractHash:mt,limitsHash:mt}).strict();v({schemaVersion:N("openpond.benchmarkDefinition.v1"),id:it,title:l().trim().min(1).max(500),description:l().trim().min(1).max(5e3),tasksetRelease:ht,adaptationSplit:td,evaluationSplit:td,primaryMetric:nI,qualityGate:I(["none","non_regression","all_pass"]),caseCounts:v({adaptation:S().int().nonnegative(),evaluation:S().int().positive()}).strict(),metadata:ko}).strict();v({schemaVersion:N("openpond.benchmarkRunRequest.v1"),phase:aI,model:Yc,reasoningEffort:l().trim().min(1).max(100).nullable(),split:td,seeds:x(l().trim().min(1).max(500)).min(1).max(100),repetitions:S().int().positive().max(20),metadata:ko}).strict();const t5=v({inputTokens:S().int().nonnegative(),outputTokens:S().int().nonnegative(),totalTokens:S().int().nonnegative()}).strict(),n5=v({schemaVersion:N("openpond.benchmarkRunSummary.v1"),id:it,phase:aI,tasksetRelease:ht,harnessRelease:ht,evaluationResult:ht,model:Yc,reasoningEffort:l().trim().min(1).max(100).nullable(),protocol:e5,attemptCount:S().int().positive(),passedCount:S().int().nonnegative(),terminalCount:S().int().nonnegative(),usage:t5,costUsd:S().nonnegative().nullable(),latencyMs:S().int().nonnegative(),createdAt:tn,metadata:ko}).strict();n5.extend({contentHash:mt}).strict();const a5=v({schemaVersion:N("openpond.benchmarkComparison.v1"),id:it,baseline:ht,candidate:ht,tasksetRelease:ht,primaryMetric:nI,qualityPassed:z(),baselinePassRate:S().min(0).max(1),candidatePassRate:S().min(0).max(1),foregroundTokenDelta:S().int(),foregroundTokenDeltaPercent:S().finite().nullable(),improved:z(),createdAt:tn,metadata:ko}).strict();a5.extend({contentHash:mt}).strict();const o5="openpond.workEvidenceReceipt.v1",i5="openpond.workProcessTrace.v1",r5="openpond.workFeedbackReceipt.v1",oI="openpond.workEvidenceEligibility.v1",s5=l().regex(/^urn:openpond:work:[a-f0-9]{64}$/,"Work source references must be opaque SHA-256 URNs."),l5=l().regex(/^urn:openpond:workspace:[a-f0-9]{64}$/,"Workspace references must be opaque SHA-256 URNs."),c5=l().regex(/^urn:openpond:artifact:[a-f0-9]{64}$/,"Evidence artifacts must use content-addressed SHA-256 URNs."),za=nf.extend({id:c5}).strict().superRefine((e,t)=>{e.id!==cI(e.contentHash)&&t.addIssue({code:"custom",message:"Evidence artifact id must contain its content hash.",path:["id"]})}),u5=I(["tool","validation","state_transition","approval","question","artifact","cleanup"]),d5=I(["agent","environment"]),m5=I(["turn_started","turn_completed","turn_failed","turn_cancelled","turn_timed_out","tool_invoked","tool_completed","tool_failed","validation_completed","validation_failed","approval_requested","approval_resolved","question_asked","question_answered","question_dismissed","artifact_created","workspace_changed","environment_created","environment_reset","environment_destroyed","cleanup_completed","cleanup_failed"]),f5=I(["started","completed","failed","cancelled"]),p5=I(["filesystem","source_control","command","browser","connected_app","sandbox","agent","other"]),h5=I(["structural","visual","test","user_review","other"]),g5=I(["running","completed","failed","cancelled","timeout"]),v5=I(["requested","approved","denied","answered","dismissed"]),b5=I(["policy","validation","environment","infrastructure","timeout","cancelled","unknown"]),y5=I(["missing_start","missing_terminal","source_truncated","unsupported_events_dropped","uncorrelated_environment_step","artifact_unavailable"]),S5=v({sequence:S().int().nonnegative().max(1e6),timestamp:tn,layer:d5,kind:u5,action:m5,status:f5,inputHash:mt.nullable(),outputHash:mt.nullable(),receiptHash:mt.nullable(),parentReceiptHash:mt.nullable(),artifactRefs:x(za).max(1e3),attributes:v({toolCategory:p5.nullable(),validationKind:h5.nullable(),transitionState:g5.nullable(),interventionOutcome:v5.nullable(),artifactCount:S().int().nonnegative().max(1e5),exitCode:S().int().min(-1).max(255).nullable(),durationMs:S().int().nonnegative().max(31536e6).nullable(),cpuTimeMs:S().int().nonnegative().max(31536e6).nullable(),memoryPeakBytes:S().int().nonnegative().max(0x4000000000000).nullable(),errorClass:b5.nullable()}).strict()}).strict().superRefine((e,t)=>{e.layer==="agent"&&e.parentReceiptHash!==null&&t.addIssue({code:"custom",message:"Agent-layer steps cannot have a parent environment correlation.",path:["parentReceiptHash"]}),e.layer==="environment"&&e.parentReceiptHash===null&&t.addIssue({code:"custom",message:"Environment steps must correlate to an Agent receipt.",path:["parentReceiptHash"]})}),iI=v({schemaVersion:N(i5),sourceRevisionHash:mt,sanitationPolicyVersion:it,incomplete:z(),incompleteReasons:x(y5).max(10),droppedEventCount:S().int().nonnegative().max(1e6),steps:x(S5).max(1e5)}).strict().superRefine((e,t)=>{e.incomplete!==e.incompleteReasons.length>0&&t.addIssue({code:"custom",message:"incomplete must match the presence of incompleteReasons.",path:["incomplete"]});for(let a=0;a<e.steps.length;a+=1)e.steps[a].sequence!==a&&t.addIssue({code:"custom",message:"Process trace sequences must be contiguous and zero-based.",path:["steps",a,"sequence"]})}),_5=iI.safeExtend({contentHash:mt}).strict(),x5=I(["policy_failure","validation_failure","model_failure","environment_failure","infrastructure_failure","timeout","cancelled","unknown"]),k5=v({status:I(["completed","failed","cancelled","timeout"]),failureClass:x5.nullable()}).strict().superRefine((e,t)=>{e.status==="completed"&&e.failureClass!==null&&t.addIssue({code:"custom",message:"Completed Work cannot carry a failure class.",path:["failureClass"]}),e.status!=="completed"&&e.failureClass===null&&t.addIssue({code:"custom",message:"Non-completed Work requires a failure class.",path:["failureClass"]}),e.status==="cancelled"&&e.failureClass!=="cancelled"&&t.addIssue({code:"custom",message:"Cancelled Work must use the cancelled failure class.",path:["failureClass"]}),e.status==="timeout"&&e.failureClass!=="timeout"&&t.addIssue({code:"custom",message:"Timed-out Work must use the timeout failure class.",path:["failureClass"]})}),Mb=v({schemaVersion:N(o5),id:l().regex(/^work-evidence-[a-f0-9]{24}$/),source:v({surface:I(["desktop","hosted"]),experience:I(["work","development"]),opaqueRef:s5,revisionHash:mt}).strict(),agentSnapshot:ht.nullable(),model:Yc,runtime:v({adapterId:it,adapterVersion:it,capabilityRef:za.nullable()}).strict(),inputHash:mt,terminal:k5,trace:v({sanitizedRef:za,traceHash:mt,sanitationPolicyVersion:it,incomplete:z()}).strict(),outputRefs:x(za).max(1e4),artifactRefs:x(za).max(1e5),validationEvidenceRefs:x(za).max(1e4),interventions:v({approvals:S().int().nonnegative().max(1e6),questions:S().int().nonnegative().max(1e6),steeringEvents:S().int().nonnegative().max(1e6),otherUserInterventions:S().int().nonnegative().max(1e6)}).strict(),timing:v({startedAt:tn,completedAt:tn,latencyMs:S().int().nonnegative().max(31536e6)}).strict(),usage:v({promptTokens:S().int().nonnegative().nullable(),completionTokens:S().int().nonnegative().nullable(),totalTokens:S().int().nonnegative().nullable()}).strict(),costUsd:S().nonnegative().max(1e6).nullable(),provenance:v({consentReceiptRef:za,consentScope:N("work_process_and_artifacts"),consentGrantedAt:tn,policyVersion:it,projectorVersion:it,disclosure:N("portable_sanitized"),ownershipScope:I(["personal","workspace"]),workspaceRef:l5.nullable(),participantPolicy:I(["creator_only","all_participants"]),retention:v({policy:N("source_bound"),deleteWithSource:N(!0),expiresAt:tn.nullable()}).strict()}).strict()}).strict().superRefine((e,t)=>{e.trace.traceHash!==e.trace.sanitizedRef.contentHash&&t.addIssue({code:"custom",message:"Sanitized trace reference must bind traceHash.",path:["trace","traceHash"]});const a=Date.parse(e.timing.completedAt)-Date.parse(e.timing.startedAt);(a<0||a!==e.timing.latencyMs)&&t.addIssue({code:"custom",message:"latencyMs must equal completedAt minus startedAt.",path:["timing","latencyMs"]}),e.provenance.ownershipScope==="workspace"&&e.provenance.workspaceRef===null&&t.addIssue({code:"custom",message:"Workspace-owned evidence requires workspaceRef.",path:["provenance","workspaceRef"]}),e.provenance.ownershipScope==="personal"&&e.provenance.workspaceRef!==null&&t.addIssue({code:"custom",message:"Personal evidence cannot carry workspaceRef.",path:["provenance","workspaceRef"]}),pg(e.outputRefs,["outputRefs"],t),pg(e.artifactRefs,["artifactRefs"],t),pg(e.validationEvidenceRefs,["validationEvidenceRefs"],t)}),rI=Mb.safeExtend({contentHash:mt}).strict(),w5=I(["accepted","needs_correction","not_useful"]),C5=I(["correct","complete","high_quality","incorrect","incomplete","wrong_format","unsafe","stale","irrelevant","other"]),sI=v({schemaVersion:N(r5),id:l().regex(/^work-feedback-[a-f0-9]{24}$/),evidenceReceiptRef:za,outputRevisionRef:za.nullable(),verdict:w5,reasonCodes:x(C5).max(16),correctionRef:za.nullable(),correctedOutputRevisionRef:za.nullable(),actor:N("user"),createdAt:tn}).strict().superRefine((e,t)=>{new Set(e.reasonCodes).size!==e.reasonCodes.length&&t.addIssue({code:"custom",message:"Feedback reason codes must be unique.",path:["reasonCodes"]}),e.verdict!=="needs_correction"&&(e.correctionRef||e.correctedOutputRevisionRef)&&t.addIssue({code:"custom",message:"Only needs_correction feedback may bind correction artifacts.",path:["verdict"]})}),lI=sI.safeExtend({contentHash:mt}).strict();function cI(e){return`urn:openpond:artifact:${e}`}function I5(e){return`urn:openpond:work:${Kt(e)}`}function wd(e){return za.parse({id:cI(e.contentHash),contentHash:e.contentHash,mediaType:e.mediaType??null,sizeBytes:e.sizeBytes??null})}function uI(e){const t=iI.parse(e);return _5.parse({...t,contentHash:Kt(t)})}function A5(e){const t=Mb.parse(e);return rI.parse({...t,contentHash:Kt(t)})}function dI(e,t){const a=sI.parse(e),i=lI.parse({...a,contentHash:Kt(a)});return t&&E5(i,t),i}function R5(e){return M5(e,rI,Mb)}function T5(e){return wd({contentHash:e.contentHash,mediaType:"application/vnd.openpond.work-evidence+json",sizeBytes:null})}function E5(e,t){if(e.evidenceReceiptRef.contentHash!==t.contentHash)throw new Error("Feedback targets a different Work evidence receipt.");if(e.outputRevisionRef&&!t.outputRefs.some(a=>a.contentHash===e.outputRevisionRef.contentHash))throw new Error("Feedback targets an output revision not bound by the Work evidence receipt.")}function M5(e,t,a){const i=t.safeParse(e);if(!i.success)return!1;const{contentHash:s,...u}=i.data;return Kt(a.parse(u))===s}function pg(e,t,a){const i=e.map(s=>s.contentHash);new Set(i).size!==i.length&&a.addIssue({code:"custom",message:"Artifact content hashes must be unique.",path:t})}const P5=I(["active","revoked","deleted","expired"]);I(["discovery_only","eval_candidate","demonstration_candidate","preference_candidate","reward_candidate"]);const O5=I(["invalid_evidence_receipt","consent_revoked","source_deleted","retention_expired","trace_incomplete","terminal_not_completed","infrastructure_failure","agent_snapshot_missing","input_not_reconstructable","environment_not_reconstructable","output_missing","validation_evidence_missing","verifier_missing","accepted_feedback_missing","correction_pair_missing","attempt_receipt_missing","attempt_receipt_invalid","attempt_receipt_unbound","attempt_not_reward_eligible"]),_c=v({eligible:z(),blockers:x(O5).max(32)}).strict().superRefine((e,t)=>{e.eligible===e.blockers.length>0&&t.addIssue({code:"custom",message:"Eligibility must be the inverse of blocker presence."})}),mI=v({schemaVersion:N(oI),evidenceReceiptHash:mt,policyState:P5,decisions:v({discovery_only:_c,eval_candidate:_c,demonstration_candidate:_c,preference_candidate:_c,reward_candidate:_c}).strict()}).strict(),j5=mI.extend({contentHash:mt}).strict();function fI(e){const t=R5(e.evidence),a=(e.feedback??[]).filter(j=>{if(!lI.safeParse(j).success)return!1;try{return dI(z5(j),e.evidence),!0}catch{return!1}}),i=N5(e.policyState),s=[...t?[]:["invalid_evidence_receipt"],...i],u=[...s,...e.evidence.trace.incomplete?["trace_incomplete"]:[],...e.evidence.agentSnapshot?[]:["agent_snapshot_missing"],...e.reconstructability.input?[]:["input_not_reconstructable"],...e.reconstructability.environment?[]:["environment_not_reconstructable"],...e.evidence.outputRefs.length?[]:["output_missing"],...e.reconstructability.verifier?[]:["verifier_missing"]],d=e.evidence.terminal.status==="completed",f=a.some(j=>j.verdict==="accepted"),b=[...u,...d?[]:["terminal_not_completed"],...e.evidence.terminal.failureClass==="infrastructure_failure"?["infrastructure_failure"]:[],...e.evidence.validationEvidenceRefs.length?[]:["validation_evidence_missing"],...f?[]:["accepted_feedback_missing"]],p=new Set(a.filter(j=>j.verdict==="accepted").flatMap(j=>j.outputRevisionRef?.contentHash??[])),y=a.some(j=>j.verdict==="needs_correction"&&j.outputRevisionRef!==null&&j.correctedOutputRevisionRef!==null&&p.has(j.correctedOutputRevisionRef.contentHash)),k=[...u,...y?[]:["correction_pair_missing"]],w=e.replay??null,T=w?tI.safeParse(w.attemptReceipt):null,A=T?.success===!0&&BL(T.data),H=w?.sourceEvidenceReceiptHash===e.evidence.contentHash,W=A&&H&&w.attemptReceipt.terminal&&w.attemptReceipt.failureClass!=="infrastructure_failure"&&w.attemptReceipt.failureClass!=="timeout"&&w.attemptReceipt.failureClass!=="cancelled"&&w.attemptReceipt.metadata.rewardEligible===!0&&typeof w.attemptReceipt.metadata.score=="number",B=[...s,...w?[]:["attempt_receipt_missing"],...w&&!A?["attempt_receipt_invalid"]:[],...w&&!H?["attempt_receipt_unbound"]:[],...w&&A&&H&&!W?["attempt_not_reward_eligible"]:[]],M=mI.parse({schemaVersion:oI,evidenceReceiptHash:e.evidence.contentHash,policyState:e.policyState,decisions:{discovery_only:Uu(s),eval_candidate:Uu(u),demonstration_candidate:Uu(b),preference_candidate:Uu(k),reward_candidate:Uu(B)}});return j5.parse({...M,contentHash:Kt(M)})}function N5(e){return e==="revoked"?["consent_revoked"]:e==="deleted"?["source_deleted"]:e==="expired"?["retention_expired"]:[]}function Uu(e){const t=[...new Set(e)];return _c.parse({eligible:t.length===0,blockers:t})}function z5(e){const{contentHash:t,...a}=e;return a}v({schemaVersion:N("openpond.workEvidenceAuthoringInput.v1"),evidenceReceiptRef:za,inputHash:mt,agentSnapshot:ht.nullable(),sanitizedTraceRef:za,outputRefs:x(za).max(1e4),validationEvidenceRefs:x(za).max(1e4),incomplete:z(),evalCandidate:z(),blockerCodes:x(l().trim().min(1).max(120)).max(32)}).strict();const nd="2026-08-04T12:00:00.000Z",pI="2026-08-04T12:00:02.500Z",dv=Kt({fixture:"desktop-work",revision:1}),ad=wd({contentHash:Kt("fixture output"),mediaType:"text/plain",sizeBytes:14}),hI=wd({contentHash:Kt({kind:"test",status:"passed"}),mediaType:"application/json",sizeBytes:null}),D5=wd({contentHash:Kt({scope:"work_process_and_artifacts",grantedAt:nd}),mediaType:"application/json",sizeBytes:null}),Pb=uI({schemaVersion:"openpond.workProcessTrace.v1",sourceRevisionHash:dv,sanitationPolicyVersion:"openpond.desktop-work-sanitizer.v1",incomplete:!1,incompleteReasons:[],droppedEventCount:1,steps:[xc(0,nd,"agent","state_transition","turn_started","started",{transitionState:"running"}),xc(1,"2026-08-04T12:00:00.500Z","agent","tool","tool_invoked","started",{toolCategory:"filesystem",inputHash:Kt({path:"hashed-only"}),receiptHash:Kt("fixture-tool-call")}),xc(2,"2026-08-04T12:00:01.000Z","environment","artifact","artifact_created","completed",{outputHash:ad.contentHash,artifacts:[ad],receiptHash:Kt("fixture-environment-operation"),parentReceiptHash:Kt("fixture-tool-call")}),xc(3,"2026-08-04T12:00:01.500Z","environment","validation","validation_completed","completed",{validationKind:"test",outputHash:hI.contentHash,receiptHash:Kt("fixture-validation"),parentReceiptHash:Kt("fixture-tool-call")}),xc(4,pI,"agent","state_transition","turn_completed","completed",{transitionState:"completed"})]}),U5=new TextEncoder().encode(kw(Pb)).byteLength,hg=wd({contentHash:Pb.contentHash,mediaType:"application/vnd.openpond.work-process-trace+json",sizeBytes:U5}),yl=A5({schemaVersion:"openpond.workEvidenceReceipt.v1",id:`work-evidence-${Kt([dv,hg.contentHash]).slice(0,24)}`,source:{surface:"desktop",experience:"work",opaqueRef:I5(["fixture-session","fixture-turn"]),revisionHash:dv},agentSnapshot:{id:"fixture-agent-snapshot",contentHash:Kt("fixture-agent")},model:{provider:"fixture",model:"scripted",revision:"1",artifactHash:null,tokenizerRevision:null,chatTemplateHash:null},runtime:{adapterId:"desktop-work",adapterVersion:"1",capabilityRef:null},inputHash:Kt("fixture prompt"),terminal:{status:"completed",failureClass:null},trace:{sanitizedRef:hg,traceHash:hg.contentHash,sanitationPolicyVersion:Pb.sanitationPolicyVersion,incomplete:!1},outputRefs:[ad],artifactRefs:[ad],validationEvidenceRefs:[hI],interventions:{approvals:0,questions:0,steeringEvents:0,otherUserInterventions:0},timing:{startedAt:nd,completedAt:pI,latencyMs:2500},usage:{promptTokens:12,completionTokens:8,totalTokens:20},costUsd:0,provenance:{consentReceiptRef:D5,consentScope:"work_process_and_artifacts",consentGrantedAt:nd,policyVersion:"openpond.work-evidence-policy.v1",projectorVersion:"openpond.desktop-work-evidence-projector.v1",disclosure:"portable_sanitized",ownershipScope:"personal",workspaceRef:null,participantPolicy:"creator_only",retention:{policy:"source_bound",deleteWithSource:!0,expiresAt:null}}}),gI=dI({schemaVersion:"openpond.workFeedbackReceipt.v1",id:`work-feedback-${Kt([yl.contentHash,"accepted"]).slice(0,24)}`,evidenceReceiptRef:T5(yl),outputRevisionRef:ad,verdict:"accepted",reasonCodes:["correct","complete"],correctionRef:null,correctedOutputRevisionRef:null,actor:"user",createdAt:"2026-08-04T12:01:00.000Z"},yl);uI({schemaVersion:"openpond.workProcessTrace.v1",sourceRevisionHash:Kt({fixture:"incomplete",revision:1}),sanitationPolicyVersion:"openpond.desktop-work-sanitizer.v1",incomplete:!0,incompleteReasons:["missing_terminal","unsupported_events_dropped"],droppedEventCount:2,steps:[xc(0,nd,"agent","state_transition","turn_started","started",{transitionState:"running"})]});fI({evidence:yl,feedback:[gI],policyState:"active",reconstructability:{input:!0,environment:!0,verifier:!0}});fI({evidence:yl,feedback:[gI],policyState:"revoked",reconstructability:{input:!0,environment:!0,verifier:!0}});({...yl,source:{...yl.source}});function xc(e,t,a,i,s,u,d){return{sequence:e,timestamp:t,layer:a,kind:i,action:s,status:u,inputHash:d.inputHash??null,outputHash:d.outputHash??null,receiptHash:d.receiptHash??null,parentReceiptHash:d.parentReceiptHash??null,artifactRefs:d.artifacts??[],attributes:{toolCategory:d.toolCategory??null,validationKind:d.validationKind??null,transitionState:d.transitionState??null,interventionOutcome:null,artifactCount:d.artifacts?.length??0,exitCode:null,durationMs:null,cpuTimeMs:null,memoryPeakBytes:null,errorClass:null}}}const L5=v({schemaVersion:N("openpond.graderEvidence.v1"),graderId:it,graderVersion:l().trim().min(1).max(100),score:S().min(0).max(1).nullable(),passed:z(),rewardEligible:z(),failureClass:Tf.nullable(),feedback:x(l().max(2e4)).max(1e3),visibleEvidenceRefs:x(it).max(1e4),privilegedEvidenceRefs:x(it).max(1e4)}).strict();L5.extend({contentHash:mt}).strict();const H5=l().trim().min(1).max(1e5),$5=I(["no_training","sft","preference","rl"]),q5=v({kind:I(["none","demonstrations","chosen_rejected","scalar_reward"]),strength:I(["absent","weak","usable"]),calibrated:z(),confounded:z(),variance:S().finite().nonnegative().nullable(),evidenceRefs:x(ht).max(1e5)}).strict(),vI=v({schemaVersion:N("openpond.modelImprovementQualificationReceipt.v1"),id:it,review:ht,harnessRelease:ht,tasksetRelease:ht.nullable(),baselineEvaluation:ht.nullable(),model:Yc,environmentHash:mt.nullable(),toolContractHash:mt.nullable(),permissionContractHash:mt.nullable(),policyHash:mt.nullable(),verifierRef:ht.nullable(),sourcePolicies:x(Tb).max(1e4),trainingEvidenceRefs:x(ht).max(1e5),frozenEvaluationEvidenceRefs:x(ht).max(1e5),privacyApproval:ht.nullable(),budgetApproval:ht.nullable(),maximumCostUsd:S().finite().nonnegative(),signal:q5,decision:$5,reasons:x(H5).min(1).max(100),createdAt:tn,metadata:ko}).strict().superRefine((e,t)=>{const a=new Set(e.trainingEvidenceRefs.map(w_));if(e.frozenEvaluationEvidenceRefs.some(s=>a.has(w_(s)))&&t.addIssue({code:"custom",message:"frozen Evaluation evidence cannot be used as training evidence",path:["frozenEvaluationEvidenceRefs"]}),e.decision==="no_training")return;(!e.tasksetRelease||!e.baselineEvaluation||!e.environmentHash||!e.toolContractHash||!e.permissionContractHash||!e.policyHash||!e.verifierRef||!e.privacyApproval||!e.budgetApproval||e.sourcePolicies.length===0||e.sourcePolicies.some(s=>s.state!=="authorized")||e.trainingEvidenceRefs.length===0||e.signal.strength!=="usable"||!e.signal.calibrated||e.signal.confounded)&&t.addIssue({code:"custom",message:"qualified model improvement requires frozen lineage, authorized signal, privacy, and budget gates"}),e.decision==="sft"&&e.signal.kind!=="demonstrations"&&t.addIssue({code:"custom",message:"SFT qualification requires demonstration signal",path:["signal","kind"]}),e.decision==="preference"&&e.signal.kind!=="chosen_rejected"&&t.addIssue({code:"custom",message:"preference qualification requires chosen/rejected signal",path:["signal","kind"]}),e.decision==="rl"&&(e.signal.kind!=="scalar_reward"||e.signal.variance===null||e.signal.variance<=0)&&t.addIssue({code:"custom",message:"RL qualification requires a usable scalar reward with variance",path:["signal"]})}),B5=vI.extend({contentHash:mt}).strict();function bI(e){const t=vI.parse(e);return B5.parse({...t,contentHash:Kt(t)})}function w_(e){return`${e.id}:${e.contentHash}`}const Cd="2026-08-08T12:00:00.000Z",yI=Zn("harness-release"),SI={policy:Zn("source-policy"),state:"authorized",checkedAt:Cd},Sl=(e,t)=>({evidence:Zn(e),kind:t,sourceRef:`source-${e}`,sourcePolicy:SI,occurrenceKey:Kt(`occurrence-${e}`),occurredAt:Cd}),V5={cursor:Kt("review-watermark"),throughCreatedAt:Cd},Uf=(e,t=3)=>({fingerprint:Kt(`claim-${e}`),recurrenceFamily:e,statement:`The ${e} behavior remains unresolved after smaller-layer triage.`,independentOccurrences:t,unresolvedOccurrences:t}),Lf=xd({schemaVersion:"openpond.harnessEvaluationReviewReceipt.v1",id:"review-no-action",ownerScope:{kind:"personal",id:"owner-1"},workspaceRef:"workspace-1",harnessRelease:yI,previousWatermark:null,nextWatermark:V5,selectedEvidence:[],excludedEvidence:[],claim:null,classification:"no_action",triage:[],reason:"The bounded evidence window contains no unresolved reusable claim.",nextAuthority:"none",maxEstimatedCostUsd:0,tasksetProposal:null,evaluation:null,trainingQualification:null,policyVersion:"harness-review-policy-v1",createdAt:Cd,metadata:{}});xd({...Id(Lf),id:"review-runtime",selectedEvidence:[Sl("runtime-failure","observation")],claim:Uf("runtime-transport-failure",1),classification:"runtime",triage:[{layer:"runtime",status:"unresolved",reason:"The adapter failed before model policy could affect the result.",evidenceRefs:[Zn("runtime-failure")]}],reason:"A deterministic runtime regression is the smallest correct fix.",nextAuthority:"runtime_service"});xd({...Id(Lf),id:"review-product",selectedEvidence:[Sl("product-routing","route_decision")],claim:Uf("product-routing-defect",1),classification:"product",triage:[{layer:"product",status:"unresolved",reason:"The product selected an unrelated Skill for an ordinary Work turn.",evidenceRefs:[Zn("product-routing")]}],reason:"Product routing must be corrected before behavioral Evaluation.",nextAuthority:"product_team"});const F5=xd({...Id(Lf),id:"review-taskset",selectedEvidence:[Sl("failure-1","work_outcome"),Sl("failure-2","work_outcome"),Sl("failure-3","work_outcome")],claim:Uf("search-budget-allocation"),classification:"taskset",triage:[{layer:"harness",status:"unresolved",reason:"The active research Skill did not resolve three independent failures.",evidenceRefs:[Zn("failure-1"),Zn("failure-2"),Zn("failure-3")]}],reason:"The repeated behavioral claim now needs controlled measurement.",nextAuthority:"human_review",tasksetProposal:Zn("taskset-proposal"),maxEstimatedCostUsd:2}),K5=bI({schemaVersion:"openpond.modelImprovementQualificationReceipt.v1",id:"qualification-rl-blocked",review:mv(F5),harnessRelease:yI,tasksetRelease:Zn("taskset-release"),baselineEvaluation:Zn("baseline-evaluation"),model:G5(),environmentHash:Kt("environment"),toolContractHash:Kt("tools"),permissionContractHash:Kt("permissions"),policyHash:Kt("policy"),verifierRef:Zn("verifier"),sourcePolicies:[SI],trainingEvidenceRefs:[Zn("training-evidence")],frozenEvaluationEvidenceRefs:[Zn("frozen-evidence")],privacyApproval:Zn("privacy-approval"),budgetApproval:Zn("budget-approval"),maximumCostUsd:25,signal:{kind:"scalar_reward",strength:"weak",calibrated:!0,confounded:!1,variance:0,evidenceRefs:[Zn("reward-audit")]},decision:"no_training",reasons:["The observed reward is constant and cannot support RL."],createdAt:Cd,metadata:{blockedMethod:"rl"}}),C_=bI({...Id(K5),id:"qualification-rl-qualified",signal:{kind:"scalar_reward",strength:"usable",calibrated:!0,confounded:!1,variance:.18,evidenceRefs:[Zn("reward-audit")]},decision:"rl",reasons:["The frozen baseline has usable variance and a calibrated sequential reward."]});xd({...Id(Lf),id:"review-model-improvement",selectedEvidence:[Sl("baseline-evaluation","evaluation"),Sl("qualification-rl-qualified","training_qualification")],claim:Uf("search-budget-allocation"),classification:"model_improvement",triage:[{layer:"model",status:"unresolved",reason:"Harness, runtime, product, retrieval, and tool triage left a qualified sequential policy gap.",evidenceRefs:[Zn("baseline-evaluation"),mv(C_)]}],reason:"The qualified claim may proceed to a separately approved managed-training plan.",nextAuthority:"training_system",tasksetProposal:Zn("taskset-proposal"),evaluation:Zn("baseline-evaluation"),trainingQualification:mv(C_),maxEstimatedCostUsd:25});function Zn(e){return{id:e,contentHash:Kt(e)}}function mv(e){return{id:e.id,contentHash:e.contentHash}}function Id(e){const{contentHash:t,...a}=e;return a}function G5(){return{provider:"openpond",model:"openpond-chat",revision:"model-revision-1",artifactHash:Kt("model-artifact"),tokenizerRevision:"tokenizer-1",chatTemplateHash:Kt("chat-template")}}function Z5(e,t,a){const i=new Headers;i.set("Accept","text/event-stream"),i.set("Authorization",`Bearer ${e.token}`);const s=new URL(`${e.serverUrl.replace(/\/$/,"")}/v1/events`);return a!==void 0&&Number.isSafeInteger(a)&&a>0&&s.searchParams.set("afterSequence",String(a)),{url:s.toString(),init:{headers:i,signal:t}}}function W5(e){return Math.min(500*2**Math.max(0,e),1e4)}async function Y5(e,t,a,i){_I(e);const s=e.body.getReader(),u=new TextDecoder;let d="";for(;!i?.aborted;){const{done:f,value:b}=await s.read();if(f){d+=u.decode();break}d+=u.decode(b,{stream:!0});let p=d.indexOf(`
|
|
132
|
+
`)}F4();function K4(e){const t=rf(e.parameters),a=rf(t.properties),i=qC(t.required),s=Object.fromEntries(i.map(u=>[u,Gm(a[u])]));return`${e.name}(${JSON.stringify(s)})`}function Gm(e){const t=rf(e),a=lv(t.anyOf);if(a.length)return a.map(Gm).join("|");const i=lv(t.enum);if(i.length)return i.join("|");if(t.type==="array")return[Gm(t.items)];if(t.type==="object"){const s=rf(t.properties),u=qC(t.required);return Object.fromEntries(u.map(d=>[d,Gm(s[d])]))}return typeof t.type=="string"?t.type:"unknown"}function rf(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function lv(e){return Array.isArray(e)?e:[]}function qC(e){return lv(e).filter(t=>typeof t=="string")}const sf=I(L4),G4=Ja("kind",[v({kind:N("model"),turn:S().int().nonnegative(),content:l().max(1e5)}),v({kind:N("tool_call"),turn:S().int().nonnegative(),callId:l().trim().min(1).max(240),name:sf,arguments:$e(l(),Fe())}),v({kind:N("tool_result"),turn:S().int().nonnegative(),callId:l().trim().min(1).max(240),name:sf,ok:z(),result:Fe(),rows:S().int().nonnegative(),bytes:S().int().nonnegative(),durationMs:S().int().nonnegative(),error:l().trim().min(1).max(2e4).nullable()}),v({kind:N("final"),turn:S().int().nonnegative(),content:l().max(1e5)})]),Z4=v({schemaVersion:N(xb),id:l().trim().min(1).max(240),worldId:l().trim().min(1).max(240),taskId:l().trim().min(1).max(240),toolContractHash:N(_d),modelRef:v({providerId:l().trim().min(1),modelId:l().trim().min(1)}).nullable(),status:I(["completed","budget_exhausted","cancelled","infrastructure_failure"]),steps:x(G4).max(1e3),startedAt:l().trim().min(1),completedAt:l().trim().min(1),infrastructureError:l().trim().min(1).max(2e4).nullable(),metadata:$e(l(),Fe()).default({})}),W4=v({schemaVersion:N(xb),trajectoryId:l().trim().min(1).max(240),outcome:I(["correct","incorrect","parse_failure","budget_exhausted","tool_schema_violation","infrastructure_failure","cancelled"]),reward:S().min(0).max(1.15).nullable(),rewardEligible:z(),exactAnswer:z(),components:v({exactAnswer:S().min(0).max(1),efficiency:S().min(0).max(.1),conciseOutput:S().min(0).max(.05)}),metrics:v({toolCalls:S().int().nonnegative(),rowsRead:S().int().nonnegative(),bytesRead:S().int().nonnegative(),consecutiveRetrievalCalls:S().int().nonnegative(),wallTimeMs:S().int().nonnegative(),parseFailures:S().int().nonnegative(),budgetExhausted:z()}),parsedAnswer:Fe().nullable(),feedback:x(l().trim().min(1).max(5e3)).max(100)}),Y4=v({id:l().trim().min(1).max(240),type:N("function"),function:v({name:sf,arguments:l().max(2e4)})}),BC=v({role:I(["system","user","assistant","tool"]),content:l().max(2e5).nullable(),tool_call_id:l().trim().min(1).max(240).optional(),tool_calls:x(Y4).max(4).optional()});v({schemaVersion:N(xb),id:l().trim().min(1).max(240),taskId:l().trim().min(1).max(240),worldId:l().trim().min(1).max(240),trajectoryId:l().trim().min(1).max(240),toolContractHash:N(_d),approval:v({status:N("approved"),approvedBy:l().trim().min(1).max(240),approvedAt:l().trim().min(1)}),messages:x(BC).min(3).max(1e3)});const J4=v({tasksetTaskId:l().trim().min(1).max(240),environmentTaskId:l().trim().min(1).max(240),family:I(["renewal_exposure","collections_prioritization","invoice_reconciliation","sla_escalation","contract_billing_mismatch"]),prompt:l().trim().min(1).max(1e5),finalAnswer:l().trim().min(1).max(2e5),trajectoryId:l().trim().min(1).max(240),trajectoryHash:l().trim().min(8).max(256),toolNames:x(sf).min(1).max(100),toolCallCount:S().int().positive(),messageCount:S().int().min(3),reward:S().min(0).max(1.15),messages:x(BC).min(3).max(1e3)}),X4=v({status:N("approved"),approvedBy:l().trim().min(1).max(240),approvedAt:l().trim().min(1),previewHash:l().trim().min(8).max(256),trajectoryCount:S().int().positive()});v({schemaVersion:N("openpond.crossSystemExpertBootstrapPreview.v1"),tasksetId:l().trim().min(1).max(240),tasksetHash:l().trim().min(8).max(256),tasksetRevision:S().int().positive(),previewHash:l().trim().min(8).max(256),toolContractHash:N(_d),status:I(["ready_for_review","approved"]),approval:X4.nullable(),tasks:x(J4).min(1).max(100)});function Q4(e){const t=cv(e);let a=2166136261,i=2654435769;for(let s=0;s<t.length;s+=1){const u=t.charCodeAt(s);a=Math.imul(a^u,16777619),i=Math.imul(i^u,2246822507)}return`${$C}:${b_(a)}${b_(i)}`}function cv(e){return Array.isArray(e)?`[${e.map(cv).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[a])=>t.localeCompare(a)).map(([t,a])=>`${JSON.stringify(t)}:${cv(a)}`).join(",")}}`:JSON.stringify(e)}function b_(e){return(e>>>0).toString(16).padStart(8,"0")}const e3=v({schemaVersion:N("openpond.singleTurnPolicyTrajectory.v1"),id:Ke,taskId:Ke,status:I(["completed","infrastructure_failure"]),promptHash:Nt,responseText:l().max(2e6),infrastructureError:l().trim().min(1).max(1e4).nullable(),startedAt:Vt,completedAt:Vt,metadata:Sd}),t3=v({schemaVersion:N("openpond.ppoTrajectory.v1"),id:Ke,taskId:Ke,policyModelId:Ke,referenceModelId:Ke,valueModelId:Ke,steps:x(v({index:S().int().nonnegative(),observationHash:Nt,actionTokenIds:x(S().int().nonnegative()).min(1),terminated:z(),truncated:z(),reward:S(),policyLogProbability:S(),referenceLogProbability:S(),valuePrediction:S(),return:S(),advantage:S(),mask:S().min(0).max(1)})).min(1).max(1e5),createdAt:Vt}),n3=v({schemaVersion:N("openpond.exactAnswerVerifierResult.v1"),outcome:I(["correct","incorrect","parse_failure","infrastructure_failure"]),graderSetHash:Nt,score:S().min(0).max(1).nullable(),passed:z(),rewardEligible:z(),expectedAnswerHash:Nt,extractedAnswer:l().max(2e4).nullable(),feedback:x(l().trim().min(1).max(2e4)).max(1e3)}),a3=v({schemaVersion:N("openpond.rolloutTrajectoryReceipt.v1"),id:Ke,jobId:Ke,planId:Ke,tasksetId:Ke,tasksetHash:Nt,taskId:Ke,split:N("train"),correlationId:Ke,provider:Ke,providerTrace:v({invocationId:Ke,experimentId:Ke,rolloutId:Ke,runId:Ke,rowId:Ke}),optimizerMethod:I(["grpo","ppo"]).default("grpo"),evidenceLevels:v({requested:I(["trajectory","aggregate","provider_reported"]),observed:I(["trajectory","aggregate","provider_reported"]),providerReported:I(["trajectory","aggregate","provider_reported"])}).default({requested:"trajectory",observed:"trajectory",providerReported:"provider_reported"}),budgetUsage:v({rollouts:S().int().nonnegative(),environmentExecutions:S().int().nonnegative(),inputTokens:S().int().nonnegative(),outputTokens:S().int().nonnegative(),optimizerSteps:S().int().nonnegative(),costUsd:S().nonnegative()}).default({rollouts:0,environmentExecutions:0,inputTokens:0,outputTokens:0,optimizerSteps:0,costUsd:0}),environment:v({id:Ke,version:l().trim().min(1).max(256),worldId:Ke,worldHash:Nt,toolContractHash:Nt}),policy:v({modelId:Ke,checkpointId:Ke.nullable(),completionParametersHash:Nt}),status:I(["received","running","succeeded","failed"]),failureClass:I(["policy_failure","parse_failure","tool_schema_violation","budget_exhausted","cancelled","environment_failure","infrastructure_failure"]).nullable(),reward:v({eligible:z(),raw:S().min(0).max(1.15).nullable(),normalized:S().min(0).max(1).nullable(),components:$e(l(),S())}),trajectory:Ua([Z4,e3,t3]).nullable(),verifier:Ua([W4,n3]).nullable(),providerStatus:$e(l(),Fe()).default({}),receivedAt:Vt,startedAt:Vt.nullable(),completedAt:Vt.nullable(),updatedAt:Vt}),jG="dataset-exact-answer",NG="dataset-exact-answer-v1",zG="no-tools-v1",Us=I(["sft","dpo","grpo","ppo","sdft","opd","opsd","sdpo"]),jf=I(["lora","full"]),Or=I(["openpond_managed"]),o3=v({schemaVersion:N("openpond.sftRecipe.v1"),method:N("sft"),parameterization:N("lora"),baseModel:v({id:Ke,revision:l().trim().min(1).max(256),tokenizerRevision:l().trim().min(1).max(256),chatTemplateHash:Nt}),dataset:v({trainSplit:N("train"),validationSplit:I(["validation","frozen_eval"]),completionOnly:z(),maxSequenceLength:S().int().positive().max(32768),maxExamples:S().int().positive().max(1e5).default(1e3),selectionStrategy:N("stable_hash_top_n").default("stable_hash_top_n"),selectionSeed:S().int().default(17)}),lora:v({rank:S().int().positive().max(256),alpha:S().positive().max(1024),dropout:S().min(0).max(1),targetModules:x(Ke).min(1).max(100)}),optimizer:v({learningRate:S().positive(),epochs:S().positive().max(100),maxSteps:S().int().positive().max(1e6),batchSize:S().int().positive().max(1e4),gradientAccumulationSteps:S().int().positive().max(1e4),seed:S().int()}),resourceLimits:v({cpuThreads:S().int().positive().max(256),memoryBytes:S().int().positive(),wallTimeMs:S().int().positive()})});v({id:Ke,input:$e(l(),Fe()),expectedOutput:$e(l(),Fe()),tags:x(Ke).max(100).default([])});v({id:Ke,prompt:l().min(1).max(5e5),chosen:l().min(1).max(5e5),rejected:l().min(1).max(5e5),sourceRefs:x(Ke).min(1).max(1e4)});v({id:Ke,input:$e(l(),Fe()),tags:x(Ke).max(100).default([])});const i3=v({schemaVersion:N("openpond.rftRecipe.v1"),method:N("grpo"),parameterization:N("lora"),baseModel:v({id:Ke,revision:l().trim().min(1).max(256),tokenizerRevision:l().trim().min(1).max(256),chatTemplateHash:Nt}),dataset:v({trainSplit:N("train"),validationSplit:I(["validation","frozen_eval"]),maxPromptTokens:S().int().positive().max(32768),maxExamples:S().int().positive().max(1e5).default(1e3),selectionStrategy:I(["stable_hash_top_n","rft_easy_curriculum_v1"]).default("stable_hash_top_n")}),lora:v({rank:S().int().positive().max(256)}),rollout:v({groupSize:S().int().min(2).max(64),concurrency:S().int().positive().max(32),maxTurns:S().int().positive().max(100),maxOutputTokens:S().int().positive().max(8192),temperature:S().min(0).max(2),topP:S().positive().max(1),seed:S().int()}),optimizer:v({learningRate:S().positive(),maxSteps:S().int().positive().max(1e5)}),loss:v({method:DC.default("grpo"),klBeta:S().min(0).nullable().default(null)}).default({method:"grpo",klBeta:null}),reward:v({graderId:Ke,graderHash:Nt,environmentId:Ke,environmentVersion:l().trim().min(1).max(256),toolContractHash:Nt}),resourceLimits:v({wallTimeMs:S().int().positive().max(1440*60*1e3),maxRollouts:S().int().positive().max(1e5),maxPayloadBytes:S().int().positive().max(10*1024*1024)}),policyOptimization:LC.nullable().default(null)}),r3=v({schemaVersion:N("openpond.dpoRecipe.v1"),method:N("dpo"),parameterization:N("lora"),policyModel:ed,referenceModel:ed,dataset:v({trainSplit:N("train"),validationSplit:I(["validation","frozen_eval"]),maxPairs:S().int().positive().max(1e5),maxPromptTokens:S().int().positive().max(32768),maxCompletionTokens:S().int().positive().max(32768),selectionStrategy:N("stable_hash_top_n"),selectionSeed:S().int()}),lora:v({rank:S().int().positive().max(256),alpha:S().positive().max(1024),dropout:S().min(0).max(1),targetModules:x(Ke).min(1).max(100)}),loss:v({variant:N("sigmoid"),beta:S().positive().max(10),labelSmoothing:S().min(0).max(.5).default(0)}),optimizer:v({learningRate:S().positive(),epochs:S().positive().max(100),maxSteps:S().int().positive().max(1e6),batchSize:S().int().positive().max(1e4),gradientAccumulationSteps:S().int().positive().max(1e4),seed:S().int()}),referenceLogprobs:v({cacheSchemaVersion:N("openpond.dpoReferenceLogprobs.v1"),cacheKey:Nt,invalidationHash:Nt}),resourceLimits:v({cpuThreads:S().int().positive().max(256),memoryBytes:S().int().positive(),wallTimeMs:S().int().positive()})}),s3=v({schemaVersion:N("openpond.ppoRecipe.v1"),method:N("ppo"),parameterization:N("lora"),policyOptimization:LC.extend({optimizer:UC}),lora:v({rank:S().int().positive().max(256),alpha:S().positive().max(1024),dropout:S().min(0).max(1),targetModules:x(Ke).min(1).max(100)}),valueHead:v({initialization:N("policy_hidden_state_linear"),optimizerLearningRate:S().positive(),artifactName:N("value_head.safetensors")}),policyLearningRate:S().positive(),resume:v({checkpointId:Ke.nullable(),policyHash:Nt,referenceHash:Nt,valueModelHash:Nt,optimizerStateHash:Nt.nullable()}),resourceLimits:v({cpuThreads:S().int().positive().max(256),memoryBytes:S().int().positive(),wallTimeMs:S().int().positive()})}),l3=v({schemaVersion:N("openpond.unsupportedRecipe.v1"),method:Us.exclude(["sft","dpo","grpo","ppo"]),parameterization:jf,unsupportedReason:l().trim().min(1).max(5e3)}),wb=Ua([o3,r3,i3,s3,l3]),c3=v({schemaVersion:N("openpond.trainingDestinationCapabilities.v1"),destinationId:Or,available:z(),methods:x(Us),parameterizations:x(jf),modelAllowlist:x(Ke).default([]),maxDatasetBytes:S().int().nonnegative().nullable(),environmentPlacements:x(I(["none","local","remote","colocated","provider_native"])),nonProduction:z(),unavailableReason:l().trim().min(1).max(5e3).nullable(),checkedAt:Vt}),u3=v({destinationId:Or,available:z(),methods:x(Us),parameterizations:x(jf),nonProduction:z(),unavailableReason:l().trim().min(1).max(5e3).nullable()}),d3=v({schemaVersion:N("openpond.baseModelCandidate.v1"),selectionKey:Ke,label:l().trim().min(1).max(500),sourceLabel:l().trim().min(1).max(500),preference:yd,available:z(),nonProduction:z(),unavailableReason:l().trim().min(1).max(5e3).nullable(),methods:x(Us),executionOptions:x(u3).min(1)}),m3=v({code:Ke,severity:I(["warning","error"]),path:l().trim().max(2e3).nullable(),message:l().trim().min(1).max(5e3)}),f3=v({schemaVersion:N("openpond.trainingCompatibility.v1"),compatible:z(),destinationId:Or,tasksetId:Ke,recipeMethod:Us,issues:x(m3),checkedAt:Vt}),p3=Ua([TC,I(["destination_unavailable","destination_method_unsupported","destination_model_unsupported","destination_parameterization_unsupported","experimental_destination"])]);v({method:Us,state:I(["recommended","compatible","needs_dataset_work","destination_unavailable","experimental_destination"]),reasonCodes:x(p3).default([]),reasons:x(l().trim().min(1).max(5e3)).default([]),destinationId:Or.nullable().default(null)});const h3=I(["small","standard","custom","small_experiment"]),g3=v({schemaVersion:N("openpond.modelProject.v1"),id:Ke,profileId:Ke,name:l().trim().min(1).max(200),objective:l().trim().max(5e3).nullable(),defaultBaseModel:yd.nullable(),defaultDestinationId:Or.nullable(),createdAt:Vt,updatedAt:Vt}),v3=v({schemaVersion:N("openpond.modelRunDraft.v1"),id:Ke,profileId:Ke,modelId:Ke,status:I(["draft","ready_to_run","launched","cancelled"]),title:l().trim().min(1).max(200),datasetMode:I(["existing","build"]).nullable(),tasksetRef:v({id:Ke,revision:S().int().positive(),contentHash:Nt}).nullable(),harnessRelease:Yt.nullable().optional(),tasksetRelease:Yt.nullable().optional(),datasetCreationId:Ke.nullable(),buildIntent:vb.nullable(),buildSpecification:bb.nullable(),baseModel:yd.nullable(),method:Us.nullable(),destinationId:Or.nullable(),managedRolloutPlacement:I(["local","remote"]).optional(),runPreset:h3.nullable(),recipe:wb.nullable(),createdAt:Vt,updatedAt:Vt}),VC=v({schemaVersion:N("openpond.trainingPlan.v1"),id:Ke,modelId:Ke,tasksetId:Ke,tasksetHash:Nt,harnessRelease:Yt.nullable().optional(),modelImprovementQualification:Yt.nullable().optional(),destinationId:Or,recipe:wb,environmentPlacement:I(["none","local","remote","colocated","provider_native"]),compatibility:f3,dataPolicy:v({exportApproved:z(),approvedSourceIds:x(Ke),retentionDays:S().int().nonnegative().nullable(),region:l().trim().min(1).max(200).nullable()}),estimatedCostUsd:S().nonnegative().nullable(),createdAt:Vt,contentHash:Nt}),b3=v({path:l().trim().min(1).max(2e3),sha256:Nt,sizeBytes:S().int().nonnegative(),role:I(["manifest","task_data","grader","environment","recipe","policy","provenance"])}),Cb=v({schemaVersion:N("openpond.trainingBundle.v1"),id:Ke,planId:Ke,tasksetId:Ke,tasksetHash:Nt,recipeHash:Nt,files:x(b3).min(1).max(1e6),totalSizeBytes:S().int().nonnegative(),sourceIds:x(Ke),excludedSourceIds:x(Ke),containsRawChats:N(!1),containsSecrets:N(!1),containsHiddenGraderAssets:N(!1),createdAt:Vt,contentHash:Nt});v({schemaVersion:N("openpond.trainingBundleExport.v1"),manifest:Cb,files:x(v({path:l().trim().min(1).max(2e3),sha256:Nt,sizeBytes:S().int().nonnegative(),encoding:N("base64"),content:l()})).min(1),contentHash:Nt});v({schemaVersion:N("openpond.trainingPreparedStart.v1"),plan:VC,bundle:Cb,approvalActor:Ke.nullable(),preparedAt:Vt});v({schemaVersion:N("openpond.trainingApproval.v1"),id:Ke,planId:Ke,bundleHash:Nt,harnessRelease:Yt.nullable().optional(),modelImprovementQualification:Yt.nullable().optional(),destinationId:Or,modelId:Ke,method:Us,parameterization:jf,maximumCostUsd:S().nonnegative().nullable(),approvedBy:Ke,approvedAt:Vt});const y3=I(["queued","starting","running","cancelling","cancelled","succeeded","failed","reconciling"]),FC=v({schemaVersion:N("openpond.trainingJob.v1"),id:Ke,planId:Ke,bundleHash:Nt,approvalId:Ke,destinationId:Or,status:y3,nonProduction:z(),workerPid:S().int().positive().nullable(),startedAt:Vt.nullable(),completedAt:Vt.nullable(),error:l().trim().min(1).max(2e4).nullable(),createdAt:Vt,updatedAt:Vt,metadata:Sd}),S3=v({schemaVersion:N("openpond.trainingJobEvent.v1"),id:Ke,jobId:Ke,sequence:S().int().nonnegative(),type:I(["queued","start","progress","metric","checkpoint","cancel","complete","failure","reconcile"]),timestamp:Vt,payload:Sd}),_3=v({schemaVersion:N("openpond.sftStepMetric.v1"),step:S().int().nonnegative(),maxSteps:S().int().positive(),timestamp:Vt,epoch:S().nonnegative().nullable(),loss:S().nullable(),learningRate:S().nonnegative().nullable(),gradientNorm:S().nonnegative().nullable(),entropy:S().nonnegative().nullable(),meanTokenAccuracy:S().min(0).max(1).nullable(),preferenceAccuracy:S().min(0).max(1).nullable().default(null),preferenceMargin:S().nullable().default(null),chosenReward:S().nullable().default(null),rejectedReward:S().nullable().default(null),chosenLogProbability:S().nullable().default(null),rejectedLogProbability:S().nullable().default(null),reward:S().nullable().default(null),policyLoss:S().nullable().default(null),advantageLoss:S().nullable().default(null),inputTokensSeen:S().int().nonnegative().nullable(),memoryBytes:S().int().nonnegative().nullable(),elapsedSeconds:S().nonnegative().nullable()}),x3=v({schemaVersion:N("openpond.policyOptimizationMetric.v1"),method:I(["grpo","ppo"]),step:S().int().nonnegative(),timestamp:Vt,learningRate:S().nonnegative().nullable().default(null),policyLoss:S().nullable(),valueLoss:S().nullable(),meanReward:S().nullable(),meanReturn:S().nullable(),kl:S().nullable(),entropy:S().nullable(),policyClipFraction:S().min(0).max(1).nullable(),valueClipFraction:S().min(0).max(1).nullable(),explainedVariance:S().nullable(),rolloutLearnerLag:S().int().nonnegative().nullable(),inputTokens:S().int().nonnegative(),outputTokens:S().int().nonnegative(),environmentExecutions:S().int().nonnegative(),costUsd:S().nonnegative().nullable()}),k3=v({schemaVersion:N("openpond.managedTrainingRunEvidence.v1"),provider:Ke,providerRunId:Ke,state:Ke,progress:v({targetOptimizerSteps:S().int().nonnegative(),committedOptimizerSteps:S().int().nonnegative()}),reward:v({finalMean:S().nullable(),trajectoryCount:S().int().nonnegative(),eligibleTrajectoryCount:S().int().nonnegative()}),usage:v({inputTokens:S().int().nonnegative(),outputTokens:S().int().nonnegative(),environmentExecutions:S().int().nonnegative()}),resource:v({provider:Ke,gpuType:l().trim().min(1).max(300).nullable(),gpuCount:S().int().nonnegative().nullable(),hourlyCostUsd:S().nonnegative().nullable()}),cost:v({totalUsd:S().nonnegative().nullable()}),checkpoint:v({id:Ke,policyVersion:S().int().nonnegative(),sha256:Nt.nullable(),sizeBytes:S().int().nonnegative().nullable()}).nullable(),evaluations:x(v({kind:I(["baseline","candidate"]),policyVersion:S().int().nonnegative(),score:S().nullable(),threshold:S().nullable(),passed:z().nullable()})),canonicalPublication:v({state:Ke.nullable(),artifactId:Ke.nullable()}),syncedAt:Vt}),y_=v({count:S().int().nonnegative(),scoredCount:S().int().nonnegative(),meanScore:S().min(0).max(1).nullable(),passedCount:S().int().nonnegative(),passRate:S().min(0).max(1).nullable()}),S_=v({status:I(["scored","unavailable"]),score:S().min(0).max(1).nullable(),passed:z(),rewardEligible:z(),failureClass:I(["policy_failure","grader_failure","environment_failure","infrastructure_failure","timeout","cancelled"]).nullable(),feedback:x(l().trim().min(1).max(2e4)).max(1e3),components:x(v({graderId:Ke,score:S().min(0).max(1),passed:z(),feedback:l().trim().max(2e4).nullable()})).max(1e3)}),w3=v({taskId:Ke,input:$e(l(),Fe()),baseOutput:$e(l(),Fe()).nullable(),trainedOutput:$e(l(),Fe()).nullable(),baseGrade:S_.nullable(),trainedGrade:S_.nullable()}),C3=v({schemaVersion:N("openpond.trainingEvaluationSummary.v1"),jobId:Ke,tasksetId:Ke,base:y_,trained:y_,meanScoreDelta:S().min(-1).max(1).nullable(),examples:x(w3).max(1e6)});v({schemaVersion:N("openpond.trainingRunDetail.v1"),job:FC,events:x(S3),stepMetrics:x(_3),policyMetrics:x(x3).default([]),managedEvidence:k3.nullable().default(null),evaluation:C3.nullable(),generatedAt:Vt});const I3=v({schemaVersion:N("openpond.trainingArtifact.v1"),id:Ke,jobId:Ke,kind:I(["adapter","checkpoint","metrics","log","manifest","evaluation"]),path:l().trim().min(1).max(4e3),sha256:Nt,sizeBytes:S().int().nonnegative(),baseModelId:Ke.nullable(),baseModelRevision:l().trim().min(1).max(256).nullable(),tokenizerRevision:l().trim().min(1).max(256).nullable(),chatTemplateHash:Nt.nullable(),nonProduction:z(),createdAt:Vt,metadata:Sd}),A3=v({schemaVersion:N("openpond.modelArtifactLineage.v1"),id:Ke,modelId:Ke,artifactId:Ke,jobId:Ke,tasksetId:Ke,tasksetHash:Nt,graderHash:Nt,planHash:Nt,bundleHash:Nt,recipeHash:Nt,workerVersion:l().trim().min(1).max(256),trainerVersion:l().trim().min(1).max(256),importedAt:Vt,frozenEvaluationArtifactId:Ke.nullable(),promotable:z(),pinned:z().default(!1),status:I(["imported","rejected"]).default("imported"),rejectedAt:Vt.nullable().default(null),rejectionReason:l().trim().min(1).max(5e3).nullable().default(null),chatConfiguration:HC.default(z4),managedServing:D4.nullable().default(null)}),R3=I(["chat_manual","agent","extension","authoring_optimizer"]),T3=v({schemaVersion:N("openpond.modelBinding.v1"),id:Ke,profileId:Ke,role:R3,roleTargetId:Ke,modelArtifactLineageId:Ke,tasksetId:Ke,evaluationArtifactId:Ke.nullable(),status:I(["active","rolled_back"]),priorBindingId:Ke.nullable(),rollbackTargetBindingId:Ke.nullable(),promotedBy:Ke,promotedAt:Vt,rolledBackAt:Vt.nullable(),metadata:Sd});v({schemaVersion:N("openpond.trainingActivity.v1"),profileId:Ke,active:z(),activeCounts:v({jobs:S().int().nonnegative(),creations:S().int().nonnegative(),minerRuns:S().int().nonnegative(),datasetImports:S().int().nonnegative()}),revision:Nt,generatedAt:Vt});v({schemaVersion:N("openpond.trainingState.v1"),profileId:Ke,sources:x(vC),creations:x(PC),tasksets:x(h_),benchmarkRuns:x(Dh()).default([]),benchmarkComparisons:x(Dh()).default([]),datasetImports:x(S4).default([]),datasetArtifacts:x(SU).default([]),graderAuditReports:x(o4),evaluationResults:x(Dh()).default([]),candidates:x(fC),minerConfig:Mf,minerRuns:x(gU).default([]),modelProjects:x(g3).default([]),modelRunDrafts:x(v3).default([]),modelVersions:x(C4).default([]),modelRuns:x(P4).default([]),modelTasksets:x(h_).default([]),plans:x(VC),bundles:x(Cb),jobs:x(FC),artifacts:x(I3),models:x(A3),rolloutReceipts:x(a3).default([]),modelBindings:x(T3).default([]),destinations:x(c3),baseModelCandidates:x(d3).default([]),activityRevision:Nt.optional(),generatedAt:Vt});const E3=I(["trajectory","reward","demonstration","preference","correction","critique","targeted_feedback","grader_evidence","infrastructure_failure"]),M3=v({datasetRelease:Yt,harnessRelease:Yt,evidenceSetRelease:Yt.nullable(),profileRelease:Yt.nullable(),model:v({source:l().trim().min(1).max(200),revision:l().trim().min(1).max(500),artifactHash:ft.nullable()}).strict(),environmentHash:ft,graderHash:ft,toolContractHash:ft,verificationReceiptHash:ft.nullable()}).strict(),jr=v({schemaVersion:N("openpond.learningSignal.v1"),id:rt,taskId:rt.nullable(),episodeId:rt.nullable(),policyVersion:S().int().nonnegative().nullable(),lineage:M3,approved:z(),verifier:I(["deterministic","model_judge","human","none"]),createdAt:Wn,contentHash:ft,metadata:$e(l(),Fe()).default({})}).strict(),P3=v({schemaVersion:N("openpond.optimizerTrainingSample.v1"),tokenIds:x(S().int().nonnegative()).min(2).max(32768),mask:x(z()).min(2).max(32768),logprobs:x(S().finite()).min(2).max(32768),temperatures:x(S().positive().finite()).min(2).max(32768),envName:l().trim().min(1).max(200),modelRequestId:l().trim().min(1).max(1e3),promptTokenCount:S().int().positive(),completionTokenCount:S().int().positive(),servedPolicyVersion:S().int().nonnegative()}).strict().superRefine((e,t)=>{const a=e.tokenIds.length;for(const[i,s]of[["mask",e.mask],["logprobs",e.logprobs],["temperatures",e.temperatures]])s.length!==a&&t.addIssue({code:"custom",path:[i],message:`${i} must align with tokenIds`});e.promptTokenCount+e.completionTokenCount!==a&&t.addIssue({code:"custom",path:["completionTokenCount"],message:"prompt and completion token counts must span tokenIds"}),e.mask.filter(i=>!i).length!==e.promptTokenCount&&t.addIssue({code:"custom",path:["mask"],message:"promptTokenCount must equal the non-trainable mask count"}),e.mask.filter(i=>i).length!==e.completionTokenCount&&t.addIssue({code:"custom",path:["mask"],message:"completionTokenCount must equal the trainable mask count"})}),O3=jr.extend({kind:N("trajectory"),payload:v({traceRef:l().trim().min(1).max(2e3),traceHash:ft,terminal:z(),failureClass:I(["policy_failure","grader_failure","environment_failure","infrastructure_failure","timeout","cancelled"]).nullable(),optimizerSample:P3.nullable().optional()}).strict()}).strict(),j3=jr.extend({kind:N("reward"),payload:v({reward:S().finite(),components:$e(l(),S().finite()),eligible:z(),graderEvidenceRefs:x(rt).max(1e3)}).strict()}).strict(),N3=jr.extend({kind:N("demonstration"),payload:v({prompt:l().max(5e5),response:l().max(1e6)}).strict()}).strict(),z3=jr.extend({kind:N("preference"),payload:v({prompt:l().max(5e5),chosen:l().max(1e6),rejected:l().max(1e6),rationale:l().max(5e5).nullable()}).strict()}).strict(),D3=jr.extend({kind:N("correction"),payload:v({original:l().max(1e6),corrected:l().max(1e6),rationale:l().max(5e5).nullable()}).strict()}).strict(),U3=jr.extend({kind:N("critique"),payload:v({response:l().max(1e6),critique:l().max(5e5),severity:I(["note","warning","error"])}).strict()}).strict(),L3=jr.extend({kind:N("targeted_feedback"),payload:v({turnIndex:S().int().nonnegative(),target:I(["reasoning","tool","answer","policy"]),feedback:l().max(5e5)}).strict()}).strict(),H3=jr.extend({kind:N("grader_evidence"),payload:v({graderId:rt,score:S().finite().nullable(),passed:z(),privilegedArtifactRefs:x(l().trim().min(1).max(2e3))}).strict()}).strict(),$3=jr.extend({kind:N("infrastructure_failure"),approved:N(!1),verifier:N("none"),payload:v({code:rt,phase:rt,retryable:z(),rewardEligible:N(!1)}).strict()}).strict(),KC=Ja("kind",[O3,j3,N3,z3,D3,U3,L3,H3,$3]);v({schemaVersion:N("openpond.learningSignalBatch.v1"),manifestId:rt,manifestHash:ft,sequence:S().int().nonnegative(),signals:x(KC).min(1).max(1e5),contentHash:ft}).strict();const Ib=v({adapterId:rt,placement:I(["local","remote","colocated","provider_native"]),capabilityReceipt:ft,runtimeVersion:l().trim().min(1).max(200),dataPlane:v({provider:rt,dataPlaneId:rt,cellId:rt,runnerPoolId:rt,runtimeImageDigest:l().regex(/^sha256:[a-f0-9]{64}$/),capabilityReceipt:ft}).strict().nullable()}).strict(),Ab=v({adapterId:rt,kind:I(["local","ssh","managed","custom"]),deviceOrPool:l().trim().min(1).max(1e3),capabilityReceipt:ft,provider:rt.nullable()}).strict(),Rb=v({adapterId:rt,workerVersion:l().trim().min(1).max(200),workerImageDigest:l().regex(/^sha256:[a-f0-9]{64}$/).nullable(),upstreamRevision:l().trim().min(1).max(500),capabilityReceipt:ft}).strict(),q3=v({schemaVersion:N("openpond.harnessRunManifest.v1"),id:rt,harnessRelease:Yt,datasetRelease:Yt,evidenceSets:x(Yt).max(1e4),model:v({source:l().trim().min(1).max(200),revision:l().trim().min(1).max(500),artifactHash:ft.nullable(),tokenizerRevision:l().trim().min(1).max(500),chatTemplateHash:ft}).strict(),recipe:v({method:l().trim().min(1).max(100),version:l().trim().min(1).max(200),configHash:ft}).strict(),runtimeTarget:Ib,computeTarget:Ab,engine:Rb,resolvedBundleHash:ft,secretLeaseRefs:x(OU).max(1e3),approval:v({approvalHash:ft,approvedAt:Wn,maximumSpendUsd:S().nonnegative().nullable()}).strict(),createdAt:Wn}).strict(),B3=q3.extend({contentHash:ft}).strict(),V3=v({schemaVersion:N("openpond.resolvedTrainingBundle.v1"),projection:N("trainer"),harnessRelease:Yt,datasetRelease:Yt,evidenceSetRelease:Yt.nullable(),files:x(v({path:l().trim().min(1).max(2e3),sha256:ft,sizeBytes:S().int().nonnegative()}).strict()).max(1e5)}).strict();V3.extend({contentHash:ft}).strict();const F3=v({id:rt,turn:S().int().nonnegative(),kind:I(["message","tool_call","terminal"]),name:rt.nullable(),arguments:$e(l(),Fe()),content:l().max(1e6).nullable(),contentHash:ft}).strict(),K3=v({actionId:rt,turn:S().int().nonnegative(),terminal:z(),output:$e(l(),Fe()),artifactRefs:x(l().trim().min(1).max(2e3)),contentHash:ft}).strict(),G3=v({sequence:S().int().nonnegative(),type:I(["created","reset","action","observation","terminal","graded","feedback","failure","collected","destroyed"]),timestamp:Wn,payloadHash:ft,metadata:$e(l(),Fe()).default({})}).strict(),__=v({graderId:rt,graderVersion:l().trim().min(1).max(200),score:S().finite().nullable(),passed:z(),rewardEligible:z(),failureClass:I(["policy_failure","grader_failure","environment_failure","infrastructure_failure","timeout","cancelled"]).nullable(),feedback:x(l().max(5e5)),visibleEvidenceRefs:x(l().trim().min(1).max(2e3)),privilegedEvidenceRefs:x(l().trim().min(1).max(2e3)),contentHash:ft}).strict();v({schemaVersion:N("openpond.harnessRunTrace.v1"),manifest:Yt,taskId:rt,seed:l().trim().min(1).max(500),events:x(G3).max(1e6),actions:x(F3).max(1e5),observations:x(K3).max(1e5),graderEvidence:x(__).max(1e4),learningSignals:x(KC).max(1e5),terminal:z(),failureClass:__.shape.failureClass,artifactHash:ft,contentHash:ft}).strict();const Os=l().trim().min(1).max(1e5),Z3=I(["no_action","harness_maintenance","runtime","product","taskset","model_improvement"]),W3=I(["none","runtime_service","product_team","human_review","evaluation_system","training_system"]),GC=I(["observation","trigger","route_decision","refiner_outcome","proposal","validation","apply_receipt","harness_advance","rollback","work_outcome","taskset","evaluation","training_qualification","model_candidate"]),Y3=v({kind:I(["personal","team"]),id:it}).strict(),Tb=v({policy:ht,state:I(["authorized","revoked","deleted","expired"]),checkedAt:tn}).strict(),J3=v({evidence:ht,kind:GC,sourceRef:it,sourcePolicy:Tb,occurrenceKey:mt,occurredAt:tn}).strict(),X3=v({evidence:ht,sourcePolicy:Tb.nullable(),reason:I(["outside_scope","before_watermark","duplicate","resolved","revoked","deleted","expired","sensitive","unverified","budget"])}).strict(),x_=v({cursor:mt,throughCreatedAt:tn}).strict(),Q3=v({fingerprint:mt,recurrenceFamily:l().trim().min(1).max(1e3),statement:Os,independentOccurrences:S().int().positive().max(1e6),unresolvedOccurrences:S().int().positive().max(1e6)}).strict().refine(e=>e.unresolvedOccurrences<=e.independentOccurrences,"unresolved occurrences cannot exceed independent occurrences"),ZC=I(["harness","runtime","product","retrieval","tools","evaluation","model"]),eL=v({layer:ZC,status:I(["not_applicable","unresolved","resolved","blocked"]),reason:Os,evidenceRefs:x(ht).max(1e3)}).strict(),WC=v({schemaVersion:N("openpond.harnessEvaluationReviewReceipt.v1"),id:it,ownerScope:Y3,workspaceRef:it,harnessRelease:ht,previousWatermark:x_.nullable(),nextWatermark:x_,selectedEvidence:x(J3).max(1e4),excludedEvidence:x(X3).max(1e4),claim:Q3.nullable(),classification:Z3,triage:x(eL).max(16),reason:Os,nextAuthority:W3,maxEstimatedCostUsd:S().finite().nonnegative(),tasksetProposal:ht.nullable(),evaluation:ht.nullable(),trainingQualification:ht.nullable(),policyVersion:it,createdAt:tn,metadata:ko}).strict().superRefine((e,t)=>{const a=e.selectedEvidence.map(i=>`${i.evidence.id}:${i.evidence.contentHash}`);new Set(a).size!==a.length&&t.addIssue({code:"custom",message:"selected review evidence must be unique",path:["selectedEvidence"]}),e.selectedEvidence.some(i=>i.sourcePolicy.state!=="authorized")&&t.addIssue({code:"custom",message:"selected review evidence must be authorized at review time",path:["selectedEvidence"]}),e.classification==="no_action"?(e.nextAuthority!=="none"&&t.addIssue({code:"custom",message:"no-action review receipts require no next authority",path:["nextAuthority"]}),(e.tasksetProposal||e.evaluation||e.trainingQualification)&&t.addIssue({code:"custom",message:"no-action review receipts cannot carry downstream refs"})):(!e.claim||e.selectedEvidence.length===0)&&t.addIssue({code:"custom",message:"actionable review receipts require a claim and selected evidence"}),e.classification==="runtime"&&e.nextAuthority!=="runtime_service"&&t.addIssue({code:"custom",message:"runtime classifications route to runtime-service authority",path:["nextAuthority"]}),e.classification==="product"&&e.nextAuthority!=="product_team"&&t.addIssue({code:"custom",message:"product classifications route to product-team authority",path:["nextAuthority"]}),e.classification==="taskset"&&e.nextAuthority!=="human_review"&&t.addIssue({code:"custom",message:"Taskset classifications require human review"}),e.classification==="model_improvement"&&(!e.evaluation||!e.trainingQualification||!["human_review","training_system"].includes(e.nextAuthority))&&t.addIssue({code:"custom",message:"model-improvement classifications require Evaluation and qualification refs plus explicit authority"})}),tL=WC.extend({contentHash:mt}).strict();function xd(e){const t=WC.parse(e);return tL.parse({...t,contentHash:Kt(t)})}v({id:it,evidence:ht,kind:GC,sourceRef:it,occurredAt:tn,payload:$e(l(),Fe())}).strict();const nL=v({schemaVersion:N("openpond.harnessEvaluationReviewModelDecision.v1"),decision:N("no_action"),reason:Os,ignoredEvidence:x(v({id:it,reason:l().trim().min(1).max(2e3)}).strict()).max(1e3)}).strict(),aL=v({schemaVersion:N("openpond.harnessEvaluationReviewModelDecision.v1"),decision:N("review"),classification:I(["harness_maintenance","runtime","product","taskset"]),selectedEvidenceIds:x(it).min(1).max(1e3),ignoredEvidence:x(v({id:it,reason:l().trim().min(1).max(2e3)}).strict()).max(1e3),recurrenceFamily:l().trim().min(1).max(1e3),statement:Os,triageLayer:ZC,expectedOutcome:Os,counterevidence:l().trim().max(1e4),confidence:S().min(0).max(1),reason:Os}).strict();Ja("decision",[nL,aL]);v({schemaVersion:N("openpond.harnessEvaluationReviewNavigationDecision.v1"),selectedEvidenceIds:x(it).min(1).max(50),reason:Os}).strict();const Nf=v({name:l().trim().min(1).max(64).regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/),description:l().trim().min(1).max(2e3),inputSchema:$e(l(),Fe()),inputSchemaHash:mt,sideEffect:I(["read","write"]),timeoutMs:S().int().positive().max(36e5)}).strict(),Eb=v({id:it,required:z(),scopes:x(l().trim().min(1).max(500)).max(100).default([]),portability:I(["portable","host_adapter","local_only","hosted_only"])}).strict(),oL=v({portable:z(),blockers:x(l().trim().min(1).max(2e3)).max(1e3),localOnlyAssetRefs:x(it).max(1e4),hostPrivateAssetRefs:x(it).max(1e4)}).strict(),iL=v({schemaVersion:N("openpond.agentSnapshot.v2"),id:it,sourceRelease:ht.nullable(),instructions:x(Vi).max(1e4),skills:x(Vi).max(1e4),agents:x(Vi).max(1e4),toolDeclarations:x(Nf).max(200),capabilityRequirements:x(Eb).max(200),dependencyLock:Vi,portability:oL,metadata:ko}).strict();iL.extend({contentHash:mt}).strict();const YC=v({create:N(!0),reset:N(!0),step:N(!0),collect:N(!0),destroy:N(!0),resetScope:I(["task","attempt"])}).strict(),JC=v({visibleEvidence:x(it).max(1e3),privilegedEvidence:x(it).max(1e3),privateVerifierIsolation:z()}).strict(),rL=v({schemaVersion:N("openpond.harnessRelease.v2"),id:it,agentSnapshot:ht,program:Vi,tools:x(Nf).max(200),lifecycle:YC,graderInterface:JC,files:x(Vi).max(1e5),metadata:ko}).strict();rL.extend({contentHash:mt}).strict();const sL=v({id:it,turn:S().int().nonnegative(),kind:I(["message","tool_call","terminal"]),name:it.nullable(),arguments:$e(l(),Fe()),content:l().max(1e6).nullable()}).strict(),lL=v({actionId:it,turn:S().int().nonnegative(),terminal:z(),output:$e(l(),Fe()),artifactRefs:x(nf).max(1e5)}).strict(),cL=v({sequence:S().int().nonnegative(),type:I(["created","reset","action","observation","terminal","failure","collected","destroyed"]),payloadHash:mt,metadata:ko}).strict();v({schemaVersion:N("openpond.harnessTrace.v1"),manifest:ht,taskId:it,seed:l().trim().min(1).max(500),events:x(cL).max(1e6),actions:x(sL).max(1e5),observations:x(lL).max(1e5),terminal:z(),failureClass:Tf.nullable(),output:$e(l(),Fe()),contentHash:mt}).strict();const zf=l().trim().min(1).max(1e5),kd=$e(l(),Fe()).default({}),uL=I(["completed_tool_batch","before_model_step","turn_completed","turn_paused"]),XC=v({kind:uL,eventSequence:S().int().nonnegative(),occurredAt:tn}).strict(),QC=v({id:it,sequence:S().int().nonnegative().nullable(),contentHash:mt}).strict(),dL=I(["tool_failure","retry","recovery","validation","user_turn","reusable_success","completion_detour"]),mL=I(["open","recovered","terminal"]),fL=v({name:l().trim().min(1).max(500),invocationKey:mt}).strict(),pL=v({schemaVersion:N("openpond.improvementObservation.v1"),id:it,runRef:it,turnId:it,harnessRelease:ht,overlay:Tr.nullable(),eventRefs:x(QC).min(1).max(100),kind:dL,state:mL,tool:fL.nullable(),deterministicClass:l().trim().min(1).max(500).nullable(),summary:zf,createdAt:tn,metadata:kd}).strict().superRefine((e,t)=>{new Set(e.eventRefs.map(a=>a.id)).size!==e.eventRefs.length&&t.addIssue({code:"custom",message:"observation event refs must be unique",path:["eventRefs"]}),["tool_failure","retry","recovery","completion_detour"].includes(e.kind)&&e.tool===null&&t.addIssue({code:"custom",message:`${e.kind} observations require a tool identity`,path:["tool"]})});pL.extend({contentHash:mt}).strict();const hL=v({schemaVersion:N("openpond.refinementTriggerPolicy.v1"),maxEstimatedCostUsd:S().finite().nonnegative(),cooldownMs:S().int().nonnegative(),maxPendingPlans:S().int().min(1).max(100),maxEvidenceEvents:S().int().min(1).max(1e3),maxProposalEdits:S().int().min(1).max(1e3),maxProposalBytes:S().int().min(1).max(1e7)}).strict(),gL=I(["no_action","route_deterministically","queue_refiner"]),vL=v({schemaVersion:N("openpond.refinementTriggerDecision.v1"),id:it,runRef:it,turnId:it,harnessRelease:ht,overlay:Tr.nullable(),observations:x(ht).max(100),decision:gL,deterministicRoute:Qu.nullable(),suggestedRoutes:x(Qu).max(8),reason:zf,deduplicationKey:mt,policy:hL,estimatedMaxCostUsd:S().finite().nonnegative(),pendingPlanCount:S().int().nonnegative(),boundary:XC,cooldownUntil:tn.nullable(),createdAt:tn,metadata:kd}).strict().superRefine((e,t)=>{e.estimatedMaxCostUsd>e.policy.maxEstimatedCostUsd&&t.addIssue({code:"custom",message:"estimated Refiner cost exceeds the trigger policy budget",path:["estimatedMaxCostUsd"]}),e.pendingPlanCount>e.policy.maxPendingPlans&&t.addIssue({code:"custom",message:"pending plan count exceeds the trigger policy limit",path:["pendingPlanCount"]}),e.observations.length>e.policy.maxEvidenceEvents&&t.addIssue({code:"custom",message:"trigger observations exceed the evidence budget",path:["observations"]}),e.decision==="route_deterministically"&&e.deterministicRoute===null&&t.addIssue({code:"custom",message:"deterministic decisions require a route",path:["deterministicRoute"]}),e.decision!=="route_deterministically"&&e.deterministicRoute!==null&&t.addIssue({code:"custom",message:"only deterministic decisions may declare a deterministic route",path:["deterministicRoute"]}),e.decision==="no_action"&&e.suggestedRoutes.length>0&&t.addIssue({code:"custom",message:"no-action decisions cannot suggest routes",path:["suggestedRoutes"]}),e.decision!=="no_action"&&e.observations.length===0&&t.addIssue({code:"custom",message:"actionable trigger decisions require observations",path:["observations"]})});vL.extend({contentHash:mt}).strict();const bL=I(["runtime_service","refiner_model","human_review","evaluation_system","training_system"]),yL=v({schemaVersion:N("openpond.improvementRouteDecision.v1"),id:it,trigger:ht,route:Qu,authority:bL,automatic:z(),reason:zf,createdAt:tn,metadata:kd}).strict().superRefine((e,t)=>{e.automatic&&["human_review","evaluation_system","training_system"].includes(e.authority)&&t.addIssue({code:"custom",message:`${e.authority} routes cannot be marked automatic`,path:["automatic"]}),e.route==="training"&&e.automatic&&e.authority!=="training_system"&&t.addIssue({code:"custom",message:"automatic training routes require training-system authority",path:["authority"]})});yL.extend({contentHash:mt}).strict();const SL=v({schemaVersion:N("openpond.harnessRefinerOutcome.v1"),id:it,trigger:ht,decision:I(["no_action","proposed"]),proposal:ht.nullable(),reason:zf,evidenceRefs:x(ht).max(100),estimatedCostUsd:S().finite().nonnegative(),createdAt:tn,metadata:kd}).strict().superRefine((e,t)=>{e.decision==="proposed"!=(e.proposal!==null)&&t.addIssue({code:"custom",message:"proposed Refiner outcomes require a proposal; no-action outcomes cannot include one",path:["proposal"]})});SL.extend({contentHash:mt}).strict();const _L=I(["applied","retained","declined","conflict","rolled_back"]),xL=v({schemaVersion:N("openpond.improvementApplyReceipt.v1"),id:it,proposal:ht,beforeOverlay:Tr,afterOverlay:Tr.nullable(),decision:_L,boundary:XC,validationRefs:x(ht).max(100),outcomeEvidenceRefs:x(QC).max(1e3),rollbackOf:ht.nullable(),createdAt:tn,metadata:kd}).strict().superRefine((e,t)=>{e.decision==="applied"!=(e.afterOverlay!==null)&&t.addIssue({code:"custom",message:"applied receipts require an after-overlay; other decisions cannot include one",path:["afterOverlay"]}),e.decision==="rolled_back"!=(e.rollbackOf!==null)&&t.addIssue({code:"custom",message:"only rollback receipts require rollbackOf",path:["rollbackOf"]})});xL.extend({contentHash:mt}).strict();const Yc=v({provider:it,model:it,revision:l().trim().min(1).max(500).nullable().default(null),artifactHash:mt.nullable().default(null),tokenizerRevision:l().trim().min(1).max(500).nullable().default(null),chatTemplateHash:mt.nullable().default(null)}).strict(),kL=v({schemaVersion:N("openpond.localHarnessRefinerDecision.v1"),decision:N("no_action"),reason:l().trim().min(1).max(1e4)}).strip(),wL=v({schemaVersion:N("openpond.localHarnessRefinerDecision.v1"),decision:N("route"),route:I(["runtime","product","taskset","training"]),summary:l().trim().min(1).max(2e3),expectedOutcome:l().trim().min(1).max(1e4),reason:l().trim().min(1).max(1e4)}).strip(),CL=v({schemaVersion:N("openpond.localHarnessRefinerDecision.v1"),decision:N("propose"),route:I(["memory","prompt","skill","agent"]),operation:I(["create","update","delete"]),target:l().trim().min(1).max(2e3),summary:l().trim().min(1).max(2e3),createContent:l().min(1).max(2e4).nullable(),find:l().min(1).max(8e3).nullable(),replace:l().max(8e3).nullable(),expectedOutcome:l().trim().min(1).max(1e4),reason:l().trim().min(1).max(1e4)}).strip().superRefine((e,t)=>{e.operation==="create"&&(e.createContent===null||e.find!==null||e.replace!==null)&&t.addIssue({code:"custom",message:"create proposals require createContent and null find/replace",path:["createContent"]}),e.operation==="update"&&(e.createContent!==null||e.find===null||e.replace===null)&&t.addIssue({code:"custom",message:"update proposals require one exact find/replace edit and null createContent",path:["find"]}),e.operation==="delete"&&(e.createContent!==null||e.find!==null||e.replace!==null)&&t.addIssue({code:"custom",message:"delete proposals require null createContent/find/replace",path:["createContent"]})}),IL=Ja("decision",[kL,wL,CL]),k_=I(["memory","instruction","skill","agent"]),AL=v({trigger:$e(l(),Fe()),observations:x($e(l(),Fe())).max(20),task:v({prompt:l().max(8100).nullable(),assistantOutput:l().max(8100).nullable(),assistantOutputLinkCount:S().int().nonnegative(),previousAssistantOutput:l().max(8100).nullable()}).strict(),eventExcerpts:x($e(l(),Fe())).max(20),artifactDiagnostics:x($e(l(),Fe())).max(20),executionProfile:v({modelRequestCount:S().int().nonnegative(),failedModelRequestCount:S().int().nonnegative(),promptTokens:S().int().nonnegative(),completionTokens:S().int().nonnegative(),totalTokens:S().int().nonnegative(),toolFailureCount:S().int().nonnegative(),retryCount:S().int().nonnegative(),recoveryCount:S().int().nonnegative()}).strict(),recentObservations:x($e(l(),Fe())).max(20),recentOutcomes:x(v({id:l().trim().min(1).max(2e3),decision:I(["no_action","proposed"]),reason:l().trim().min(1).max(1e4),createdAt:l().trim().min(1).max(100),triggerId:l().trim().min(1).max(2e3)}).strict()).max(8),sourceFiles:x(v({path:l().trim().min(1).max(2e3),kind:k_,content:l().max(6e4),loaded:z()}).strict()).max(100),sourceCatalog:x(v({path:l().trim().min(1).max(2e3),kind:k_,loaded:z()}).strict()).max(1e3),additionalEvidence:Fe().nullable().optional()}).strict(),RL=v({id:l().trim().min(1).max(240),revision:S().int().nonnegative(),contentHash:mt}).strict();v({schemaVersion:N("openpond.hostedHarnessRefinerRequest.v1"),requestId:l().trim().min(1).max(240),idempotencyKey:l().trim().min(1).max(240),evidenceHash:mt,harness:v({admittedRelease:ht,currentRelease:ht,overlay:RL,workspace:v({id:l().trim().min(1).max(240),revision:S().int().nonnegative(),sourceRevision:mt,channelRevision:S().int().nonnegative()}).strict(),capabilities:v({memory:z(),prompt:z(),skill:z(),agent:z()}).strict()}).strict(),evidence:AL}).strict();const TL=v({promptTokens:S().int().nonnegative(),completionTokens:S().int().nonnegative(),totalTokens:S().int().nonnegative()}).strict();v({schemaVersion:N("openpond.hostedHarnessRefinerResponse.v1"),requestId:l().trim().min(1).max(240),evidenceHash:mt,admittedRelease:ht,currentRelease:ht,decision:IL,serviceRevision:l().trim().min(1).max(240),usage:TL}).strict();const EL=l().trim().min(1).max(2e3).refine(e=>{const t=e.replaceAll("\\","/");return!t.startsWith("/")&&!t.includes("\0")&&!t.split("/").some(a=>!a||a==="."||a==="..")},"path must be a safe relative path"),ML=I(["instruction","skill","skill_resource","agent","dependency_lock","program","asset"]),PL=v({id:rt,kind:ML,path:EL,parentId:rt.nullable(),mediaType:l().trim().min(1).max(200),visibility:I(["policy","verifier","host_private"]),portability:I(["portable","local_only"])}).strict().superRefine((e,t)=>{e.kind==="skill_resource"!=(e.parentId!==null)&&t.addIssue({code:"custom",message:"only Skill resources require parentId",path:["parentId"]})});v({schemaVersion:N("openpond.harnessSourceManifest.v1"),name:l().trim().min(1).max(240),files:x(PL).min(2).max(1e5),toolDeclarations:x(Nf).max(200),capabilityRequirements:x(Eb).max(200),lifecycle:YC,graderInterface:JC,runtimeProtocol:l().trim().min(1).max(500),metadata:$e(l(),Fe()).default({})}).strict().superRefine((e,t)=>{const a=new Set,i=new Map,s=new Set;for(const[u,d]of e.files.entries())a.has(d.id)&&t.addIssue({code:"custom",message:"file ids must be unique",path:["files",u,"id"]}),s.has(d.path)&&t.addIssue({code:"custom",message:"file paths must be unique",path:["files",u,"path"]}),a.add(d.id),i.set(d.id,d.kind),s.add(d.path);for(const[u,d]of e.files.entries())d.parentId&&!a.has(d.parentId)?t.addIssue({code:"custom",message:"parentId must reference a declared Skill",path:["files",u,"parentId"]}):d.parentId&&i.get(d.parentId)!=="skill"&&t.addIssue({code:"custom",message:"parentId must reference a primary Skill file",path:["files",u,"parentId"]});e.files.filter(u=>u.kind==="dependency_lock").length!==1&&t.addIssue({code:"custom",message:"exactly one dependency lock is required",path:["files"]}),e.files.filter(u=>u.kind==="program").length!==1&&t.addIssue({code:"custom",message:"exactly one Harness program is required",path:["files"]})});const OL=v({schemaVersion:N("openpond.trainingEngineCapabilities.v1"),adapterId:rt,available:z(),methods:x(l().trim().min(1).max(100)),signalKinds:x(E3),modelFamilies:x(l().trim().min(1).max(200)),precisions:x(I(["fp32","fp16","bf16","tf32","int8","int4"])),topologies:x(l().trim().min(1).max(200)),workerProtocolVersion:l().trim().min(1).max(200),upstreamRevision:l().trim().min(1).max(500),workerImageDigest:l().regex(/^sha256:[a-f0-9]{64}$/).nullable().default(null),capabilityReceipt:ft,checkedAt:Wn,unavailableReason:l().trim().min(1).max(5e3).nullable()}).strict(),jL=v({schemaVersion:N("openpond.computeTargetCapabilities.v1"),adapterId:rt,kind:I(["local","ssh","managed","custom"]),provider:rt.nullable(),available:z(),devices:x(v({id:rt,kind:I(["cpu","gpu","accelerator"]),vendor:l().trim().min(1).max(200),name:l().trim().min(1).max(500),memoryBytes:S().int().nonnegative().nullable(),runtime:l().trim().min(1).max(200)}).strict()),supportsWorkerImages:z(),supportsArtifactTransfer:z(),supportsCancellation:z(),capabilityReceipt:ft,checkedAt:Wn,unavailableReason:l().trim().min(1).max(5e3).nullable()}).strict(),NL=v({schemaVersion:N("openpond.harnessRuntimeCapabilities.v1"),adapterId:rt,available:z(),placements:x(I(["local","remote","colocated","provider_native"])),lifecycle:x(I(["create","reset","step","grade","collect","destroy"])),deterministicReplay:z(),privilegedIsolation:z(),capabilityReceipt:ft,checkedAt:Wn,unavailableReason:l().trim().min(1).max(5e3).nullable()}).strict();v({schemaVersion:N("openpond.resolvedTrainingPlan.v1"),manifest:B3,recipe:wb,runtime:Ib,compute:Ab,engine:Rb,execution:v({trainingPlanId:rt,approvalId:rt}).strict().nullable(),maximumSpendUsd:S().nonnegative().nullable(),approvalHash:ft,contentHash:ft}).strict().superRefine((e,t)=>{const a=[["runtime",e.runtime,e.manifest.runtimeTarget],["compute",e.compute,e.manifest.computeTarget],["engine",e.engine,e.manifest.engine]];for(const[i,s,u]of a)JSON.stringify(s)!==JSON.stringify(u)&&t.addIssue({code:"custom",path:[i],message:`${i} must exactly match the Harness Run Manifest`});e.recipe.method!==e.manifest.recipe.method&&t.addIssue({code:"custom",path:["recipe","method"],message:"Recipe method must match the Harness Run Manifest"}),e.approvalHash!==e.manifest.approval.approvalHash&&t.addIssue({code:"custom",path:["approvalHash"],message:"Approval hash must match the Harness Run Manifest"}),e.maximumSpendUsd!==e.manifest.approval.maximumSpendUsd&&t.addIssue({code:"custom",path:["maximumSpendUsd"],message:"Maximum spend must match the Harness Run Manifest"})});v({schemaVersion:N("openpond.adapterValidationReceipt.v1"),adapterId:rt,valid:z(),issues:x(v({code:rt,path:l().trim().max(2e3).nullable(),message:l().trim().min(1).max(5e3)}).strict()),capabilityReceipt:ft,planHash:ft,createdAt:Wn,contentHash:ft}).strict();v({runId:rt,adapterId:rt,routeId:rt.optional(),providerJobId:l().trim().min(1).max(1e3).nullable(),tenantId:rt.optional(),leaseId:rt.nullable(),manifestHash:ft.optional(),inputBundleHash:ft.optional(),createdAt:Wn}).strict();v({runId:rt,state:I(["queued","preparing","running","cancelling","cancelled","succeeded","failed"]),phase:l().trim().min(1).max(200),progress:S().min(0).max(1).nullable(),updatedAt:Wn,errorCode:rt.nullable()}).strict();v({runId:rt,manifestHash:ft,artifacts:x(v({kind:I(["checkpoint","adapter","metrics","trace","evaluation","receipt"]),objectRef:l().trim().min(1).max(2e3),sha256:ft,sizeBytes:S().int().nonnegative()}).strict()),contentHash:ft}).strict();const uv=I(["ready","model_download_required","compute_setup_required","provider_managed","unsupported"]),zL=v({id:rt,label:l().trim().min(1).max(500),description:l().trim().min(1).max(2e3),destinationId:rt,computeAdapterId:rt,runtimeAdapterId:rt,engineAdapterId:rt,methods:x(l().trim().min(1).max(100)),capabilityPills:x(l().trim().min(1).max(100)),executionMode:I(["local_worker","provider_native"]),approvalPolicy:v({providerId:wl,providerLabel:l().trim().min(1).max(200),settingsActionLabel:l().trim().min(1).max(500).nullable(),exportApprovalRequired:z(),exportDescription:l().trim().min(1).max(2e3).nullable(),preparationRequired:z(),minimumSpendUsd:S().nonnegative(),maximumSpendUsd:S().positive(),defaultMaximumSpendUsd:S().positive(),minimumRetentionDays:S().int().positive(),maximumRetentionDays:S().int().positive(),defaultRetentionDays:S().int().positive(),methodRequirement:l().trim().min(1).max(2e3).nullable()}).strict().nullable(),limits:v({maximumSequenceLength:S().int().positive(),maximumOutputTokens:S().int().positive(),maximumTrainingExamples:S().int().positive().nullable()}).strict(),defaults:v({loraRank:S().int().positive(),maxSteps:S().int().positive(),rolloutGroupSize:S().int().min(2).max(32),rolloutConcurrency:S().int().positive().max(32),rolloutOutputTokens:S().int().positive()}).strict(),available:z(),unavailableReason:l().trim().min(1).max(5e3).nullable()}).strict(),DL=v({selectionKey:rt,label:l().trim().min(1).max(500),source:I(["local","builtin","huggingface","managed","search"]),modelId:l().trim().min(1).max(1e3),revision:l().trim().min(1).max(500).nullable(),tokenizerRevision:l().trim().min(1).max(500).nullable(),chatTemplateHash:ft.nullable(),modelAssetId:rt.nullable(),expectedBytes:S().int().nonnegative().nullable(),cached:z(),known:z(),searchResolved:z(),computeAdapterIds:x(rt),engineAdapterIds:x(rt),preparationState:uv,reason:l().trim().min(1).max(5e3).nullable(),compatibilities:x(v({targetId:rt,methods:x(l().trim().min(1).max(100)),state:uv,reason:l().trim().min(1).max(5e3).nullable()}).strict())}).strict();v({schemaVersion:N("openpond.trainingCatalog.v1"),models:x(DL).max(1e5),engines:x(OL),compute:x(jL),runtimes:x(NL),targets:x(zL),generatedAt:Wn,contentHash:ft}).strict();v({schemaVersion:N("openpond.trainingPreparationPlan.v1"),modelRunId:rt,state:uv,reason:l().trim().min(1).max(5e3).nullable(),runtime:Ib.nullable(),compute:Ab.nullable(),engine:Rb.nullable(),downloads:x(v({kind:N("model"),label:l().trim().min(1).max(500),expectedBytes:S().int().nonnegative(),digest:l().trim().min(8).max(500),cached:z(),state:I(["ready","required","downloading","cancelled","failed"]),progress:S().min(0).max(1).nullable(),cancellable:z(),diskImpactBytes:S().int().nonnegative()}).strict()),dataMovement:x(v({direction:I(["upload","download","none"]),label:l().trim().min(1).max(500),bytes:S().int().nonnegative().nullable()}).strict()),quoteUsd:S().nonnegative().nullable(),maximumSpendUsd:S().nonnegative().nullable(),retentionDays:S().int().nonnegative().nullable(),sideEffectsStarted:N(!1),contentHash:ft}).strict();const UL=v({adapterId:it,placement:I(["local","remote","colocated","provider_native"]),runtimeVersion:l().trim().min(1).max(200),capabilityReceipt:mt}).strict(),LL=v({maxTurns:S().int().positive().max(1e5),timeoutMs:S().int().positive().max(864e5),maxOutputBytes:S().int().positive().max(25e7),maximumSpendUsd:S().nonnegative().nullable()}).strict(),HL=v({schemaVersion:N("openpond.runManifest.v1"),id:it,harnessRelease:ht,tasksetRelease:ht,model:Yc,runtimeTarget:UL,limits:LL,approval:v({id:it,contentHash:mt}).strict().nullable(),createdAt:tn,metadata:ko}).strict();HL.extend({contentHash:mt}).strict();const eI=v({schemaVersion:N("openpond.attemptReceipt.v1"),id:it,runManifest:ht,taskId:it,seed:l().trim().min(1).max(500),terminal:z(),failureClass:Tf.nullable(),outputHash:mt.nullable(),traceHash:mt,artifactRefs:x(nf).max(1e5),graderEvidenceRefs:x(nf).max(1e4),startedAt:tn,completedAt:tn,latencyMs:S().int().nonnegative(),costUsd:S().nonnegative().nullable(),legacyAttemptRef:it.nullable().default(null),metadata:ko}).strict(),tI=eI.extend({contentHash:mt}).strict(),$L=v({schemaVersion:N("openpond.evaluationResult.v1"),id:it,runManifest:ht,harnessRelease:ht,tasksetRelease:ht,model:Yc,receiptRefs:x(ht).min(1).max(1e6),attemptCount:S().int().positive(),rewardEligibleCount:S().int().nonnegative(),terminalCount:S().int().nonnegative(),meanScore:S().min(0).max(1).nullable(),failureCounts:$e(Tf,S().int().nonnegative()),metadata:ko}).strict();$L.extend({contentHash:mt}).strict();const qL=v({schemaVersion:N("openpond.harnessCompatibility.v1"),id:it,baseHarnessRelease:ht,candidateHarnessRelease:ht,tasksetRelease:ht,environmentHash:mt,toolContractHash:mt,policyHash:mt,graderInterfaceHash:mt,metadata:ko}).strict();qL.extend({contentHash:mt}).strict();function BL(e){const t=tI.safeParse(e);if(!t.success)return!1;const{contentHash:a,...i}=t.data;return Kt(eI.parse(i))===a}const td=I(["train","validation","test","frozen_eval"]),VL=v({policyVisibleFields:x(it).max(1e3).default([]),privilegedFields:x(it).max(1e3).default([]),hiddenGraderRefs:x(it).max(1e3).default([]),connectedAppScopes:x(it).max(100).default([])}).strict(),FL=v({protocolVersion:N("openpond.environment.v1"),kind:I(["text","agent","work","custom_program"]),entrypoint:l().trim().min(1).max(1e3),stateful:z(),deterministicSeeds:z(),lifecycle:x(I(["create","reset","step","collect","destroy"])).min(5).max(5),networkPolicy:I(["none","declared_read_only","declared_scoped"]),defaultTimeoutMs:S().int().positive().max(36e5)}).strict(),Df=v({id:it,version:l().trim().min(1).max(100),weight:S().nonnegative().max(1e3).default(1),hardGate:z().default(!1),rewardEligible:z().default(!1),privileged:z().default(!1)}),KL=Df.extend({kind:I(["content","schema","artifact","runtime_event","state"]),config:$e(l(),Fe())}).strict(),GL=Df.extend({kind:N("model_judge"),rubricRef:Vi,calibrationStatus:I(["pending","passed","failed"])}).strict(),ZL=Df.extend({kind:N("custom_verifier"),verifierRef:Vi,timeoutMs:S().int().positive().max(3e5),networkPolicy:N("none")}).strict(),WL=Df.extend({kind:N("human"),rubricRef:Vi,reviewerRole:l().trim().min(1).max(500)}).strict(),YL=Ua([KL,GL,ZL,WL]),JL=v({id:it,clusterKey:it,split:td,input:$e(l(),Fe()),expectedOutput:$e(l(),Fe()).nullable(),policyVisibleContext:$e(l(),Fe()).default({}),privilegedContextRef:it.nullable(),artifactRefs:x(Vi).max(1e3).default([]),tags:x(it).max(100).default([])}).strict(),XL=v({schemaVersion:N("openpond.tasksetRelease.v2"),id:it,revision:S().int().positive(),policy:VL,environment:FL,tools:x(Nf).max(200),capabilities:x(Eb).max(200),tasks:x(JL).min(1).max(1e6),graders:x(YL).min(1).max(1e3),metadata:ko}).strict(),QL=XL.extend({contentHash:mt}).strict();QL.parse({capabilities:[{id:"filesystem.workspace",portability:"host_adapter",required:!0,scopes:["inputs:read","work:read-write","outputs:write"]},{id:"network.web-read",portability:"host_adapter",required:!0,scopes:["search","fetch"]},{id:"artifact.pdf",portability:"host_adapter",required:!0,scopes:["create","render","inspect"]},{id:"artifact.spreadsheet",portability:"host_adapter",required:!0,scopes:["create","calculate","inspect"]}],contentHash:"4cef91a9c92df39d16f741b4d901dbde6b62e72bd8a48647a4a81c0d517d9634",environment:{defaultTimeoutMs:9e5,deterministicSeeds:!1,entrypoint:"openpond-work-v1",kind:"work",lifecycle:["create","reset","step","collect","destroy"],networkPolicy:"declared_read_only",protocolVersion:"openpond.environment.v1",stateful:!0},graders:[{hardGate:!0,id:"task-output-contract",kind:"custom_verifier",networkPolicy:"none",privileged:!0,rewardEligible:!0,timeoutMs:3e4,verifierRef:{contentHash:"5290dfae6969bd4581b1e1c111bdc1cb5f2828f7a91681635254b246c7590392",id:"verifiers-taskset-output-verifier-mjs",mediaType:"text/javascript",path:"verifiers/taskset-output-verifier.mjs",sizeBytes:1295,visibility:"verifier"},version:"1",weight:1},{calibrationStatus:"pending",hardGate:!0,id:"task-quality-judge",kind:"model_judge",privileged:!0,rewardEligible:!0,rubricRef:{contentHash:"455b3697c0617333a34b6521f167760fb8ae7e286059fa2ec327a5c97e66a2b3",id:"rubrics-task-quality-md",mediaType:"text/markdown",path:"rubrics/task-quality.md",sizeBytes:1496,visibility:"verifier"},version:"1",weight:1}],id:"harness-refiner-08112026",metadata:{adaptationSplit:"validation",benchmark:"harness-refiner",frozenEvaluationSplit:"frozen_eval",primaryMetric:"paired_foreground_provider_tokens",protocolVersion:"2",qualityPolicy:"hard_non_regression",refinementMode:"sequential_product_lifecycle",toolDeclarationSource:"openpond-production-model-tool-definitions",trainingSideEffect:!1},policy:{connectedAppScopes:[],hiddenGraderRefs:["rubrics-task-quality-md","verifiers-taskset-output-verifier-mjs"],policyVisibleFields:["input"],privilegedFields:["expectedOutput"]},revision:1,schemaVersion:"openpond.tasksetRelease.v2",tasks:[{artifactRefs:[{contentHash:"8879f8e31a916f165724a3c3e3e57db5baa858cd170ac6799064aa49bc623aa4",id:"fixtures-adaptation-board-launch-md",mediaType:"text/markdown",path:"fixtures/adaptation-board-launch.md",sizeBytes:642,visibility:"policy"}],clusterKey:"northstar-launch-packet",expectedOutput:{deliverable:"pdf",mustInclude:["three decision options","owners and dates","confirmed facts","open legal and finance gates"],mustNot:["present an open gate as approved","invent a recommended decision"],validation:["structural","visual"]},id:"adaptation-board-launch-brief",input:{attachments:["adaptation-board-launch.md"],prompt:"Please turn the attached Northstar launch packet into a polished two-page PDF decision brief for the executive meeting. Make the three options, owners, dates, confirmed facts, open gates, and risks easy to scan. The source records no final choice, so do not select, recommend, or imply a preferred option. Visually check the finished PDF before you send it back."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-adaptation-board-launch-brief",split:"validation",tags:["artifact-verification","decision-brief","adaptation"]},{artifactRefs:[{contentHash:"a3d44bb123a242d78d0f60d4d8ad352e499bef677eaf816a19d07359a172743f",id:"fixtures-adaptation-latency-incident-md",mediaType:"text/markdown",path:"fixtures/adaptation-latency-incident.md",sizeBytes:733,visibility:"policy"}],clusterKey:"checkout-latency-incident-packet",expectedOutput:{deliverable:"pdf",mustInclude:["incident window","confirmed impact","recovery","hypotheses labeled as hypotheses","unknowns","follow-up owners"],mustNot:["state either hypothesis as root cause","claim unresolved carts were recovered"],validation:["structural","visual"]},id:"adaptation-latency-incident-review",input:{attachments:["adaptation-latency-incident.md"],prompt:"Create a concise PDF incident review from the attached checkout latency packet. Clearly separate confirmed observations, recovery actions, hypotheses, unknowns, customer impact, and follow-up owners. Check that the rendered PDF is readable and complete."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-adaptation-latency-incident-review",split:"validation",tags:["artifact-verification","incident-review","adaptation"]},{artifactRefs:[{contentHash:"63bca96753ae1491a45ba13e1a06cfb48973cfbe4f392e8f181e7b9648fd9db4",id:"fixtures-adaptation-program-budget-md",mediaType:"text/markdown",path:"fixtures/adaptation-program-budget.md",sizeBytes:649,visibility:"policy"}],clusterKey:"harbor-program-budget-packet",expectedOutput:{deliverable:"spreadsheet",mustInclude:["summary sheet","detail sheet","formula-driven full-year forecast","formula-driven variance","owner column","overrun flag"],mustNot:["replace formulas with typed totals","reverse the variance sign"],validation:["structural","test"]},id:"adaptation-program-budget-workbook",input:{attachments:["adaptation-program-budget.md"],prompt:"Build an Excel workbook from the attached Harbor youth program budget. Include a one-page summary and a detail sheet with formulas for full-year forecast and variance, clearly flag forecast overruns, preserve the listed owners, and verify the calculations before returning it."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-adaptation-program-budget-workbook",split:"validation",tags:["artifact-verification","spreadsheet","adaptation"]},{artifactRefs:[],clusterKey:"northwind-invoice-correction-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","INV-1842","120 seats instead of 102","August 14","no payment due until corrected","accounts@example.com"],mustNot:["suggest the error was intentional","exceed 130 words","return only a checklist or file path instead of the message"],validation:[]},id:"adaptation-invoice-correction-email",input:{attachments:[],prompt:"Draft a courteous email to Northwind Labs explaining that invoice INV-1842 incorrectly lists 120 seats instead of 102. A corrected invoice will arrive by August 14, no payment is due until it arrives, and billing questions should go to accounts@example.com. Keep it under 130 words and do not suggest the error was intentional."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-invoice-correction-email",split:"validation",tags:["constraint-following","direct-deliverable","communication","adaptation"]},{artifactRefs:[],clusterKey:"nextjs-security-current-sources",expectedOutput:{deliverable:"report",mustInclude:["official advisory links","affected and fixed versions","date checked","limits on exposure inference"],mustNot:["declare exposure without project version and configuration","use an uncited vulnerability list"],validation:[]},id:"adaptation-nextjs-security-audit",input:{attachments:[],prompt:"Audit the currently supported Next.js release lines for security advisories published in the last twelve months. Use primary sources, explain which versions are affected and fixed, avoid inferring that a project is vulnerable without its exact version and configuration, and give me a concise linked report with the date checked."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-nextjs-security-audit",split:"validation",tags:["research-efficiency","primary-sources","security","adaptation"]},{artifactRefs:[],clusterKey:"juniper-workshop-reschedule-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","September 10","2:00 p.m. ET","facilitator unavailable","registrations carry over","recording","events@example.com"],mustNot:["blame the venue","exceed 120 words","return only a checklist or file path instead of the message"],validation:[]},id:"adaptation-workshop-reschedule-email",input:{attachments:[],prompt:"Draft a warm email to Juniper workshop registrants explaining that the September 3 session is moving to September 10 at 2:00 p.m. ET because the facilitator is unavailable. Existing registrations carry over, a recording will be shared, and questions should go to events@example.com. Keep it under 120 words and do not imply the venue caused the change."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-workshop-reschedule-email",split:"validation",tags:["constraint-following","direct-deliverable","communication","adaptation"]},{artifactRefs:[],clusterKey:"boston-dc-accessibility-sources",expectedOutput:{deliverable:"report",mustInclude:["official operator sources","outbound and return plan","accessibility details","disruption check","time checked","items needing confirmation"],mustNot:["guarantee availability not confirmed by booking","hide access limitations"],validation:[]},id:"adaptation-accessible-boston-dc-plan",input:{attachments:[],prompt:"Plan a wheelchair-accessible train trip from Boston to Washington, DC for September 17, 2026, returning September 19. Verify accessibility and disruption information from official sources, distinguish facts from anything that still needs confirmation, include direct links and the time checked, and keep the answer practical and concise."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-accessible-boston-dc-plan",split:"validation",tags:["research-efficiency","current-information","travel","adaptation"]},{artifactRefs:[],clusterKey:"chatgpt-x-reddit-public-sample",expectedOutput:{deliverable:"report",mustInclude:["links to public examples","dates","positive experiences","negative experiences","pattern versus anecdote","sampling limitations"],mustNot:["post or interact","represent a convenience sample as representative sentiment"],validation:[]},id:"adaptation-chatgpt-public-experiences",input:{attachments:[],prompt:"Research what people have publicly said about using ChatGPT on X and Reddit during the last thirty days. Give me a concise, linked summary of recurring positive and negative experiences, separate patterns from anecdotes, include dates, and explain any platform-access or sampling limitations. Do not post or interact with anyone."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-chatgpt-public-experiences",split:"validation",tags:["research-efficiency","current-information","social-research","adaptation"]},{artifactRefs:[],clusterKey:"acme-launch-delay-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","August 27","accessibility testing incomplete","August 22 expectation","pilot access remains","support email"],mustNot:["say testing failed","exceed 140 words","invent compensation","return only a checklist or file path instead of the message"],validation:[]},id:"adaptation-launch-delay-email",input:{attachments:[],prompt:"Draft a calm email to the Acme pilot customers explaining that the August 20 launch is moving to August 27 because final accessibility testing is not complete. Testing is expected to finish August 22, existing pilot access remains available, and questions should go to pilot-support@example.com. Keep it under 140 words and do not imply the test has failed."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-launch-delay-email",split:"validation",tags:["constraint-following","direct-deliverable","communication","adaptation"]},{artifactRefs:[],clusterKey:"cirrus-service-window-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","August 18","1:00 to 2:00 UTC","dashboard read-only","alerts continue","no data loss expected","status.example.com"],mustNot:["promise zero interruption","exceed 125 words","return only a checklist or file path instead of the message"],validation:[]},id:"adaptation-service-window-email",input:{attachments:[],prompt:"Draft a calm email to Cirrus customers about planned maintenance on August 18 from 1:00 to 2:00 UTC. The dashboard will be read-only, alerts will continue, no data loss is expected, and updates will appear at status.example.com. Keep it under 125 words and do not promise that there will be zero interruption."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-adaptation-service-window-email",split:"validation",tags:["constraint-following","direct-deliverable","communication","adaptation"]},{artifactRefs:[{contentHash:"cb3aec594b140129ebd872c427053ba63a303cc36d160448afc9ed1a0289d3ca",id:"fixtures-frozen-clinic-relocation-md",mediaType:"text/markdown",path:"fixtures/frozen-clinic-relocation.md",sizeBytes:652,visibility:"policy"}],clusterKey:"riverside-clinic-relocation-packet",expectedOutput:{deliverable:"pdf",mustInclude:["three opening options","owners and dates","confirmed facts","permit and parking gates","delivery risk"],mustNot:["present either approval as complete","invent a chosen opening option"],validation:["structural","visual"]},id:"frozen-clinic-relocation-brief",input:{attachments:["frozen-clinic-relocation.md"],prompt:"Please turn the attached Riverside clinic relocation packet into a polished two-page PDF decision brief. Make the opening options, owners, dates, confirmed facts, unresolved approvals, and delivery risk easy to scan, and visually check the finished PDF before returning it."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-frozen-clinic-relocation-brief",split:"frozen_eval",tags:["artifact-verification","decision-brief","frozen-eval"]},{artifactRefs:[{contentHash:"80aad04ac67682165f098884fd1a86e9fb3ef15d2da3124401308dd23884b612",id:"fixtures-frozen-payment-incident-md",mediaType:"text/markdown",path:"fixtures/frozen-payment-incident.md",sizeBytes:672,visibility:"policy"}],clusterKey:"subscription-renewal-incident-packet",expectedOutput:{deliverable:"pdf",mustInclude:["incident window","attempt and timeout counts","recovery","hypothesis label","33 unresolved accounts","follow-up owners"],mustNot:["state the certificate hypothesis as confirmed","claim all accounts resolved"],validation:["structural","visual"]},id:"frozen-payment-incident-review",input:{attachments:["frozen-payment-incident.md"],prompt:"Create a concise PDF incident review from the attached subscription renewal incident packet. Separate confirmed impact and recovery from the root-cause hypothesis and unresolved customer accounts, preserve the owners, and check the rendered PDF for readability and completeness."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-frozen-payment-incident-review",split:"frozen_eval",tags:["artifact-verification","incident-review","frozen-eval"]},{artifactRefs:[{contentHash:"c58b740d57b031cfe22d475d30b39a1a49a43820f1840a1d8054731cef58c8e8",id:"fixtures-frozen-grant-budget-md",mediaType:"text/markdown",path:"fixtures/frozen-grant-budget.md",sizeBytes:661,visibility:"policy"}],clusterKey:"greenway-grant-budget-packet",expectedOutput:{deliverable:"spreadsheet",mustInclude:["summary sheet","detail sheet","formula-driven full-year forecast","formula-driven variance","owner column","overrun flag"],mustNot:["replace formulas with typed totals","reverse the variance sign"],validation:["structural","test"]},id:"frozen-grant-budget-workbook",input:{attachments:["frozen-grant-budget.md"],prompt:"Build an Excel workbook from the attached Greenway community grant budget. Include a one-page summary and detail sheet with formulas for full-year forecast and variance, flag forecast overruns, preserve owners, and verify all calculations before returning it."},policyVisibleContext:{attachmentCount:1},privilegedContextRef:"expected-frozen-grant-budget-workbook",split:"frozen_eval",tags:["artifact-verification","spreadsheet","frozen-eval"]},{artifactRefs:[],clusterKey:"beacon-shipping-delay-message",expectedOutput:{deliverable:"message",mustInclude:["complete ready-to-post message copy","August 21","carrier missed transfer window","August 22 installation","Morgan","logistics channel"],mustNot:["say the equipment is lost","exceed 90 words","return only a checklist or file path instead of the message"],validation:[]},id:"frozen-shipping-delay-chat-message",input:{attachments:[],prompt:"Write a concise team chat message explaining that the Beacon equipment shipment is now expected August 21 instead of August 19 because the carrier missed its transfer window. The installation crew remains booked for August 22, Morgan owns the carrier follow-up, and the team should flag conflicts in the logistics channel. Keep it under 90 words and do not say the equipment is lost."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-shipping-delay-chat-message",split:"frozen_eval",tags:["constraint-following","direct-deliverable","communication","frozen-eval"]},{artifactRefs:[],clusterKey:"python-requests-security-current-sources",expectedOutput:{deliverable:"report",mustInclude:["primary advisory links","affected and fixed versions","date checked","dependency and usage caveat"],mustNot:["declare deployment exposure without evidence","use an uncited vulnerability list"],validation:[]},id:"frozen-python-requests-security-audit",input:{attachments:[],prompt:"Audit the supported Python Requests release lines for security advisories published in the last eighteen months. Use primary sources, identify affected and fixed versions, avoid claiming a specific deployment is exposed without its exact dependency graph and usage, and provide a concise linked report with the date checked."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-python-requests-security-audit",split:"frozen_eval",tags:["research-efficiency","primary-sources","security","frozen-eval"]},{artifactRefs:[],clusterKey:"cobalt-refund-support-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready reply copy","$48 duplicate charge","August 16","original payment method","five business days","CB-7714"],mustNot:["state the refund is already approved","exceed 110 words","return only a checklist or file path instead of the message"],validation:[]},id:"frozen-refund-support-reply",input:{attachments:[],prompt:"Write a helpful support reply to a Cobalt customer whose duplicate $48 charge is being reviewed. The review should finish by August 16, any confirmed duplicate will be refunded to the original payment method within five business days, and the case number is CB-7714. Keep it under 110 words and do not state that the refund has already been approved."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-refund-support-reply",split:"frozen_eval",tags:["constraint-following","direct-deliverable","communication","frozen-eval"]},{artifactRefs:[],clusterKey:"chicago-stl-accessibility-sources",expectedOutput:{deliverable:"report",mustInclude:["official operator sources","outbound and return plan","accessibility details","disruption check","time checked","items needing confirmation"],mustNot:["guarantee unconfirmed availability","hide access limitations"],validation:[]},id:"frozen-accessible-chicago-stl-plan",input:{attachments:[],prompt:"Plan a wheelchair-accessible train trip from Chicago to St. Louis for October 8, 2026, returning October 10. Verify accessibility and disruption information from official sources, distinguish confirmed facts from anything requiring booking confirmation, include direct links and the time checked, and keep it practical."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-accessible-chicago-stl-plan",split:"frozen_eval",tags:["research-efficiency","current-information","travel","frozen-eval"]},{artifactRefs:[],clusterKey:"new-jersey-youth-grant-sources",expectedOutput:{deliverable:"report",mustInclude:["authoritative source links","eligibility evidence","deadlines","date checked","only realistic matches"],mustNot:["include closed grants","include grants without verified nonprofit and program eligibility","pad the list"],validation:[]},id:"frozen-new-jersey-youth-grants",input:{attachments:[],prompt:"Find currently open grants that a New Jersey nonprofit running after-school programs could realistically apply for, with deadlines between now and December 31, 2026. Use authoritative sources, link each opportunity, verify eligibility and deadline, omit weak matches instead of padding the list, and state when you checked."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-new-jersey-youth-grants",split:"frozen_eval",tags:["research-efficiency","current-information","funding","frozen-eval"]},{artifactRefs:[],clusterKey:"maple-maintenance-followup-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","July 28","August 1 inspection","security concern","repair date within two business days"],mustNot:["make a legal threat","claim facts not supplied","exceed 130 words","return only a checklist or file path instead of the message"],validation:[]},id:"frozen-maintenance-followup-email",input:{attachments:[],prompt:"Draft a firm but courteous email to Maple Property Management following up on a bedroom window that has not closed securely since July 28. Maintenance inspected it August 1 but did not repair it. Ask for a repair date within two business days, mention the security concern, and keep the email under 130 words without making legal threats."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-maintenance-followup-email",split:"frozen_eval",tags:["constraint-following","direct-deliverable","communication","frozen-eval"]},{artifactRefs:[],clusterKey:"meridian-vendor-document-message",expectedOutput:{deliverable:"message",mustInclude:["complete send-ready message copy","insurance certificate","August 7","onboarding blocked","Rosa","August 12"],mustNot:["threaten contract cancellation","exceed 120 words","return only a checklist or file path instead of the message"],validation:[]},id:"frozen-vendor-document-followup-email",input:{attachments:[],prompt:"Draft a firm but professional email to Meridian Freight following up on the insurance certificate promised for August 7. It has not arrived, carrier onboarding cannot finish without it, and Rosa needs the document or a confirmed delivery date by August 12. Keep it under 120 words and do not threaten to cancel the contract."},policyVisibleContext:{attachmentCount:0},privilegedContextRef:"expected-frozen-vendor-document-followup-email",split:"frozen_eval",tags:["constraint-following","direct-deliverable","communication","frozen-eval"]}],tools:[{description:"Start Work compute only when it is needed, then return live sandbox status and the stable /workspace/inputs, /workspace/work, and /workspace/outputs layout.",inputSchema:{additionalProperties:!1,properties:{},type:"object"},inputSchemaHash:"042b35e50dd5dd505f0228e829f17a8aeaae50e49d865c4754cf9ba1edba9bd0",name:"work_environment",sideEffect:"write",timeoutMs:12e4},{description:"List files in the Work scratch, input, or completed-output area. This lazily starts Work compute.",inputSchema:{additionalProperties:!1,properties:{area:{enum:["inputs","work","outputs"],type:"string"},path:{description:"Optional relative path inside the selected area.",type:"string"},recursive:{type:"boolean"}},required:["area"],type:"object"},inputSchemaHash:"a3a68e8aeb4f23710aa21fe95d4a361a14c08bcbb61a2a959a60b7b00c82807f",name:"work_list_files",sideEffect:"read",timeoutMs:12e4},{description:"Read a bounded file from Work inputs, scratch space, or completed-output candidates.",inputSchema:{additionalProperties:!1,properties:{area:{enum:["inputs","work","outputs"],type:"string"},maxBytes:{maximum:1e6,minimum:1,type:"integer"},path:{minLength:1,type:"string"}},required:["area","path"],type:"object"},inputSchemaHash:"deb9cd248f2734751286054c381ac9572b248370181970ced6563a73c905a4f0",name:"work_read_file",sideEffect:"read",timeoutMs:12e4},{description:"Write a UTF-8 Work scratch file or completed-output candidate. Use area=outputs only for a finished result that is ready to validate and save.",inputSchema:{additionalProperties:!1,properties:{area:{enum:["work","outputs"],type:"string"},content:{type:"string"},path:{minLength:1,type:"string"}},required:["area","path","content"],type:"object"},inputSchemaHash:"6a19df98686e99a324564006b0b92082f185ac4b430e9285829f781251dd145b",name:"work_write_file",sideEffect:"write",timeoutMs:12e4},{description:"Edit a Work scratch file or output candidate by exact text replacement after reading it.",inputSchema:{additionalProperties:!1,properties:{area:{enum:["work","outputs"],type:"string"},newText:{type:"string"},oldText:{minLength:1,type:"string"},path:{minLength:1,type:"string"},replaceAll:{type:"boolean"}},required:["area","path","oldText","newText"],type:"object"},inputSchemaHash:"f507d9d9abbd8cf1556f6e925c159234295c3fa01800c5556767f96be8b011db",name:"work_edit_file",sideEffect:"write",timeoutMs:12e4},{description:"Run a bounded shell command from /workspace/work. Write finished deliverables to ../outputs and inspect them; the runtime preserves output files automatically when the turn ends.",inputSchema:{additionalProperties:!1,properties:{command:{minLength:1,type:"string"},timeoutSeconds:{maximum:3600,minimum:1,type:"integer"}},required:["command"],type:"object"},inputSchemaHash:"5ba3a52cddb3f575218bed855020e91eef14092d75922c963a24c6bc97fadeda",name:"work_exec",sideEffect:"write",timeoutMs:3e5},{description:"Explicitly copy one completed file from /workspace/outputs to durable OpenPond output storage before turn completion. Normal Work turns preserve output files automatically.",inputSchema:{additionalProperties:!1,properties:{path:{description:"Path relative to /workspace/outputs, for example report.md.",minLength:1,type:"string"},suggestedName:{maxLength:180,minLength:1,type:"string"},validation:{items:{additionalProperties:!1,properties:{detail:{maxLength:4e3,type:"string"},kind:{enum:["structural","visual","test","user_review"],type:"string"},label:{maxLength:240,minLength:1,type:"string"},ref:{maxLength:4096,type:"string"},status:{enum:["passed","failed","not_run"],type:"string"}},required:["kind","status","label"],type:"object"},maxItems:32,type:"array"}},required:["path"],type:"object"},inputSchemaHash:"ca853f64b300c74441b522db03facbcc9c5bb89c86189dae24182bab39510a83",name:"work_save_output",sideEffect:"write",timeoutMs:12e4},{description:"Stop Work compute after durable outputs have been saved. Saved OutputRefs remain available.",inputSchema:{additionalProperties:!1,properties:{},type:"object"},inputSchemaHash:"042b35e50dd5dd505f0228e829f17a8aeaae50e49d865c4754cf9ba1edba9bd0",name:"work_stop",sideEffect:"write",timeoutMs:12e4},{description:"Search the web for current or external information. The app renders clickable source pills automatically. Cite by source title or source name in prose by default; when the user explicitly requests URLs or linked evidence, use the result URLs in clickable Markdown links.",inputSchema:{additionalProperties:!1,properties:{domains:{description:"Optional domain filters.",items:{type:"string"},maxItems:10,type:"array"},limit:{description:"Maximum number of results to return.",maximum:10,minimum:1,type:"integer"},query:{description:"Search query.",minLength:1,type:"string"},recencyDays:{description:"Only return results from this many recent days when supported.",minimum:0,type:"integer"}},required:["query"],type:"object"},inputSchemaHash:"2a138bf9b526a624ac2442669fccb277fac2ba818821b3a2da1dd27d62954056",name:"web_search",sideEffect:"read",timeoutMs:12e4},{description:"Fetch and extract readable text from a known HTTP(S) URL. Use this when the user provides a URL or a search result has an exact page to inspect; use web_search when discovering unknown pages by query.",inputSchema:{additionalProperties:!1,properties:{maxBytes:{description:"Maximum UTF-8 bytes of extracted text to return. Defaults to 20000.",maximum:1e5,minimum:1,type:"integer"},url:{description:"HTTP or HTTPS URL to fetch.",minLength:1,type:"string"}},required:["url"],type:"object"},inputSchemaHash:"0afe31d8dbe05643e4a19ca0897c606e379f37d741b4f61816ad8ba4d48b61b3",name:"web_fetch",sideEffect:"read",timeoutMs:12e4}]});const nI=I(["foreground_tokens","success_rate","latency_ms","cost_usd"]),aI=I(["baseline","candidate"]),e5=v({split:td,taskIds:x(it).min(1).max(1e5),seeds:x(l().trim().min(1).max(500)).min(1).max(100),repetitions:S().int().positive().max(20),runtimeTargetHash:mt,environmentHash:mt,toolContractHash:mt,limitsHash:mt}).strict();v({schemaVersion:N("openpond.benchmarkDefinition.v1"),id:it,title:l().trim().min(1).max(500),description:l().trim().min(1).max(5e3),tasksetRelease:ht,adaptationSplit:td,evaluationSplit:td,primaryMetric:nI,qualityGate:I(["none","non_regression","all_pass"]),caseCounts:v({adaptation:S().int().nonnegative(),evaluation:S().int().positive()}).strict(),metadata:ko}).strict();v({schemaVersion:N("openpond.benchmarkRunRequest.v1"),phase:aI,model:Yc,reasoningEffort:l().trim().min(1).max(100).nullable(),split:td,seeds:x(l().trim().min(1).max(500)).min(1).max(100),repetitions:S().int().positive().max(20),metadata:ko}).strict();const t5=v({inputTokens:S().int().nonnegative(),outputTokens:S().int().nonnegative(),totalTokens:S().int().nonnegative()}).strict(),n5=v({schemaVersion:N("openpond.benchmarkRunSummary.v1"),id:it,phase:aI,tasksetRelease:ht,harnessRelease:ht,evaluationResult:ht,model:Yc,reasoningEffort:l().trim().min(1).max(100).nullable(),protocol:e5,attemptCount:S().int().positive(),passedCount:S().int().nonnegative(),terminalCount:S().int().nonnegative(),usage:t5,costUsd:S().nonnegative().nullable(),latencyMs:S().int().nonnegative(),createdAt:tn,metadata:ko}).strict();n5.extend({contentHash:mt}).strict();const a5=v({schemaVersion:N("openpond.benchmarkComparison.v1"),id:it,baseline:ht,candidate:ht,tasksetRelease:ht,primaryMetric:nI,qualityPassed:z(),baselinePassRate:S().min(0).max(1),candidatePassRate:S().min(0).max(1),foregroundTokenDelta:S().int(),foregroundTokenDeltaPercent:S().finite().nullable(),improved:z(),createdAt:tn,metadata:ko}).strict();a5.extend({contentHash:mt}).strict();const o5="openpond.workEvidenceReceipt.v1",i5="openpond.workProcessTrace.v1",r5="openpond.workFeedbackReceipt.v1",oI="openpond.workEvidenceEligibility.v1",s5=l().regex(/^urn:openpond:work:[a-f0-9]{64}$/,"Work source references must be opaque SHA-256 URNs."),l5=l().regex(/^urn:openpond:workspace:[a-f0-9]{64}$/,"Workspace references must be opaque SHA-256 URNs."),c5=l().regex(/^urn:openpond:artifact:[a-f0-9]{64}$/,"Evidence artifacts must use content-addressed SHA-256 URNs."),za=nf.extend({id:c5}).strict().superRefine((e,t)=>{e.id!==cI(e.contentHash)&&t.addIssue({code:"custom",message:"Evidence artifact id must contain its content hash.",path:["id"]})}),u5=I(["tool","validation","state_transition","approval","question","artifact","cleanup"]),d5=I(["agent","environment"]),m5=I(["turn_started","turn_completed","turn_failed","turn_cancelled","turn_timed_out","tool_invoked","tool_completed","tool_failed","validation_completed","validation_failed","approval_requested","approval_resolved","question_asked","question_answered","question_dismissed","artifact_created","workspace_changed","environment_created","environment_reset","environment_destroyed","cleanup_completed","cleanup_failed"]),f5=I(["started","completed","failed","cancelled"]),p5=I(["filesystem","source_control","command","browser","connected_app","sandbox","agent","other"]),h5=I(["structural","visual","test","user_review","other"]),g5=I(["running","completed","failed","cancelled","timeout"]),v5=I(["requested","approved","denied","answered","dismissed"]),b5=I(["policy","validation","environment","infrastructure","timeout","cancelled","unknown"]),y5=I(["missing_start","missing_terminal","source_truncated","unsupported_events_dropped","uncorrelated_environment_step","artifact_unavailable"]),S5=v({sequence:S().int().nonnegative().max(1e6),timestamp:tn,layer:d5,kind:u5,action:m5,status:f5,inputHash:mt.nullable(),outputHash:mt.nullable(),receiptHash:mt.nullable(),parentReceiptHash:mt.nullable(),artifactRefs:x(za).max(1e3),attributes:v({toolCategory:p5.nullable(),validationKind:h5.nullable(),transitionState:g5.nullable(),interventionOutcome:v5.nullable(),artifactCount:S().int().nonnegative().max(1e5),exitCode:S().int().min(-1).max(255).nullable(),durationMs:S().int().nonnegative().max(31536e6).nullable(),cpuTimeMs:S().int().nonnegative().max(31536e6).nullable(),memoryPeakBytes:S().int().nonnegative().max(0x4000000000000).nullable(),errorClass:b5.nullable()}).strict()}).strict().superRefine((e,t)=>{e.layer==="agent"&&e.parentReceiptHash!==null&&t.addIssue({code:"custom",message:"Agent-layer steps cannot have a parent environment correlation.",path:["parentReceiptHash"]}),e.layer==="environment"&&e.parentReceiptHash===null&&t.addIssue({code:"custom",message:"Environment steps must correlate to an Agent receipt.",path:["parentReceiptHash"]})}),iI=v({schemaVersion:N(i5),sourceRevisionHash:mt,sanitationPolicyVersion:it,incomplete:z(),incompleteReasons:x(y5).max(10),droppedEventCount:S().int().nonnegative().max(1e6),steps:x(S5).max(1e5)}).strict().superRefine((e,t)=>{e.incomplete!==e.incompleteReasons.length>0&&t.addIssue({code:"custom",message:"incomplete must match the presence of incompleteReasons.",path:["incomplete"]});for(let a=0;a<e.steps.length;a+=1)e.steps[a].sequence!==a&&t.addIssue({code:"custom",message:"Process trace sequences must be contiguous and zero-based.",path:["steps",a,"sequence"]})}),_5=iI.safeExtend({contentHash:mt}).strict(),x5=I(["policy_failure","validation_failure","model_failure","environment_failure","infrastructure_failure","timeout","cancelled","unknown"]),k5=v({status:I(["completed","failed","cancelled","timeout"]),failureClass:x5.nullable()}).strict().superRefine((e,t)=>{e.status==="completed"&&e.failureClass!==null&&t.addIssue({code:"custom",message:"Completed Work cannot carry a failure class.",path:["failureClass"]}),e.status!=="completed"&&e.failureClass===null&&t.addIssue({code:"custom",message:"Non-completed Work requires a failure class.",path:["failureClass"]}),e.status==="cancelled"&&e.failureClass!=="cancelled"&&t.addIssue({code:"custom",message:"Cancelled Work must use the cancelled failure class.",path:["failureClass"]}),e.status==="timeout"&&e.failureClass!=="timeout"&&t.addIssue({code:"custom",message:"Timed-out Work must use the timeout failure class.",path:["failureClass"]})}),Mb=v({schemaVersion:N(o5),id:l().regex(/^work-evidence-[a-f0-9]{24}$/),source:v({surface:I(["desktop","hosted"]),experience:I(["work","development"]),opaqueRef:s5,revisionHash:mt}).strict(),agentSnapshot:ht.nullable(),model:Yc,runtime:v({adapterId:it,adapterVersion:it,capabilityRef:za.nullable()}).strict(),inputHash:mt,terminal:k5,trace:v({sanitizedRef:za,traceHash:mt,sanitationPolicyVersion:it,incomplete:z()}).strict(),outputRefs:x(za).max(1e4),artifactRefs:x(za).max(1e5),validationEvidenceRefs:x(za).max(1e4),interventions:v({approvals:S().int().nonnegative().max(1e6),questions:S().int().nonnegative().max(1e6),steeringEvents:S().int().nonnegative().max(1e6),otherUserInterventions:S().int().nonnegative().max(1e6)}).strict(),timing:v({startedAt:tn,completedAt:tn,latencyMs:S().int().nonnegative().max(31536e6)}).strict(),usage:v({promptTokens:S().int().nonnegative().nullable(),completionTokens:S().int().nonnegative().nullable(),totalTokens:S().int().nonnegative().nullable()}).strict(),costUsd:S().nonnegative().max(1e6).nullable(),provenance:v({consentReceiptRef:za,consentScope:N("work_process_and_artifacts"),consentGrantedAt:tn,policyVersion:it,projectorVersion:it,disclosure:N("portable_sanitized"),ownershipScope:I(["personal","workspace"]),workspaceRef:l5.nullable(),participantPolicy:I(["creator_only","all_participants"]),retention:v({policy:N("source_bound"),deleteWithSource:N(!0),expiresAt:tn.nullable()}).strict()}).strict()}).strict().superRefine((e,t)=>{e.trace.traceHash!==e.trace.sanitizedRef.contentHash&&t.addIssue({code:"custom",message:"Sanitized trace reference must bind traceHash.",path:["trace","traceHash"]});const a=Date.parse(e.timing.completedAt)-Date.parse(e.timing.startedAt);(a<0||a!==e.timing.latencyMs)&&t.addIssue({code:"custom",message:"latencyMs must equal completedAt minus startedAt.",path:["timing","latencyMs"]}),e.provenance.ownershipScope==="workspace"&&e.provenance.workspaceRef===null&&t.addIssue({code:"custom",message:"Workspace-owned evidence requires workspaceRef.",path:["provenance","workspaceRef"]}),e.provenance.ownershipScope==="personal"&&e.provenance.workspaceRef!==null&&t.addIssue({code:"custom",message:"Personal evidence cannot carry workspaceRef.",path:["provenance","workspaceRef"]}),pg(e.outputRefs,["outputRefs"],t),pg(e.artifactRefs,["artifactRefs"],t),pg(e.validationEvidenceRefs,["validationEvidenceRefs"],t)}),rI=Mb.safeExtend({contentHash:mt}).strict(),w5=I(["accepted","needs_correction","not_useful"]),C5=I(["correct","complete","high_quality","incorrect","incomplete","wrong_format","unsafe","stale","irrelevant","other"]),sI=v({schemaVersion:N(r5),id:l().regex(/^work-feedback-[a-f0-9]{24}$/),evidenceReceiptRef:za,outputRevisionRef:za.nullable(),verdict:w5,reasonCodes:x(C5).max(16),correctionRef:za.nullable(),correctedOutputRevisionRef:za.nullable(),actor:N("user"),createdAt:tn}).strict().superRefine((e,t)=>{new Set(e.reasonCodes).size!==e.reasonCodes.length&&t.addIssue({code:"custom",message:"Feedback reason codes must be unique.",path:["reasonCodes"]}),e.verdict!=="needs_correction"&&(e.correctionRef||e.correctedOutputRevisionRef)&&t.addIssue({code:"custom",message:"Only needs_correction feedback may bind correction artifacts.",path:["verdict"]})}),lI=sI.safeExtend({contentHash:mt}).strict();function cI(e){return`urn:openpond:artifact:${e}`}function I5(e){return`urn:openpond:work:${Kt(e)}`}function wd(e){return za.parse({id:cI(e.contentHash),contentHash:e.contentHash,mediaType:e.mediaType??null,sizeBytes:e.sizeBytes??null})}function uI(e){const t=iI.parse(e);return _5.parse({...t,contentHash:Kt(t)})}function A5(e){const t=Mb.parse(e);return rI.parse({...t,contentHash:Kt(t)})}function dI(e,t){const a=sI.parse(e),i=lI.parse({...a,contentHash:Kt(a)});return t&&E5(i,t),i}function R5(e){return M5(e,rI,Mb)}function T5(e){return wd({contentHash:e.contentHash,mediaType:"application/vnd.openpond.work-evidence+json",sizeBytes:null})}function E5(e,t){if(e.evidenceReceiptRef.contentHash!==t.contentHash)throw new Error("Feedback targets a different Work evidence receipt.");if(e.outputRevisionRef&&!t.outputRefs.some(a=>a.contentHash===e.outputRevisionRef.contentHash))throw new Error("Feedback targets an output revision not bound by the Work evidence receipt.")}function M5(e,t,a){const i=t.safeParse(e);if(!i.success)return!1;const{contentHash:s,...u}=i.data;return Kt(a.parse(u))===s}function pg(e,t,a){const i=e.map(s=>s.contentHash);new Set(i).size!==i.length&&a.addIssue({code:"custom",message:"Artifact content hashes must be unique.",path:t})}const P5=I(["active","revoked","deleted","expired"]);I(["discovery_only","eval_candidate","demonstration_candidate","preference_candidate","reward_candidate"]);const O5=I(["invalid_evidence_receipt","consent_revoked","source_deleted","retention_expired","trace_incomplete","terminal_not_completed","infrastructure_failure","agent_snapshot_missing","input_not_reconstructable","environment_not_reconstructable","output_missing","validation_evidence_missing","verifier_missing","accepted_feedback_missing","correction_pair_missing","attempt_receipt_missing","attempt_receipt_invalid","attempt_receipt_unbound","attempt_not_reward_eligible"]),_c=v({eligible:z(),blockers:x(O5).max(32)}).strict().superRefine((e,t)=>{e.eligible===e.blockers.length>0&&t.addIssue({code:"custom",message:"Eligibility must be the inverse of blocker presence."})}),mI=v({schemaVersion:N(oI),evidenceReceiptHash:mt,policyState:P5,decisions:v({discovery_only:_c,eval_candidate:_c,demonstration_candidate:_c,preference_candidate:_c,reward_candidate:_c}).strict()}).strict(),j5=mI.extend({contentHash:mt}).strict();function fI(e){const t=R5(e.evidence),a=(e.feedback??[]).filter(j=>{if(!lI.safeParse(j).success)return!1;try{return dI(z5(j),e.evidence),!0}catch{return!1}}),i=N5(e.policyState),s=[...t?[]:["invalid_evidence_receipt"],...i],u=[...s,...e.evidence.trace.incomplete?["trace_incomplete"]:[],...e.evidence.agentSnapshot?[]:["agent_snapshot_missing"],...e.reconstructability.input?[]:["input_not_reconstructable"],...e.reconstructability.environment?[]:["environment_not_reconstructable"],...e.evidence.outputRefs.length?[]:["output_missing"],...e.reconstructability.verifier?[]:["verifier_missing"]],d=e.evidence.terminal.status==="completed",f=a.some(j=>j.verdict==="accepted"),b=[...u,...d?[]:["terminal_not_completed"],...e.evidence.terminal.failureClass==="infrastructure_failure"?["infrastructure_failure"]:[],...e.evidence.validationEvidenceRefs.length?[]:["validation_evidence_missing"],...f?[]:["accepted_feedback_missing"]],p=new Set(a.filter(j=>j.verdict==="accepted").flatMap(j=>j.outputRevisionRef?.contentHash??[])),y=a.some(j=>j.verdict==="needs_correction"&&j.outputRevisionRef!==null&&j.correctedOutputRevisionRef!==null&&p.has(j.correctedOutputRevisionRef.contentHash)),k=[...u,...y?[]:["correction_pair_missing"]],w=e.replay??null,T=w?tI.safeParse(w.attemptReceipt):null,A=T?.success===!0&&BL(T.data),H=w?.sourceEvidenceReceiptHash===e.evidence.contentHash,W=A&&H&&w.attemptReceipt.terminal&&w.attemptReceipt.failureClass!=="infrastructure_failure"&&w.attemptReceipt.failureClass!=="timeout"&&w.attemptReceipt.failureClass!=="cancelled"&&w.attemptReceipt.metadata.rewardEligible===!0&&typeof w.attemptReceipt.metadata.score=="number",B=[...s,...w?[]:["attempt_receipt_missing"],...w&&!A?["attempt_receipt_invalid"]:[],...w&&!H?["attempt_receipt_unbound"]:[],...w&&A&&H&&!W?["attempt_not_reward_eligible"]:[]],M=mI.parse({schemaVersion:oI,evidenceReceiptHash:e.evidence.contentHash,policyState:e.policyState,decisions:{discovery_only:Uu(s),eval_candidate:Uu(u),demonstration_candidate:Uu(b),preference_candidate:Uu(k),reward_candidate:Uu(B)}});return j5.parse({...M,contentHash:Kt(M)})}function N5(e){return e==="revoked"?["consent_revoked"]:e==="deleted"?["source_deleted"]:e==="expired"?["retention_expired"]:[]}function Uu(e){const t=[...new Set(e)];return _c.parse({eligible:t.length===0,blockers:t})}function z5(e){const{contentHash:t,...a}=e;return a}v({schemaVersion:N("openpond.workEvidenceAuthoringInput.v1"),evidenceReceiptRef:za,inputHash:mt,agentSnapshot:ht.nullable(),sanitizedTraceRef:za,outputRefs:x(za).max(1e4),validationEvidenceRefs:x(za).max(1e4),incomplete:z(),evalCandidate:z(),blockerCodes:x(l().trim().min(1).max(120)).max(32)}).strict();const nd="2026-08-04T12:00:00.000Z",pI="2026-08-04T12:00:02.500Z",dv=Kt({fixture:"desktop-work",revision:1}),ad=wd({contentHash:Kt("fixture output"),mediaType:"text/plain",sizeBytes:14}),hI=wd({contentHash:Kt({kind:"test",status:"passed"}),mediaType:"application/json",sizeBytes:null}),D5=wd({contentHash:Kt({scope:"work_process_and_artifacts",grantedAt:nd}),mediaType:"application/json",sizeBytes:null}),Pb=uI({schemaVersion:"openpond.workProcessTrace.v1",sourceRevisionHash:dv,sanitationPolicyVersion:"openpond.desktop-work-sanitizer.v1",incomplete:!1,incompleteReasons:[],droppedEventCount:1,steps:[xc(0,nd,"agent","state_transition","turn_started","started",{transitionState:"running"}),xc(1,"2026-08-04T12:00:00.500Z","agent","tool","tool_invoked","started",{toolCategory:"filesystem",inputHash:Kt({path:"hashed-only"}),receiptHash:Kt("fixture-tool-call")}),xc(2,"2026-08-04T12:00:01.000Z","environment","artifact","artifact_created","completed",{outputHash:ad.contentHash,artifacts:[ad],receiptHash:Kt("fixture-environment-operation"),parentReceiptHash:Kt("fixture-tool-call")}),xc(3,"2026-08-04T12:00:01.500Z","environment","validation","validation_completed","completed",{validationKind:"test",outputHash:hI.contentHash,receiptHash:Kt("fixture-validation"),parentReceiptHash:Kt("fixture-tool-call")}),xc(4,pI,"agent","state_transition","turn_completed","completed",{transitionState:"completed"})]}),U5=new TextEncoder().encode(kw(Pb)).byteLength,hg=wd({contentHash:Pb.contentHash,mediaType:"application/vnd.openpond.work-process-trace+json",sizeBytes:U5}),yl=A5({schemaVersion:"openpond.workEvidenceReceipt.v1",id:`work-evidence-${Kt([dv,hg.contentHash]).slice(0,24)}`,source:{surface:"desktop",experience:"work",opaqueRef:I5(["fixture-session","fixture-turn"]),revisionHash:dv},agentSnapshot:{id:"fixture-agent-snapshot",contentHash:Kt("fixture-agent")},model:{provider:"fixture",model:"scripted",revision:"1",artifactHash:null,tokenizerRevision:null,chatTemplateHash:null},runtime:{adapterId:"desktop-work",adapterVersion:"1",capabilityRef:null},inputHash:Kt("fixture prompt"),terminal:{status:"completed",failureClass:null},trace:{sanitizedRef:hg,traceHash:hg.contentHash,sanitationPolicyVersion:Pb.sanitationPolicyVersion,incomplete:!1},outputRefs:[ad],artifactRefs:[ad],validationEvidenceRefs:[hI],interventions:{approvals:0,questions:0,steeringEvents:0,otherUserInterventions:0},timing:{startedAt:nd,completedAt:pI,latencyMs:2500},usage:{promptTokens:12,completionTokens:8,totalTokens:20},costUsd:0,provenance:{consentReceiptRef:D5,consentScope:"work_process_and_artifacts",consentGrantedAt:nd,policyVersion:"openpond.work-evidence-policy.v1",projectorVersion:"openpond.desktop-work-evidence-projector.v1",disclosure:"portable_sanitized",ownershipScope:"personal",workspaceRef:null,participantPolicy:"creator_only",retention:{policy:"source_bound",deleteWithSource:!0,expiresAt:null}}}),gI=dI({schemaVersion:"openpond.workFeedbackReceipt.v1",id:`work-feedback-${Kt([yl.contentHash,"accepted"]).slice(0,24)}`,evidenceReceiptRef:T5(yl),outputRevisionRef:ad,verdict:"accepted",reasonCodes:["correct","complete"],correctionRef:null,correctedOutputRevisionRef:null,actor:"user",createdAt:"2026-08-04T12:01:00.000Z"},yl);uI({schemaVersion:"openpond.workProcessTrace.v1",sourceRevisionHash:Kt({fixture:"incomplete",revision:1}),sanitationPolicyVersion:"openpond.desktop-work-sanitizer.v1",incomplete:!0,incompleteReasons:["missing_terminal","unsupported_events_dropped"],droppedEventCount:2,steps:[xc(0,nd,"agent","state_transition","turn_started","started",{transitionState:"running"})]});fI({evidence:yl,feedback:[gI],policyState:"active",reconstructability:{input:!0,environment:!0,verifier:!0}});fI({evidence:yl,feedback:[gI],policyState:"revoked",reconstructability:{input:!0,environment:!0,verifier:!0}});({...yl,source:{...yl.source}});function xc(e,t,a,i,s,u,d){return{sequence:e,timestamp:t,layer:a,kind:i,action:s,status:u,inputHash:d.inputHash??null,outputHash:d.outputHash??null,receiptHash:d.receiptHash??null,parentReceiptHash:d.parentReceiptHash??null,artifactRefs:d.artifacts??[],attributes:{toolCategory:d.toolCategory??null,validationKind:d.validationKind??null,transitionState:d.transitionState??null,interventionOutcome:null,artifactCount:d.artifacts?.length??0,exitCode:null,durationMs:null,cpuTimeMs:null,memoryPeakBytes:null,errorClass:null}}}const L5=v({schemaVersion:N("openpond.graderEvidence.v1"),graderId:it,graderVersion:l().trim().min(1).max(100),score:S().min(0).max(1).nullable(),passed:z(),rewardEligible:z(),failureClass:Tf.nullable(),feedback:x(l().max(2e4)).max(1e3),visibleEvidenceRefs:x(it).max(1e4),privilegedEvidenceRefs:x(it).max(1e4)}).strict();L5.extend({contentHash:mt}).strict();const H5=l().trim().min(1).max(1e5),$5=I(["no_training","sft","preference","rl"]),q5=v({kind:I(["none","demonstrations","chosen_rejected","scalar_reward"]),strength:I(["absent","weak","usable"]),calibrated:z(),confounded:z(),variance:S().finite().nonnegative().nullable(),evidenceRefs:x(ht).max(1e5)}).strict(),vI=v({schemaVersion:N("openpond.modelImprovementQualificationReceipt.v1"),id:it,review:ht,harnessRelease:ht,tasksetRelease:ht.nullable(),baselineEvaluation:ht.nullable(),model:Yc,environmentHash:mt.nullable(),toolContractHash:mt.nullable(),permissionContractHash:mt.nullable(),policyHash:mt.nullable(),verifierRef:ht.nullable(),sourcePolicies:x(Tb).max(1e4),trainingEvidenceRefs:x(ht).max(1e5),frozenEvaluationEvidenceRefs:x(ht).max(1e5),privacyApproval:ht.nullable(),budgetApproval:ht.nullable(),maximumCostUsd:S().finite().nonnegative(),signal:q5,decision:$5,reasons:x(H5).min(1).max(100),createdAt:tn,metadata:ko}).strict().superRefine((e,t)=>{const a=new Set(e.trainingEvidenceRefs.map(w_));if(e.frozenEvaluationEvidenceRefs.some(s=>a.has(w_(s)))&&t.addIssue({code:"custom",message:"frozen Evaluation evidence cannot be used as training evidence",path:["frozenEvaluationEvidenceRefs"]}),e.decision==="no_training")return;(!e.tasksetRelease||!e.baselineEvaluation||!e.environmentHash||!e.toolContractHash||!e.permissionContractHash||!e.policyHash||!e.verifierRef||!e.privacyApproval||!e.budgetApproval||e.sourcePolicies.length===0||e.sourcePolicies.some(s=>s.state!=="authorized")||e.trainingEvidenceRefs.length===0||e.signal.strength!=="usable"||!e.signal.calibrated||e.signal.confounded)&&t.addIssue({code:"custom",message:"qualified model improvement requires frozen lineage, authorized signal, privacy, and budget gates"}),e.decision==="sft"&&e.signal.kind!=="demonstrations"&&t.addIssue({code:"custom",message:"SFT qualification requires demonstration signal",path:["signal","kind"]}),e.decision==="preference"&&e.signal.kind!=="chosen_rejected"&&t.addIssue({code:"custom",message:"preference qualification requires chosen/rejected signal",path:["signal","kind"]}),e.decision==="rl"&&(e.signal.kind!=="scalar_reward"||e.signal.variance===null||e.signal.variance<=0)&&t.addIssue({code:"custom",message:"RL qualification requires a usable scalar reward with variance",path:["signal"]})}),B5=vI.extend({contentHash:mt}).strict();function bI(e){const t=vI.parse(e);return B5.parse({...t,contentHash:Kt(t)})}function w_(e){return`${e.id}:${e.contentHash}`}const Cd="2026-08-08T12:00:00.000Z",yI=Zn("harness-release"),SI={policy:Zn("source-policy"),state:"authorized",checkedAt:Cd},Sl=(e,t)=>({evidence:Zn(e),kind:t,sourceRef:`source-${e}`,sourcePolicy:SI,occurrenceKey:Kt(`occurrence-${e}`),occurredAt:Cd}),V5={cursor:Kt("review-watermark"),throughCreatedAt:Cd},Uf=(e,t=3)=>({fingerprint:Kt(`claim-${e}`),recurrenceFamily:e,statement:`The ${e} behavior remains unresolved after smaller-layer triage.`,independentOccurrences:t,unresolvedOccurrences:t}),Lf=xd({schemaVersion:"openpond.harnessEvaluationReviewReceipt.v1",id:"review-no-action",ownerScope:{kind:"personal",id:"owner-1"},workspaceRef:"workspace-1",harnessRelease:yI,previousWatermark:null,nextWatermark:V5,selectedEvidence:[],excludedEvidence:[],claim:null,classification:"no_action",triage:[],reason:"The bounded evidence window contains no unresolved reusable claim.",nextAuthority:"none",maxEstimatedCostUsd:0,tasksetProposal:null,evaluation:null,trainingQualification:null,policyVersion:"harness-review-policy-v1",createdAt:Cd,metadata:{}});xd({...Id(Lf),id:"review-runtime",selectedEvidence:[Sl("runtime-failure","observation")],claim:Uf("runtime-transport-failure",1),classification:"runtime",triage:[{layer:"runtime",status:"unresolved",reason:"The adapter failed before model policy could affect the result.",evidenceRefs:[Zn("runtime-failure")]}],reason:"A deterministic runtime regression is the smallest correct fix.",nextAuthority:"runtime_service"});xd({...Id(Lf),id:"review-product",selectedEvidence:[Sl("product-routing","route_decision")],claim:Uf("product-routing-defect",1),classification:"product",triage:[{layer:"product",status:"unresolved",reason:"The product selected an unrelated Skill for an ordinary Work turn.",evidenceRefs:[Zn("product-routing")]}],reason:"Product routing must be corrected before behavioral Evaluation.",nextAuthority:"product_team"});const F5=xd({...Id(Lf),id:"review-taskset",selectedEvidence:[Sl("failure-1","work_outcome"),Sl("failure-2","work_outcome"),Sl("failure-3","work_outcome")],claim:Uf("search-budget-allocation"),classification:"taskset",triage:[{layer:"harness",status:"unresolved",reason:"The active research Skill did not resolve three independent failures.",evidenceRefs:[Zn("failure-1"),Zn("failure-2"),Zn("failure-3")]}],reason:"The repeated behavioral claim now needs controlled measurement.",nextAuthority:"human_review",tasksetProposal:Zn("taskset-proposal"),maxEstimatedCostUsd:2}),K5=bI({schemaVersion:"openpond.modelImprovementQualificationReceipt.v1",id:"qualification-rl-blocked",review:mv(F5),harnessRelease:yI,tasksetRelease:Zn("taskset-release"),baselineEvaluation:Zn("baseline-evaluation"),model:G5(),environmentHash:Kt("environment"),toolContractHash:Kt("tools"),permissionContractHash:Kt("permissions"),policyHash:Kt("policy"),verifierRef:Zn("verifier"),sourcePolicies:[SI],trainingEvidenceRefs:[Zn("training-evidence")],frozenEvaluationEvidenceRefs:[Zn("frozen-evidence")],privacyApproval:Zn("privacy-approval"),budgetApproval:Zn("budget-approval"),maximumCostUsd:25,signal:{kind:"scalar_reward",strength:"weak",calibrated:!0,confounded:!1,variance:0,evidenceRefs:[Zn("reward-audit")]},decision:"no_training",reasons:["The observed reward is constant and cannot support RL."],createdAt:Cd,metadata:{blockedMethod:"rl"}}),C_=bI({...Id(K5),id:"qualification-rl-qualified",signal:{kind:"scalar_reward",strength:"usable",calibrated:!0,confounded:!1,variance:.18,evidenceRefs:[Zn("reward-audit")]},decision:"rl",reasons:["The frozen baseline has usable variance and a calibrated sequential reward."]});xd({...Id(Lf),id:"review-model-improvement",selectedEvidence:[Sl("baseline-evaluation","evaluation"),Sl("qualification-rl-qualified","training_qualification")],claim:Uf("search-budget-allocation"),classification:"model_improvement",triage:[{layer:"model",status:"unresolved",reason:"Harness, runtime, product, retrieval, and tool triage left a qualified sequential policy gap.",evidenceRefs:[Zn("baseline-evaluation"),mv(C_)]}],reason:"The qualified claim may proceed to a separately approved managed-training plan.",nextAuthority:"training_system",tasksetProposal:Zn("taskset-proposal"),evaluation:Zn("baseline-evaluation"),trainingQualification:mv(C_),maxEstimatedCostUsd:25});function Zn(e){return{id:e,contentHash:Kt(e)}}function mv(e){return{id:e.id,contentHash:e.contentHash}}function Id(e){const{contentHash:t,...a}=e;return a}function G5(){return{provider:"openpond",model:"openpond-chat",revision:"model-revision-1",artifactHash:Kt("model-artifact"),tokenizerRevision:"tokenizer-1",chatTemplateHash:Kt("chat-template")}}function Z5(e,t,a){const i=new Headers;i.set("Accept","text/event-stream"),i.set("Authorization",`Bearer ${e.token}`);const s=new URL(`${e.serverUrl.replace(/\/$/,"")}/v1/events`);return a!==void 0&&Number.isSafeInteger(a)&&a>0&&s.searchParams.set("afterSequence",String(a)),{url:s.toString(),init:{headers:i,signal:t}}}function W5(e){return Math.min(500*2**Math.max(0,e),1e4)}async function Y5(e,t,a,i){_I(e);const s=e.body.getReader(),u=new TextDecoder;let d="";for(;!i?.aborted;){const{done:f,value:b}=await s.read();if(f){d+=u.decode();break}d+=u.decode(b,{stream:!0});let p=d.indexOf(`
|
|
133
133
|
|
|
134
134
|
`);for(;p>=0;){const y=d.slice(0,p);d=d.slice(p+2),A_(y,t,a),p=d.indexOf(`
|
|
135
135
|
|
|
136
136
|
`)}}!i?.aborted&&d.trim()&&A_(d,t,a)}function _I(e){if(!e.ok)throw new Error(`event stream failed: ${e.status} ${e.statusText||"HTTP error"}`);if(!e.body)throw new Error("event stream did not return a response body")}function J5(e,t,a,i,s={}){const u=new AbortController,d=s.fetchImpl??fetch,f=s.reconnectDelayMs??W5;let b=I_(s.afterSequence),p=!1;return(async()=>{let y=0;for(;!u.signal.aborted;)try{const k=Z5(e,u.signal,b),w=await d(k.url,k.init);if(_I(w),p=!0,y=0,await Y5(w,T=>{const A=I_(T.sequence);A>0&&A<=b||(A>0&&(b=A),t(T))},i,u.signal),p=!1,u.signal.aborted)break;throw new Error("event stream ended")}catch(k){if(p=!1,u.signal.aborted)break;a(k),await X5(f(y),u.signal),y+=1}})().catch(()=>{}),{close(){u.abort()},isOpen(){return p}}}function I_(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:0}function A_(e,t,a){let i="message";const s=[];for(const u of e.split(`
|
|
137
137
|
`))u.startsWith(":")||(u.startsWith("event: ")&&(i=u.slice(7).trim()),u.startsWith("data: ")&&s.push(u.slice(6)));if(i==="ready"){a?.();return}if(!(i!=="runtime"||s.length===0))try{t(JSON.parse(s.join(`
|
|
138
|
-
`)))}catch{}}async function X5(e,t){e<=0||t.aborted||await new Promise(a=>{const i=globalThis.setTimeout(a,e);t.addEventListener("abort",()=>{globalThis.clearTimeout(i),a()},{once:!0})})}function R_(e={}){const t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),t}async function ne(e,t,a){const i=new Headers(a?.headers);i.set("Content-Type","application/json"),i.set("Authorization",`Bearer ${e.token}`);const s=await fetch(`${e.serverUrl}${t}`,{...a,headers:i});if(!s.ok){const u=await s.json().catch(()=>({})),d=u&&typeof u=="object"&&"error"in u?String(u.error):s.statusText;throw new Error(d)}return await s.json()}function DG(e){const t=new URL("/v1/terminal",e.serverUrl);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.toString()}function UG(e){return["openpond-terminal",`openpond-token.${e6(e.token)}`]}function Q5(e){const t=new TextEncoder().encode(e);let a="";for(let i=0;i<t.length;i+=32768){const s=t.subarray(i,i+32768);a+=String.fromCharCode(...s)}return btoa(a)}function e6(e){return Q5(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function t6(e){const t=atob(e),a=new Uint8Array(t.length);for(let i=0;i<t.length;i+=1)a[i]=t.charCodeAt(i);return new TextDecoder().decode(a)}const n6={teamInvitations:e=>ne(e,"/v1/team-invitations"),decideTeamInvitation:(e,t,a)=>ne(e,`/v1/team-invitations/${t}`,{method:"POST",body:JSON.stringify({token:a})}),organizations:e=>ne(e,"/v1/organizations"),createOrganization:(e,t)=>ne(e,"/v1/organizations",{method:"POST",body:JSON.stringify(t)}),updateOrganization:(e,t,a)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(a)}),organizationMembers:(e,t)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}/members`),upsertOrganizationMember:(e,t,a)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}/members`,{method:"POST",body:JSON.stringify(a)}),organizationMcpServer:(e,t)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}/mcp-server`),generateOrganizationMcpServer:(e,t,a)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}/mcp-server`,{method:"POST",body:JSON.stringify(a)}),setOrganizationMcpServerStatus:(e,t,a)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}/mcp-server/${a}`,{method:"POST"})},a6={sendTurn:(e,t,a)=>ne(e,`/v1/sessions/${t}/turns`,{method:"POST",body:JSON.stringify(a)}),runSessionCommand:(e,t,a)=>ne(e,`/v1/sessions/${encodeURIComponent(t)}/commands`,{method:"POST",body:JSON.stringify(a)}),recordPreflightTurnFailure:(e,t,a)=>ne(e,`/v1/sessions/${t}/preflight-turns/failure`,{method:"POST",body:JSON.stringify(a)}),listCreateImproveRuns:(e,t={})=>ne(e,`/v1/create-improve-runs?${o6(t).toString()}`),getCreateImproveRun:(e,t)=>ne(e,`/v1/create-improve-runs/${encodeURIComponent(t)}`),getCreateImproveCandidateDiff:(e,t,a)=>ne(e,`/v1/create-improve-runs/${encodeURIComponent(t)}/candidates/${encodeURIComponent(a)}/diff`),applyCreateImproveAction:(e,t,a)=>ne(e,`/v1/create-improve-runs/${encodeURIComponent(t)}/actions`,{method:"POST",body:JSON.stringify(a)}),interruptTurn:(e,t)=>ne(e,`/v1/sessions/${t}/turns/interrupt`,{method:"POST"}),compactSession:(e,t,a={reason:"manual"})=>ne(e,`/v1/sessions/${t}/compact`,{method:"POST",body:JSON.stringify(a)}),workspaceTool:(e,t,a)=>ne(e,`/v1/sessions/${t}/workspace-tools`,{method:"POST",body:JSON.stringify(a)}),ensureCloudWorkspaceReady:(e,t,a)=>ne(e,`/v1/sessions/${encodeURIComponent(t)}/workspace/ensure-ready`,{method:"POST",body:JSON.stringify(a)})};function o6(e){const t=new URLSearchParams;return e.profileId&&t.set("profileId",e.profileId),e.conversationId&&t.set("conversationId",e.conversationId),e.targetKind&&t.set("targetKind",e.targetKind),e.targetId&&t.set("targetId",e.targetId),e.limit&&t.set("limit",String(e.limit)),t}const i6={sandboxFiles:(e,t,a={})=>{const i=new URLSearchParams({list:"1"});return a.path&&i.set("path",a.path),a.recursive!==void 0&&i.set("recursive",String(a.recursive)),a.maxEntries!==void 0&&i.set("maxEntries",String(a.maxEntries)),ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/files?${i.toString()}`)},sandboxUploadFile:(e,t,a)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/files`,{method:"POST",body:JSON.stringify(a)}),preserveSandboxSource:(e,t,a={})=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/preserve-source`,{method:"POST",body:JSON.stringify(a)}),sandboxDownloadFile:async(e,t,a,i={})=>{const s=new URLSearchParams({path:a});i.offsetBytes!==void 0&&s.set("offsetBytes",String(i.offsetBytes)),i.maxBytes!==void 0&&s.set("maxBytes",String(i.maxBytes));const u=await ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/files?${s.toString()}`);return{...u,contents:u.file.isBinary?"":t6(u.file.contentsBase64)}}},r6={sandboxGitStatus:(e,t)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/git/status`),sandboxGitDiff:(e,t,a)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/git/diff`,{method:"POST",body:JSON.stringify(a)})},s6={connectedAppStatus:(e,t={})=>{const a=R_(t);return a.set("status",t.status??"all"),ne(e,`/v1/connected-apps/status${a.size>0?`?${a.toString()}`:""}`)},integrationConnections:(e,t={})=>{const a=R_(t);return t.status&&a.set("status",t.status),ne(e,`/v1/integrations/connections${a.size>0?`?${a.toString()}`:""}`)},sandboxIntegrationLeases:(e,t)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/integrations`),attachSandboxIntegrationConnection:(e,t,a)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/integrations`,{method:"POST",body:JSON.stringify(a)}),removeSandboxIntegrationLease:(e,t,a)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/integrations`,{method:"DELETE",body:JSON.stringify({leaseId:a})})},l6={listSandboxProjects:(e,t)=>{const a=new URLSearchParams({teamId:t.teamId});return ne(e,`/v1/sandbox-projects?${a.toString()}`)},upsertSandboxProject:(e,t)=>ne(e,"/v1/sandbox-projects",{method:"POST",body:JSON.stringify(t)}),syncSandboxProject:(e,t,a)=>{const i=new URLSearchParams({teamId:a.teamId});return ne(e,`/v1/sandbox-projects/${encodeURIComponent(t)}/sync?${i.toString()}`,{method:"POST"})},uploadSandboxProjectSource:(e,t,a)=>{const i=new URLSearchParams({teamId:a.teamId}),{teamId:s,...u}=a;return ne(e,`/v1/sandbox-projects/${encodeURIComponent(t)}/source?${i.toString()}`,{method:"POST",body:JSON.stringify(u)})},archiveSandboxProject:(e,t,a)=>{const i=new URLSearchParams({teamId:a.teamId});return ne(e,`/v1/sandbox-projects/${encodeURIComponent(t)}?${i.toString()}`,{method:"DELETE"})},listSandboxAgents:(e,t)=>{const a=new URLSearchParams({teamId:t.teamId});return ne(e,`/v1/sandbox-agents?${a.toString()}`)},upsertSandboxAgent:(e,t)=>ne(e,"/v1/sandbox-agents",{method:"POST",body:JSON.stringify(t)}),runSandboxAgent:(e,t,a)=>ne(e,`/v1/sandbox-agents/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(a)}),runProfileAction:(e,t)=>ne(e,"/v1/profile/run",{method:"POST",body:JSON.stringify(t)})},c6={sandbox:(e,t)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}`)},u6={...s6,...l6,...c6,...r6,...i6},d6={communities:(e,t)=>{const a=new URLSearchParams;return t&&a.set("cursor",t),ne(e,`/v1/communities${a.size?`?${a}`:""}`)},communityPreview:(e,t)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/preview`),communityRules:(e,t)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/rules/current`),joinCommunity:(e,t,a)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/join`,{method:"POST",body:JSON.stringify({acceptedRulesVersionId:a})}),acceptCommunityRules:(e,t,a)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/rules/accept`,{method:"POST",body:JSON.stringify({acceptedRulesVersionId:a})}),leaveCommunity:(e,t)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/leave`,{method:"POST",body:"{}"}),communityChannels:(e,t)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels`),communityMessages:(e,t,a,i={})=>{const s=new URLSearchParams;return i.beforeSequence!=null&&s.set("beforeSequence",String(i.beforeSequence)),i.limit!=null&&s.set("limit",String(i.limit)),ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/messages${s.size?`?${s}`:""}`)},sendCommunityMessage:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/messages`,{method:"POST",body:JSON.stringify(i)}),editCommunityMessage:(e,t,a,i,s)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/messages/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify({body:s})}),deleteCommunityMessage:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/messages/${encodeURIComponent(i)}`,{method:"DELETE",body:"{}"}),markCommunityRead:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/read`,{method:"POST",body:JSON.stringify({sequence:i})}),setCommunityChannelMuted:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/mute`,{method:"POST",body:JSON.stringify({muted:i})}),searchCommunityMembers:(e,t,a={})=>{const i=new URLSearchParams;return a.query&&i.set("query",a.query),a.cursor&&i.set("cursor",a.cursor),a.limit!=null&&i.set("limit",String(a.limit)),ne(e,`/v1/communities/${encodeURIComponent(t)}/members/search${i.size?`?${i}`:""}`)},updateCommunityNotifications:(e,t,a)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/notifications`,{method:"POST",body:JSON.stringify({mode:a})}),communityEvents:(e,t,a={})=>{const i=new URLSearchParams;return a.after!=null&&i.set("after",String(a.after)),a.limit!=null&&i.set("limit",String(a.limit)),ne(e,`/v1/communities/${encodeURIComponent(t)}/events${i.size?`?${i}`:""}`)},communityRealtimeSession:(e,t)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/realtime-session`),uploadCommunityAttachment:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/attachments/upload`,{method:"POST",body:JSON.stringify({attachment:i})}),communityAttachmentDownload:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/attachments/${encodeURIComponent(i)}/download`)},Ob="openpond-app-server-url",od="openpond-app-token",m6=750;function xI(){return window.location.protocol!=="http:"&&window.location.protocol!=="https:"?null:window.location.origin&&window.location.origin!=="null"?window.location.origin:null}function fv(e){const t=e.getItem(Ob)?.trim(),a=e.getItem(od)?.trim();return t&&a?{serverUrl:t,token:a}:null}function lf(e){if(!e)return null;try{const t="__openpond_storage_probe__";return e.setItem(t,"1"),e.removeItem(t),e}catch{return null}}function bc(e,t){e.setItem(Ob,t.serverUrl),e.setItem(od,t.token)}function T_(e,t){const a=fv(e);a?.serverUrl!==t.serverUrl||a.token!==t.token||(e.removeItem(Ob),e.removeItem(od))}function f6(){const e=window.__OPENPOND_WEB_CONNECTION__,t=e?.serverUrl?.trim(),a=e?.token?.trim();return t&&a?{serverUrl:t,token:a}:null}function p6(){const e=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash;if(!e)return null;const t=new URLSearchParams(e),a=t.get("openpondToken")?.trim(),i=t.get("openpondServerUrl")?.trim()||xI();return!i||!a?null:{serverUrl:i,token:a}}function h6(){window.location.hash&&window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}`)}function Mm(e,t){t&&(e.some(a=>a.serverUrl===t.serverUrl&&a.token===t.token)||e.push(t))}function g6(){const e=[],t=lf(window.sessionStorage),a=lf(window.localStorage),i=xI(),s=t?.getItem(od)??a?.getItem(od);return Mm(e,null),Mm(e,i&&s?{serverUrl:i,token:s.trim()}:null),Mm(e,t?fv(t):null),Mm(e,a?fv(a):null),e}async function gg(e){const t=new AbortController,a=window.setTimeout(()=>t.abort(),m6);try{const i=await fetch(`${e}/health`,{signal:t.signal}),s=await i.json().catch(()=>null);return i.ok&&s?.server==="openpond-app-server"}catch{return!1}finally{window.clearTimeout(a)}}async function v6(){if(window.openpond)return window.openpond.getConnection();const e=lf(window.sessionStorage),t=lf(window.localStorage),a=p6();if(a&&await gg(a.serverUrl))return t&&bc(t,a),e&&bc(e,a),h6(),{...a,platform:navigator.platform};const i=f6();if(i&&await gg(i.serverUrl))return t&&bc(t,i),e&&bc(e,i),{...i,platform:navigator.platform};const s=g6();for(const u of s){if(await gg(u.serverUrl))return t&&bc(t,u),e&&bc(e,u),{...u,platform:navigator.platform};e&&T_(e,u),t&&T_(t,u)}throw new Error("No reachable OpenPond app server. Start `openpond ui` again and open the full printed URL.")}const de={...d6,bootstrap:e=>ne(e,"/v1/bootstrap?refreshCodex=1"),extensionCatalog:e=>ne(e,"/v1/extensions"),extensionPreview:(e,t)=>ne(e,"/v1/extensions/preview",{method:"POST",body:JSON.stringify(t)}),extensionAdd:(e,t)=>ne(e,"/v1/extensions",{method:"POST",body:JSON.stringify(t)}),extensionUpdate:(e,t,a={})=>ne(e,`/v1/extensions/github/${encodeURIComponent(t.owner)}/${encodeURIComponent(t.repo)}/update`,{method:"POST",body:JSON.stringify(a)}),extensionUpdateAll:e=>ne(e,"/v1/extensions/update-all",{method:"POST"}),extensionRemove:(e,t)=>ne(e,`/v1/extensions/github/${encodeURIComponent(t.owner)}/${encodeURIComponent(t.repo)}`,{method:"DELETE"}),skillSourceFile:(e,t,a,i)=>ne(e,`/v1/skills/${t}/${encodeURIComponent(a)}/source?path=${encodeURIComponent(i)}`),teamChatMembers:(e,t)=>ne(e,`/v1/team-chat/members?teamId=${encodeURIComponent(t)}`),teamChatAgents:(e,t)=>ne(e,`/v1/team-chat/agents?teamId=${encodeURIComponent(t)}`),teamChatThreads:(e,t)=>ne(e,`/v1/team-chat/threads?teamId=${encodeURIComponent(t)}`),teamChatRealtimeSession:(e,t)=>ne(e,`/v1/team-chat/realtime-session?teamId=${encodeURIComponent(t)}`),teamChatEvents:(e,t,a={})=>{const i=new URLSearchParams({teamId:t});return a.after!=null&&i.set("after",String(a.after)),a.limit!=null&&i.set("limit",String(a.limit)),ne(e,`/v1/team-chat/events?${i.toString()}`)},teamChatGeneral:(e,t)=>ne(e,"/v1/team-chat/threads/general",{method:"POST",body:JSON.stringify({teamId:t})}),teamChatDm:(e,t,a)=>ne(e,"/v1/team-chat/threads/dm",{method:"POST",body:JSON.stringify({teamId:t,otherUserId:a})}),teamChatThread:(e,t,a,i={})=>{const s=new URLSearchParams({teamId:t});return i.beforeSequence!=null&&s.set("beforeSequence",String(i.beforeSequence)),i.limit!=null&&s.set("limit",String(i.limit)),ne(e,`/v1/team-chat/threads/${encodeURIComponent(a)}?${s.toString()}`)},uploadTeamChatAttachment:(e,t,a)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/attachments/upload`,{method:"POST",body:JSON.stringify(a)}),teamChatAttachmentDownload:(e,t,a)=>ne(e,`/v1/team-chat/attachments/${encodeURIComponent(a)}/download?teamId=${encodeURIComponent(t)}`),sendTeamChatMessage:(e,t,a)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/messages`,{method:"POST",body:JSON.stringify(a)}),createTeamChatAgentRun:(e,t,a)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/agent-runs`,{method:"POST",body:JSON.stringify(a)}),teamChatAgentConversation:(e,t,a)=>ne(e,`/v1/team-chat/agent-runs/${encodeURIComponent(a)}?teamId=${encodeURIComponent(t)}`),editTeamChatMessage:(e,t,a,i)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/messages/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(i)}),deleteTeamChatMessage:(e,t,a,i)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/messages/${encodeURIComponent(a)}`,{method:"DELETE",body:JSON.stringify({teamId:i})}),markTeamChatRead:(e,t,a,i)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/read`,{method:"POST",body:JSON.stringify({teamId:a,sequence:i})}),setTeamChatThreadMuted:(e,t,a,i)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/mute`,{method:"POST",body:JSON.stringify({teamId:a,muted:i})}),createTeamChatAiThread:(e,t,a)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/ai-threads`,{method:"POST",body:JSON.stringify(a)}),teamChatAiThread:(e,t,a)=>ne(e,`/v1/team-chat/ai-threads/${encodeURIComponent(a)}?teamId=${encodeURIComponent(t)}`),sendTeamChatAiTurn:(e,t,a)=>ne(e,`/v1/team-chat/ai-threads/${encodeURIComponent(t)}/turns`,{method:"POST",body:JSON.stringify(a)}),executeTeamChatAiTurn:(e,t,a)=>ne(e,`/v1/team-chat/ai-turns/${encodeURIComponent(t)}/execute`,{method:"POST",body:JSON.stringify({teamId:a})}),cancelTeamChatAiTurnExecution:(e,t,a)=>ne(e,`/v1/team-chat/ai-turns/${encodeURIComponent(t)}/execute/cancel`,{method:"POST",body:JSON.stringify({teamId:a})}),usage:(e,t={})=>{const a=E_(t),i=a.size?`?${a.toString()}`:"";return ne(e,`/v1/usage${i}`)},usageRecords:(e,t={})=>{const a=E_(t);t.sessionId&&a.set("sessionId",t.sessionId),t.turnId&&a.set("turnId",t.turnId),t.limit!==void 0&&a.set("limit",String(t.limit));const i=a.size?`?${a.toString()}`:"";return ne(e,`/v1/usage/records${i}`)},runtimeEventsPage:(e,t={})=>{const a=new URLSearchParams;t.sessionId&&a.set("sessionId",t.sessionId),t.afterSequence!==void 0&&a.set("afterSequence",String(t.afterSequence)),t.beforeSequence!==void 0&&t.beforeSequence!==null&&a.set("beforeSequence",String(t.beforeSequence)),t.limit!==void 0&&a.set("limit",String(t.limit));const i=a.size?`?${a.toString()}`:"";return ne(e,`/v1/events/page${i}`)},workOutputs:e=>ne(e,"/v1/work/outputs"),harnessHistory:e=>ne(e,"/v1/harness"),updateHarnessBackgroundReview:(e,t)=>ne(e,"/v1/harness/background-review",{method:"POST",body:JSON.stringify(t)}),reviewHarnessEvaluation:(e,t)=>ne(e,"/v1/harness/evaluation-review",{method:"POST",body:JSON.stringify(t)}),updateHarnessEvaluationReviewSchedule:(e,t)=>ne(e,"/v1/harness/evaluation-review/settings",{method:"POST",body:JSON.stringify(t)}),harnessReleaseDiff:(e,t)=>ne(e,"/v1/harness/diff",{method:"POST",body:JSON.stringify(t)}),rollbackHarness:(e,t)=>ne(e,"/v1/harness/rollback",{method:"POST",body:JSON.stringify(t)}),reviewHarnessProposal:(e,t)=>ne(e,"/v1/harness/review",{method:"POST",body:JSON.stringify(t)}),runSubagentLifecycleAction:(e,t,a)=>ne(e,`/v1/subagents/${encodeURIComponent(t)}/lifecycle`,{method:"POST",body:JSON.stringify(a)}),trainingState:(e,t)=>ne(e,`/v1/training?profileId=${encodeURIComponent(t)}`),trainingActivity:(e,t)=>ne(e,`/v1/training/activity?profileId=${encodeURIComponent(t)}`),portableTrainingCatalog:(e,t="",a)=>{const i=new URLSearchParams;return t.trim()&&i.set("query",t.trim()),a&&i.set("method",a),ne(e,`/v1/training/catalog${i.size?`?${i.toString()}`:""}`)},datasetCatalog:(e,t)=>ne(e,`/v1/training/datasets?profileId=${encodeURIComponent(t)}`),trainingRunDetail:(e,t)=>ne(e,`/v1/training/jobs/${encodeURIComponent(t)}/detail`),trainingRequest:(e,t,a,i="POST")=>ne(e,`/v1/training${t}`,{method:i,body:i==="GET"||i==="DELETE"?void 0:JSON.stringify(a)}),datasetStorageState:e=>ne(e,"/v1/settings/dataset-storage"),updateDatasetStorage:(e,t)=>ne(e,"/v1/settings/dataset-storage",{method:"PATCH",body:JSON.stringify({datasetStorePath:t})}),hostedSavedWork:e=>ne(e,"/v1/saved-work"),createHostedSavedWork:(e,t)=>ne(e,"/v1/saved-work",{method:"POST",body:JSON.stringify(t)}),updateHostedSavedWork:(e,t,a)=>ne(e,`/v1/saved-work/schedules/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(a)}),deleteHostedSavedWork:(e,t)=>ne(e,`/v1/saved-work/schedules/${encodeURIComponent(t)}`,{method:"DELETE"}),runHostedSavedWork:(e,t,a)=>ne(e,`/v1/saved-work/schedules/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify({clientRequestId:a})}),localAgentSchedules:(e,t={})=>{const a=new URLSearchParams;t.localProjectId&&a.set("localProjectId",t.localProjectId);const i=a.size?`?${a.toString()}`:"";return ne(e,`/v1/local-agent-schedules${i}`)},syncLocalAgentSchedules:e=>ne(e,"/v1/local-agent-schedules/sync",{method:"POST",body:JSON.stringify({})}),patchLocalAgentSchedule:(e,t,a)=>ne(e,`/v1/local-agent-schedules/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(a)}),runLocalAgentSchedule:(e,t,a={})=>ne(e,`/v1/local-agent-schedules/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(a)}),localAgentScheduleRuns:(e,t,a={})=>{const i=new URLSearchParams;a.limit!==void 0&&i.set("limit",String(a.limit));const s=i.size?`?${i.toString()}`:"";return ne(e,`/v1/local-agent-schedules/${encodeURIComponent(t)}/runs${s}`)},refreshOpenPondAccounts:e=>ne(e,"/v1/openpond/accounts/refresh",{method:"POST",body:JSON.stringify({})}),refreshOpenPondAccount:e=>ne(e,"/v1/openpond/account?refresh=1"),loadMoreOpenPondApps:(e,t)=>ne(e,`/v1/openpond/apps/more?offset=${encodeURIComponent(String(t.offset))}&limit=${encodeURIComponent(String(t.limit))}`),switchOpenPondAccount:(e,t)=>ne(e,"/v1/openpond/accounts/switch",{method:"POST",body:JSON.stringify(t)}),removeOpenPondAccount:(e,t)=>ne(e,"/v1/openpond/accounts",{method:"DELETE",body:JSON.stringify(t)}),saveOpenPondAccount:(e,t)=>ne(e,"/v1/openpond/accounts/login",{method:"POST",body:JSON.stringify(t)}),updateOpenPondAccountConfig:(e,t)=>ne(e,"/v1/openpond/accounts/config",{method:"PATCH",body:JSON.stringify(t)}),savePreferences:(e,t)=>ne(e,"/v1/preferences",{method:"PATCH",body:JSON.stringify(t)}),saveProviderSettings:(e,t)=>ne(e,"/v1/providers",{method:"PATCH",body:JSON.stringify(t)}),providerSettings:e=>ne(e,"/v1/providers"),loadProviderModels:(e,t,a={})=>{const i=new URLSearchParams;a.query?.trim()&&i.set("query",a.query.trim()),a.limit&&i.set("limit",String(a.limit));const s=i.size?`?${i.toString()}`:"";return ne(e,`/v1/providers/${encodeURIComponent(t)}/models${s}`)},refreshProviderModels:(e,t,a)=>ne(e,`/v1/providers/${encodeURIComponent(t)}/models`,{method:"POST",body:JSON.stringify(a)}),saveProviderCredential:(e,t,a)=>ne(e,`/v1/providers/${encodeURIComponent(t)}/credential`,{method:"PUT",body:JSON.stringify(a)}),deleteProviderCredential:(e,t,a)=>ne(e,`/v1/providers/${encodeURIComponent(t)}/credential`,{method:"DELETE",body:JSON.stringify(a)}),startOpenAiSubscriptionAuth:(e,t)=>ne(e,"/v1/providers/openai/subscription-auth",{method:"POST",body:JSON.stringify(t)}),validateProviderCredential:(e,t,a)=>ne(e,`/v1/providers/${encodeURIComponent(t)}/validate`,{method:"POST",body:JSON.stringify(a)}),savePersonalization:(e,t)=>ne(e,"/v1/personalization",{method:"PATCH",body:JSON.stringify(t)}),recordClientDiagnostic:(e,t)=>ne(e,"/v1/diagnostics/client",{method:"POST",body:JSON.stringify(t)}),profileCurrent:e=>ne(e,"/v1/profile"),profileCatalog:e=>ne(e,"/v1/profile/catalog"),profileSelect:(e,t)=>ne(e,"/v1/profile/select",{method:"POST",body:JSON.stringify({ref:t})}),profileRemove:(e,t)=>ne(e,"/v1/profile/remove",{method:"POST",body:JSON.stringify({ref:t})}),profilePublicationPreview:(e,t)=>ne(e,"/v1/profile/publication/preview",{method:"POST",body:JSON.stringify(t)}),profilePublicationPublish:(e,t)=>ne(e,"/v1/profile/publication/publish",{method:"POST",body:JSON.stringify(t)}),profileInstall:(e,t)=>ne(e,"/v1/profile/install",{method:"POST",body:JSON.stringify(t)}),profileUpdate:(e,t)=>ne(e,"/v1/profile/update",{method:"POST",body:JSON.stringify({ref:t})}),profileInit:(e,t)=>ne(e,"/v1/profile/init",{method:"POST",body:JSON.stringify(t)}),profileLoad:(e,t)=>ne(e,"/v1/profile/load",{method:"POST",body:JSON.stringify(t)}),profileCheck:(e,t)=>ne(e,"/v1/profile/check",{method:"POST",body:JSON.stringify(t)}),profileAgentRename:(e,t,a)=>ne(e,`/v1/profile/agents/${encodeURIComponent(t)}/name`,{method:"PATCH",body:JSON.stringify(a)}),profileCommit:(e,t)=>ne(e,"/v1/profile/commit",{method:"POST",body:JSON.stringify(t)}),profilePush:(e,t)=>ne(e,"/v1/profile/push",{method:"POST",body:JSON.stringify(t)}),workspaceLspSettingsStatus:e=>ne(e,"/v1/lsp/settings-status"),workspaceLspRuntimeStatus:e=>ne(e,"/v1/lsp/status"),restartWorkspaceLsp:e=>ne(e,"/v1/lsp/restart",{method:"POST"}),remoteAccess:e=>ne(e,"/v1/remote-access"),enableRemoteAccess:e=>ne(e,"/v1/remote-access/enable",{method:"POST"}),disableRemoteAccess:e=>ne(e,"/v1/remote-access/disable",{method:"POST"}),voiceTranscriptionStatus:e=>ne(e,"/v1/audio/transcriptions/status"),transcribeVoice:(e,t)=>ne(e,"/v1/audio/transcriptions",{method:"POST",body:JSON.stringify(t)}),createSession:(e,t)=>ne(e,"/v1/sessions",{method:"POST",body:JSON.stringify(t)}),patchSession:(e,t,a)=>ne(e,`/v1/sessions/${t}`,{method:"PATCH",body:JSON.stringify(a)}),codexHistoryThread:(e,t,a={})=>{const i=new URLSearchParams;a.limit!==void 0&&i.set("limit",String(a.limit)),a.tail&&i.set("tail","1");const s=i.size?`?${i.toString()}`:"";return ne(e,`/v1/codex-history/${encodeURIComponent(t)}${s}`)},codexHistoryThreadIncremental:(e,t,a={})=>{const i=new URLSearchParams({incremental:"1"});return a.afterEventId&&i.set("afterEventId",a.afterEventId),a.limit!==void 0&&i.set("limit",String(a.limit)),a.revision&&i.set("revision",a.revision),a.tail&&i.set("tail","1"),ne(e,`/v1/codex-history/${encodeURIComponent(t)}?${i.toString()}`)},sendCodexHistoryTurn:(e,t,a)=>ne(e,`/v1/codex-history/${encodeURIComponent(t)}/turns`,{method:"POST",body:JSON.stringify(a)}),interruptCodexHistoryTurn:(e,t)=>ne(e,`/v1/codex-history/${encodeURIComponent(t)}/turns/interrupt`,{method:"POST"}),patchSidebarAppPreference:(e,t,a)=>ne(e,`/v1/sidebar/apps/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(a)}),reorderSidebarApps:(e,t)=>ne(e,"/v1/sidebar/apps/reorder",{method:"POST",body:JSON.stringify(t)}),sidebarFiles:e=>ne(e,"/v1/sidebar/files"),patchSidebarFile:(e,t)=>ne(e,"/v1/sidebar/files",{method:"PATCH",body:JSON.stringify(t)}),workspaceStatus:(e,t,a=!1,i={})=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}${a?"?ensure=1":""}`,{signal:i.signal}),createWorkspaceBranch:(e,t,a)=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/branches`,{method:"POST",body:JSON.stringify(a)}),checkoutWorkspaceBranch:(e,t,a)=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/branch`,{method:"PATCH",body:JSON.stringify(a)}),workspaceDiff:(e,t,a={})=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/diff`,{signal:a.signal}),workspaceFile:(e,t,a)=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/file?path=${encodeURIComponent(a)}`),saveWorkspaceFile:(e,t,a)=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/file`,{method:"PATCH",body:JSON.stringify(a)}),signWorkspaceImageUrl:(e,t)=>ne(e,"/v1/assets/workspace-image-url",{method:"POST",body:JSON.stringify(t)}),signLocalImageUrl:(e,t)=>ne(e,"/v1/assets/local-image-url",{method:"POST",body:JSON.stringify(t)}),signLocalVideoUrl:(e,t)=>ne(e,"/v1/assets/local-video-url",{method:"POST",body:JSON.stringify(t)}),signChatAttachmentImageUrl:(e,t)=>ne(e,"/v1/assets/chat-attachment-image-url",{method:"POST",body:JSON.stringify(t)}),chatAttachmentFile:(e,t)=>ne(e,"/v1/assets/chat-attachment-file",{method:"POST",body:JSON.stringify(t)}),workspaceLspTouch:(e,t,a,i={})=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/lsp/touch`,{method:"POST",body:JSON.stringify(a),signal:i.signal}),workspaceLspAction:(e,t,a)=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/lsp/action`,{method:"POST",body:JSON.stringify(a)}),workspaceTemplateConfig:(e,t)=>ne(e,`/v1/openpond/apps/${encodeURIComponent(t)}/template-config`),...n6,...u6,createLocalProject:(e,t)=>ne(e,"/v1/projects",{method:"POST",body:JSON.stringify(t)}),updateLocalProjectAgentSetup:(e,t,a)=>ne(e,`/v1/projects/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(a)}),uploadLocalProjectCloudSource:(e,t,a)=>ne(e,`/v1/projects/${encodeURIComponent(t)}/cloud-source`,{method:"POST",body:JSON.stringify(a)}),previewLocalProjectCloudSource:(e,t,a={})=>{const i=new URLSearchParams;a.branch?.trim()&&i.set("branch",a.branch.trim());const s=i.toString()?`?${i.toString()}`:"";return ne(e,`/v1/projects/${encodeURIComponent(t)}/cloud-source/preview${s}`)},deleteLocalProject:(e,t)=>ne(e,`/v1/projects/${encodeURIComponent(t)}`,{method:"DELETE"}),gitAvailability:e=>ne(e,"/v1/system/git"),installMacOSCommandLineTools:e=>ne(e,"/v1/system/git/install-command-line-tools",{method:"POST",body:JSON.stringify({})}),...a6,resolveApproval:(e,t,a)=>ne(e,`/v1/approvals/${t}`,{method:"POST",body:JSON.stringify(a)})};function E_(e){const t=new URLSearchParams;return e.range&&t.set("range",e.range),e.visibility&&t.set("visibility",e.visibility),e.status&&t.set("status",e.status),e.provider&&t.set("provider",e.provider),e.model&&t.set("model",e.model),t}const b6="modulepreload",y6=function(e,t){return new URL(e,t).href},M_={},Al=function(t,a,i){let s=Promise.resolve();if(a&&a.length>0){let p=function(y){return Promise.all(y.map(k=>Promise.resolve(k).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};const d=document.getElementsByTagName("link"),f=document.querySelector("meta[property=csp-nonce]"),b=f?.nonce||f?.getAttribute("nonce");s=p(a.map(y=>{if(y=y6(y,i),y in M_)return;M_[y]=!0;const k=y.endsWith(".css"),w=k?'[rel="stylesheet"]':"";if(i)for(let A=d.length-1;A>=0;A--){const H=d[A];if(H.href===y&&(!k||H.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${w}`))return;const T=document.createElement("link");if(T.rel=k?"stylesheet":b6,k||(T.as="script"),T.crossOrigin="",T.href=y,b&&T.setAttribute("nonce",b),document.head.appendChild(T),k)return new Promise((A,H)=>{T.addEventListener("load",A),T.addEventListener("error",()=>H(new Error(`Unable to preload CSS for ${y}`)))})}))}function u(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return s.then(d=>{for(const f of d||[])f.status==="rejected"&&u(f.reason);return t().catch(u)})};const S6=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_6=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,i)=>i?i.toUpperCase():a.toLowerCase()),P_=e=>{const t=_6(e);return t.charAt(0).toUpperCase()+t.slice(1)},kI=(...e)=>e.filter((t,a,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===a).join(" ").trim(),x6=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var k6={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const w6=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:i,className:s="",children:u,iconNode:d,...f},b)=>_.createElement("svg",{ref:b,...k6,width:t,height:t,stroke:e,strokeWidth:i?Number(a)*24/Number(t):a,className:kI("lucide",s),...!u&&!x6(f)&&{"aria-hidden":"true"},...f},[...d.map(([p,y])=>_.createElement(p,y)),...Array.isArray(u)?u:[u]]));const Ht=(e,t)=>{const a=_.forwardRef(({className:i,...s},u)=>_.createElement(w6,{ref:u,iconNode:t,className:kI(`lucide-${S6(P_(e))}`,`lucide-${e}`,i),...s}));return a.displayName=P_(e),a};const C6=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],I6=Ht("activity",C6);const A6=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],R6=Ht("archive-restore",A6);const T6=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],E6=Ht("arrow-left",T6);const M6=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],P6=Ht("bookmark",M6);const O6=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]],j6=Ht("bookmark-x",O6);const N6=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]],O_=Ht("book-open-text",N6);const z6=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],D6=Ht("boxes",z6);const U6=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],L6=Ht("calendar-clock",U6);const H6=[["path",{d:"M11 13H7",key:"t0o9gq"}],["path",{d:"M19 9h-4",key:"rera1j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]],wI=Ht("chart-column-stacked",H6);const $6=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Tc=Ht("check",$6);const q6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],B6=Ht("circle-check",q6);const V6=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Lc=Ht("chevron-down",V6);const F6=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],id=Ht("chevron-right",F6);const K6=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],CI=Ht("cloud",K6);const G6=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Z6=Ht("credit-card",G6);const W6=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Y6=Ht("download",W6);const J6=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],vg=Ht("external-link",J6);const X6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],II=Ht("file-text",X6);const Q6=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],eH=Ht("github",Q6);const tH=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],AI=Ht("earth",tH);const nH=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aH=Ht("circle-question-mark",nH);const oH=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],iH=Ht("list-filter",oH);const rH=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],sH=Ht("loader-circle",rH);const lH=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],cH=Ht("maximize-2",lH);const uH=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],jb=Ht("message-square",uH);const dH=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],mH=Ht("ellipsis",dH);const fH=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],RI=Ht("panel-left",fH);const pH=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],pv=Ht("panel-right",pH);const hH=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],gH=Ht("pin",hH);const vH=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],bH=Ht("pin-off",vH);const yH=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],SH=Ht("plug",yH);const _H=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],xH=Ht("plus",_H);const kH=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],wH=Ht("search",kH);const CH=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Nb=Ht("settings",CH);const IH=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],TI=Ht("square-terminal",IH);const AH=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],RH=Ht("user-round",AH);const TH=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Hf=Ht("x",TH);function EH({platform:e}){return!$f()||zb(e)?null:E.jsxs("div",{className:"window-controls","aria-label":"Window controls",children:[E.jsx("button",{type:"button",className:"window-control minimize",title:"Minimize",onClick:()=>{bg("minimize")},children:E.jsx(Lc,{size:14})}),E.jsx("button",{type:"button",className:"window-control maximize",title:"Maximize",onClick:()=>{bg("toggleMaximize")},children:E.jsx(cH,{size:12})}),E.jsx("button",{type:"button",className:"window-control close",title:"Close",onClick:()=>{bg("close")},children:E.jsx(Hf,{size:13})})]})}function zb(e){const t=e?.toLowerCase()??"";return t==="darwin"||t.includes("mac")}function $f(){if(typeof window>"u")return!1;const e=window.openpond;return!!(e?.minimizeWindow||e?.toggleMaximizeWindow||e?.closeWindow)}async function bg(e){const t=window.openpond;if(!(t&&(e==="minimize"?await t.minimizeWindow?.():e==="toggleMaximize"?await t.toggleMaximizeWindow?.():await t.closeWindow?.())!==!1)){if(e==="toggleMaximize"&&document.fullscreenEnabled){document.fullscreenElement?await document.exitFullscreen():await document.documentElement.requestFullscreen();return}if(e==="close"){window.close();return}console.warn("Window controls require the Electron desktop shell.")}}const MH=[{destination:"walkthroughs",icon:O_,label:"Walkthroughs"},{destination:"external",icon:O_,label:"Docs",url:"https://openpond.ai/docs"},{destination:"external",icon:II,label:"Blog",url:"https://openpond.ai/blog"},{destination:"external",icon:Z6,label:"Pricing",url:"https://openpond.ai/pricing"},{destination:"external",icon:AI,label:"Web app",url:"https://openpond.ai/sandboxes"},{destination:"external",icon:eH,label:"GitHub",url:"https://github.com/openpond/openpond"},{destination:"external",icon:jb,label:"Submit issue",url:"https://github.com/openpond/openpond/issues/new/choose"}];function PH({onOpenWalkthroughs:e,walkthroughsActive:t}){const[a,i]=_.useState(!1),s=_.useRef(null);return _.useEffect(()=>{if(!a)return;function u(f){s.current?.contains(f.target)||i(!1)}function d(f){f.key==="Escape"&&i(!1)}return document.addEventListener("pointerdown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",u),document.removeEventListener("keydown",d)}},[a]),E.jsxs("div",{className:"sidebar-help-menu",ref:s,children:[E.jsx("button",{"aria-expanded":a,"aria-haspopup":"menu","aria-label":"Open docs and help menu",className:`sidebar-icon sidebar-help-trigger ${t?"active":""}`,"data-tooltip":"Help",onClick:()=>i(u=>!u),type:"button",children:E.jsx(aH,{size:17})}),a?E.jsx("div",{className:"sidebar-help-popover",role:"menu","aria-label":"Help",children:MH.map(u=>{const d=u.icon,f=E.jsxs(E.Fragment,{children:[E.jsx(d,{size:15}),E.jsx("span",{children:u.label})]});return u.destination==="walkthroughs"?E.jsx("button",{"aria-current":t?"page":void 0,className:"sidebar-help-item",onClick:()=>{i(!1),e()},role:"menuitem",type:"button",children:f},u.label):E.jsx("a",{className:"sidebar-help-item",href:u.url,onClick:b=>{b.preventDefault(),i(!1),OH(u.url)},rel:"noreferrer",role:"menuitem",target:"_blank",children:f},u.label)})}):null]})}async function OH(e){const t=window.openpond?.browser;t?.openExternal&&(await t.openExternal({conversationId:"openpond-help",url:e})).ok||window.open(e,"_blank","noopener,noreferrer")}const LG=[{value:"chat",label:"Chat"},{value:"work",label:"Work"}],yg=[{value:"chat",label:"Work",description:"Chat and complete tasks"},{value:"models",label:"Models",description:"Evaluate, train, and serve models"}];function EI(e){return e==="chat"?"New chat":"New task"}const hv="modelsTab",Sg="openpond:models-tab-change",jH=new Set(["models","tasksets","serving","usage"]);function j_(e){const t=new URLSearchParams(e).get(hv);return t&&jH.has(t)?t:"models"}function NH(e,t){const a=new URLSearchParams(e);t==="models"?a.delete(hv):a.set(hv,t);const i=a.toString();return i?`?${i}`:""}function zH({experience:e="work",productArea:t="chat",beginNewChat:a,setSectionMenuOpen:i,setSelectedAppId:s,setSelectedProjectId:u,setSelectedSessionId:d,setView:f,view:b}){const[p,y]=_.useState(()=>typeof window>"u"?"models":j_(window.location.search));_.useEffect(()=>{const T=()=>y(j_(window.location.search));return window.addEventListener("popstate",T),window.addEventListener(Sg,T),()=>{window.removeEventListener("popstate",T),window.removeEventListener(Sg,T)}},[]);function k(){s(null),u(null),d(null),i(null)}function w(T){k(),f("labs"),y(T);const A=NH(window.location.search,T);window.history.pushState(window.history.state,"",`${window.location.pathname}${A}${window.location.hash}`),window.dispatchEvent(new Event(Sg))}return E.jsxs("nav",{className:"sidebar-nav","aria-label":"Primary",children:[t==="models"?null:E.jsxs("button",{className:"nav-command nav-command-new-task",type:"button",onClick:()=>a(null),children:[E.jsx(xH,{size:18}),E.jsx("span",{children:EI(e)})]}),t==="models"?E.jsxs(E.Fragment,{children:[E.jsxs("button",{className:`nav-command ${b==="labs"&&p==="models"?"active":""}`,"aria-label":"Models",type:"button",onClick:()=>w("models"),children:[E.jsx(wI,{size:16}),E.jsx("span",{children:"Models"})]}),E.jsxs("button",{className:`nav-command ${b==="labs"&&p==="tasksets"?"active":""}`,"aria-label":"Tasksets",type:"button",onClick:()=>w("tasksets"),children:[E.jsx(D6,{size:16}),E.jsx("span",{children:"Tasksets"})]}),E.jsxs("button",{className:`nav-command ${b==="labs"&&p==="serving"?"active":""}`,"aria-label":"Serving",type:"button",onClick:()=>w("serving"),children:[E.jsx(CI,{size:16}),E.jsx("span",{children:"Serving"})]}),E.jsxs("button",{className:`nav-command ${b==="labs"&&p==="usage"?"active":""}`,"aria-label":"Usage",type:"button",onClick:()=>w("usage"),children:[E.jsx(I6,{size:16}),E.jsx("span",{children:"Usage"})]})]}):null,t==="chat"?E.jsxs(E.Fragment,{children:[E.jsxs("button",{className:`nav-command nav-command-prominent ${b==="scheduled"?"active":""}`,"aria-label":"Scheduled",type:"button",onClick:()=>{k(),f("scheduled")},children:[E.jsx(L6,{size:18}),E.jsx("span",{children:"Scheduled"})]}),E.jsxs("button",{className:`nav-command nav-command-prominent ${b==="outputs"?"active":""}`,"aria-label":"My files",type:"button",onClick:()=>{k(),f("outputs")},children:[E.jsx(II,{size:18}),E.jsx("span",{children:"My files"})]})]}):null]})}function DH({setSectionMenuOpen:e,setSelectedAppId:t,setSelectedProjectId:a,setSelectedSessionId:i,setView:s,view:u}){function d(){t(null),a(null),i(null),e(null),s("get-started")}return E.jsx("nav",{className:"sidebar-utility-nav","aria-label":"Resources",children:E.jsx(PH,{onOpenWalkthroughs:d,walkthroughsActive:u==="get-started"})})}const Zm=5,Za=15,gv=10,rn={defaultChatProvider:xl,subagents:fj(),codexPermissionMode:If,codexReasoningEffort:Af,openPondCommandAccessMode:fd,defaultBranchPrefix:"feat/",defaultNewProjectDirectory:"",advancedWorkspaceControls:!1,contextCompaction:{autoEnabled:!0,triggerPercent:85,summaryModel:"same_model"},training:{defaultModelRef:null,creationMode:"customize",autoApproveEvidence:!1},sidebarWidth:332,diffPanelWidth:560,sidebarSectionsCollapsed:{pinned:!1,projects:!1,cloudProjects:!1,chats:!1,savedForLater:!0},editor:{languageServers:"auto",diagnosticsWhileEditing:!0,checkOnSave:!0,languages:{typescript:{mode:"auto",customCommand:""},python:{mode:"auto",customCommand:""},rust:{mode:"auto",customCommand:""}}}},HG={activeTemplateId:"default",customized:!1,soul:"",soulPath:null,updatedAt:null,templates:[]},MI=[{value:md,label:"DeepSeek V4 Pro",description:"reasoning"},{value:"accounts/fireworks/models/kimi-k3",label:"Kimi K3",description:"reasoning"},{value:"accounts/fireworks/models/glm-5p2",label:"GLM-5.2",description:"reasoning"},{value:"accounts/fireworks/models/deepseek-v4-pro",label:"DeepSeek V4 Pro (Fireworks)",description:"reasoning"},{value:"accounts/fireworks/models/deepseek-v4-flash",label:"DeepSeek V4 Flash (Fireworks)",description:"reasoning"},{value:"accounts/fireworks/models/minimax-m3",label:"MiniMax M3",description:"reasoning"}],_g=[{value:"openpond",label:"OpenPond Chat"},{value:"codex",label:"OpenAI Codex",description:"Codex login"}],UH=["openai","xai","openrouter","deepseek","zai","moonshot","together","groq","custom-openai-compatible"],LH=["openpond","codex",...UH],PI=new Set(LH),OI=[{value:eb,label:"GPT-5.6 Sol"},{value:"gpt-5.6-terra",label:"GPT-5.6 Terra"},{value:"gpt-5.6-luna",label:"GPT-5.6 Luna"},{value:"gpt-5.5",label:"GPT-5.5"},{value:"gpt-5.4",label:"GPT-5.4"},{value:"gpt-5.4-mini",label:"GPT-5.4 Mini"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex"},{value:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark"},{value:"gpt-5.2",label:"GPT-5.2"}],$G=[{value:"default",label:"Default permissions",shortLabel:"Default",description:"Workspace sandbox; asks before crossing boundaries."},{value:"auto-review",label:"Auto-review",description:"Workspace sandbox; reviewer handles eligible approvals."},{value:"full-access",label:"Full access",description:"No sandbox or approval prompts."}],qG=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra High",shortLabel:"Extra High"}],BG=[{value:"ask",label:"Ask",description:"Ask before running shell commands."},{value:"full-access",label:"Full access",description:"Run shell commands without approval prompts."}],VG=[{value:"auto",label:"Auto",description:"Use installed language servers when available."},{value:"off",label:"Off",description:"Disable editor language servers."}],FG=[{value:"auto",label:"Auto",description:"Find the local executable automatically."},{value:"disabled",label:"Disabled",description:"Do not start this language server."},{value:"custom",label:"Custom",description:"Use a specific executable path or command name."}];function Db(e){return e.kind==="local"}function HH(e){return e.kind==="cloud"}function Dt(e,t){return`${e}:${t}`}function jI(e){const t=e?.trim();if(!t)return null;const a=t.indexOf(":");if(a<=0)return{kind:"local",id:t};const i=t.slice(0,a),s=t.slice(a+1);return(i==="local"||i==="cloud")&&s?{kind:i,id:s}:{kind:"local",id:t}}function vl(e){return`${e.type}:${e.id}`}function cf(e){const t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?"before":"after"}function uf(e,t,a,i="before"){if(t===a)return e;const s=e.filter(d=>d!==t),u=s.indexOf(a);return u===-1?e:(s.splice(i==="after"?u+1:u,0,t),s)}function N_(e,t){return e.length===t.length&&e.every((a,i)=>a===t[i])}function $H(e,t){if(!t)return e;const a=new Map(e.map(u=>[u.key,u])),i=t.map(u=>a.get(u)).filter(u=>!!u),s=new Set(i.map(u=>u.key));return[...i,...e.filter(u=>!s.has(u.key))]}function Ub(e,t){return e?.statuses?.[t]??null}function NI(e,t){return e?.providers?.[t]??null}function zI(e,t){return e?.modelCaches?.[t]??null}function qH(e){const t=[e.contextWindow?`${Math.round(e.contextWindow/1e3)}K context`:"",e.capabilities.reasoning?"reasoning":"",e.source].filter(Boolean);return{value:e.id,label:e.displayName||e.id,description:t.join(" · ")||void 0}}function BH(e){return e==="openpond"?MI:e==="codex"||e==="openai"?OI:[]}function VH(e){const t=new Set,a=[];for(const i of e)!i.value||t.has(i.value)||(t.add(i.value),a.push(i));return a}function KG(e){return PI.has(e)}function vv(e,t={}){if(!e)return t.localOnly,_g;const a=t.includeUnavailable??!1,i=t.enabledOnly??!1,s=[];for(const u of Vv){if(!PI.has(u)||t.localOnly&&u==="openpond")continue;const d=Ub(e,u);d&&(!a&&(u==="codex"&&!d.available&&!d.credential.connected||u!=="openpond"&&u!=="codex"&&!d.enabled)||i&&u!=="openpond"&&!d.enabled||i&&u==="codex"&&!d.available&&!d.credential.connected||s.push({value:u,label:u==="openpond"?"OpenPond Chat":d.displayName,description:u==="openpond"?void 0:d.available?"Connected":d.credential.connected?"Configured":d.routing.localByok?"Set up key":d.enabled?"Enabled":void 0}))}return s.length>0?s:_g}function rd(e,t){const i=(zI(t,e)?.models??[]).map(qH),s=NI(t,e),u=[...s?.modelOverrides??[],s?.defaultModel].filter(d=>!!d?.trim()).map(d=>({value:d,label:d}));return VH([...i,...u,...BH(e)])}function FH(e,t,a){if(e==="codex"||e==="openai")return!0;const i=t.trim();if(!i)return!1;const s=zI(a,e)?.models.find(u=>u.id===i);return s?!!s.capabilities.reasoning:rd(e,a).some(u=>u.value===i&&/\breasoning\b/i.test(u.description??""))}function df(e,t){const a=NI(t,e)?.defaultModel?.trim();if(a)return a;const i=Ub(t,e)?.defaultModel?.trim();if(i)return i;const s=rd(e,t)[0]?.value?.trim();return s||(e==="codex"?eb:e==="openpond"?md:"")}function Ls(e,t,a){const i=t?.trim();if(e==="codex"&&(i==="codex-default"||i==="gpt-5.5"))return eb;const s=rd(e,a);return i&&s.some(u=>u.value===i)||i&&e!=="codex"&&s.length===0&&!a?i:df(e,a)}function DI(e,t){const a=e.modelRef?.providerId??e.provider;return{provider:a,model:Ls(a,e.modelRef?.modelId,t)}}function Lb(e,t,a){return Ls(e,t,a)||void 0}function xi(e,t,a){const i=Lb(e,t,a);return i?{providerId:e,modelId:i}:void 0}function z_(e){return e==="full-access"?{approvalPolicy:"never",sandbox:"danger-full-access"}:{approvalPolicy:"on-request",sandbox:"workspace-write"}}function Uo(e){const t=e?.defaultChatProvider??rn.defaultChatProvider;return{defaultChatProvider:t,defaultChatModel:Ls(t,e?.defaultChatModel),subagents:Yu.parse(e?.subagents??rn.subagents),codexPermissionMode:e?.codexPermissionMode??rn.codexPermissionMode,codexReasoningEffort:e?.codexReasoningEffort??rn.codexReasoningEffort,openPondCommandAccessMode:e?.openPondCommandAccessMode??rn.openPondCommandAccessMode,defaultBranchPrefix:UI(e?.defaultBranchPrefix),defaultNewProjectDirectory:e?.defaultNewProjectDirectory??rn.defaultNewProjectDirectory,defaultTeamId:e?.defaultTeamId?.trim()||null,advancedWorkspaceControls:e?.advancedWorkspaceControls??rn.advancedWorkspaceControls,contextCompaction:{autoEnabled:e?.contextCompaction?.autoEnabled??rn.contextCompaction.autoEnabled,triggerPercent:e?.contextCompaction?.triggerPercent??rn.contextCompaction.triggerPercent,summaryModel:e?.contextCompaction?.summaryModel??rn.contextCompaction.summaryModel},training:{defaultModelRef:e?.training?.defaultModelRef??rn.training.defaultModelRef,creationMode:e?.training?.creationMode??rn.training.creationMode,autoApproveEvidence:e?.training?.autoApproveEvidence??rn.training.autoApproveEvidence},sidebarWidth:e?.sidebarWidth??rn.sidebarWidth,diffPanelWidth:e?.diffPanelWidth??rn.diffPanelWidth,sidebarSectionsCollapsed:{pinned:e?.sidebarSectionsCollapsed?.pinned??rn.sidebarSectionsCollapsed.pinned,projects:e?.sidebarSectionsCollapsed?.projects??rn.sidebarSectionsCollapsed.projects,cloudProjects:e?.sidebarSectionsCollapsed?.cloudProjects??rn.sidebarSectionsCollapsed.cloudProjects,chats:e?.sidebarSectionsCollapsed?.chats??rn.sidebarSectionsCollapsed.chats,savedForLater:e?.sidebarSectionsCollapsed?.savedForLater??rn.sidebarSectionsCollapsed.savedForLater},editor:{languageServers:e?.editor?.languageServers??rn.editor.languageServers,diagnosticsWhileEditing:e?.editor?.diagnosticsWhileEditing??rn.editor.diagnosticsWhileEditing,checkOnSave:e?.editor?.checkOnSave??rn.editor.checkOnSave,languages:{typescript:{mode:e?.editor?.languages?.typescript?.mode??rn.editor.languages.typescript.mode,customCommand:e?.editor?.languages?.typescript?.customCommand??rn.editor.languages.typescript.customCommand},python:{mode:e?.editor?.languages?.python?.mode??rn.editor.languages.python.mode,customCommand:e?.editor?.languages?.python?.customCommand??rn.editor.languages.python.customCommand},rust:{mode:e?.editor?.languages?.rust?.mode??rn.editor.languages.rust.mode,customCommand:e?.editor?.languages?.rust?.customCommand??rn.editor.languages.rust.customCommand}}}}}function UI(e){const t=e?.trim()??rn.defaultBranchPrefix;if(!t)return"";const i=t.toLowerCase().replace(/[^a-z0-9._/-]+/g,"-").replace(/\/{2,}/g,"/").replace(/^-+/,"").slice(0,48).split("/").map(s=>s.replace(/^-+|-+$/g,"")).filter(Boolean).join("/");return i?`${i}/`:""}function GG(e,t){return e==="openpond"?"OpenPond Chat":Ub(t,e)?.displayName??(e==="codex"?"OpenAI Codex":e)}function ZG(e,t,a){if(a){const i=rd(a,t).find(s=>s.value===e);if(i)return i.label}if(t)for(const i of Vv){const s=rd(i,t).find(u=>u.value===e);if(s)return s.label}return[...MI,...OI].find(i=>i.value===e)?.label??e}function KH(e,t){return t==="chat"?e.filter(a=>a.experience==="chat"):e.filter(a=>a.experience==="work"||a.experience==="development")}function GH(e){return e.experience==="chat"?"Chat":"Work"}const Hb="taskDraft";function LI(e){if(e?.experience!=="work")return null;const t=e.metadata?.[Hb];if(!t||typeof t!="object"||Array.isArray(t))return null;const a=t.prompt;return typeof a=="string"&&a.trim()?a:null}function qf(e){return LI(e)!==null}function ZH(e){return(e.split(/\r?\n/u).map(a=>a.trim()).find(Boolean)||"Task draft").slice(0,64)}function xg(e,t,a=new Date().toISOString()){const i={version:1,prompt:t,savedAt:a};return{...e??{},[Hb]:i}}function WH(e){const t={...e??{}};return delete t[Hb],t}function Es(e){const t=Pm(e.metadata?.trainingTasksetId)??Pm(e.metadata?.tasksetId);return t?{id:t,name:Pm(e.metadata?.trainingTasksetName)??Pm(e.metadata?.tasksetName)??YH(t)}:null}function YH(e){const a=e.replace(/[-_][a-f0-9]{8,}$/i,"").replace(/^(?:benchmark[-_])?taskset[-_]/i,"").replace(/^benchmark[-_]/i,"").split(/[-_]+/).filter(Boolean);return a.length===0?"Taskset":a.map(i=>/^[A-Z0-9]{2,}$/.test(i)?i:`${i.charAt(0).toUpperCase()}${i.slice(1)}`).join(" ")}function Pm(e){return typeof e=="string"&&e.trim()?e.trim():null}const D_=[{value:"active",label:"Active"},{value:"in_progress",label:"In progress"},{value:"pinned",label:"Pinned"},{value:"saved_for_later",label:"Save for later"},{value:"tasksets",label:"Tasksets"},{value:"done",label:"Done"},{value:"all",label:"All"}],JH=[{value:"recent",label:"Recent first"},{value:"manual",label:"Manual order"}];function U_(e){const t=[];if(e.filter==="done")t.push(...e.doneSessions.filter(i=>!Es(i)));else if(e.filter==="all")t.push(...e.activeSessions.filter(i=>!Es(i)),...e.doneSessions.filter(i=>!Es(i)));else if(e.filter==="tasksets")t.push(...e.activeSessions.filter(i=>L_(i,e.selectedTasksetId)),...e.doneSessions.filter(i=>L_(i,e.selectedTasksetId)));else for(const i of e.activeSessions)Es(i)||(e.filter==="active"?i.savedForLater||t.push(i):e.filter==="in_progress"?!i.savedForLater&&e.inProgressSessionIds.has(i.id)&&t.push(i):e.filter==="pinned"?i.pinned&&!i.savedForLater&&t.push(i):e.filter==="saved_for_later"&&i.savedForLater&&t.push(i));const a=e.previewSessionIds?new Map(e.previewSessionIds.map((i,s)=>[i,s])):null;return e.sort==="recent"?t.sort((i,s)=>$_(i,s,a)):t.sort((i,s)=>{const u=a?.get(i.id),d=a?.get(s.id);if(u!==void 0||d!==void 0){if(u===void 0)return 1;if(d===void 0)return-1;if(u!==d)return u-d}return i.order!==s.order?i.order-s.order:$_(i,s)})}function L_(e,t){const a=Es(e);return!!(a&&(!t||a.id===t))}function XH(e){return e.filter==="saved_for_later"||e.filter==="tasksets"?{count:Math.max(0,e.activeCount),label:"In Progress",targetFilter:"active",targetLabel:"active"}:{count:Math.max(0,e.savedForLaterCount),label:"Later",targetFilter:"saved_for_later",targetLabel:"saved for later"}}function QH(e,t){switch(e){case"active":return`No active ${t}`;case"in_progress":return"No work in progress";case"pinned":return`No pinned ${t}`;case"saved_for_later":return"Nothing saved for later";case"tasksets":return"No Taskset chats yet";case"done":return`No done ${t}`;case"all":return`No ${t}`}}function H_(e,t,a){const i=new Set(t);let s=0;return e.map(u=>{if(!i.has(u))return u;const d=a[s];return s+=1,d??u})}function $_(e,t,a=null){const i=mf(e),s=mf(t);if(i!==s)return i?-1:1;if(i&&s){const d=a?.get(e.id),f=a?.get(t.id);if(d!==void 0||f!==void 0){if(d===void 0)return 1;if(f===void 0)return-1;if(d!==f)return d-f}if(e.order!==t.order)return e.order-t.order}const u=Date.parse(t.updatedAt)-Date.parse(e.updatedAt);return u!==0?u:e.title.localeCompare(t.title)}function mf(e){return e.pinned&&!e.savedForLater&&!e.archived}function HI(e){return`${e.kind}:${e.id}`}function sd(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}function e$(e){return{kind:"session",id:e}}function t$(e){return{kind:"project",id:e}}function n$(e){return{kind:"draft",id:e}}function a$(e){return e.selectedSessionId?e$(e.selectedSessionId):e.selectedProjectId?t$(e.selectedProjectId):n$(e.selectedAppId?`app:${e.selectedAppId}`:"new-chat")}function o$(e){if(!e.previousScope||e.previousScope.kind!=="draft"||e.activeScope.kind!=="session")return[...e.tabs];if(sd(e.previousScope,e.activeScope))return[...e.tabs];const t=e.now??Date.now();return e.tabs.map(a=>sd(a.scope,e.previousScope)?{...a,scope:e.activeScope,updatedAt:t}:a)}function WG(e,t){return e.filter(a=>sd(a.scope,t))}function YG(e,t){return!!(e&&sd(e.scope,t))}function i$(e){const t={};for(const a of e){const i=HI(a.scope),s=t[i]??{scope:a.scope,tabCount:0,runningCount:0,failedCount:0,lastExitCode:null,status:"none"};s.tabCount+=1,a.commandStatus==="running"&&(s.runningCount+=1),(a.commandStatus==="failed"||a.status==="error")&&(s.failedCount+=1),a.lastExitCode!==null&&(s.lastExitCode=a.lastExitCode),s.status=s$(s.status,a.status,a.commandStatus),t[i]=s}return t}function r$(e){return!e||e.status==="none"||e.tabCount===0?null:e.status==="running"?{status:"running",label:"Terminal running"}:e.status==="failed"?{status:"failed",label:"Terminal last command failed"}:e.status==="success"?{status:"success",label:"Terminal last command succeeded"}:e.status==="idle"?{status:"idle",label:"Terminal idle"}:{status:"unknown",label:"Terminal open"}}function s$(e,t,a){return a==="running"?"running":e==="running"?e:a==="failed"||t==="error"?"failed":e==="failed"?e:a==="success"?e==="none"||e==="unknown"||e==="idle"?"success":e:a==="idle"?e==="none"||e==="unknown"?"idle":e:e==="none"?"unknown":e}function l$(e,t){if(!e)return t?.path??"Use files on this machine";if(e.error)return"status unavailable";if(!e.initialized)return"not checked out";const i=[e.currentBranch??t?.branch??e.defaultBranch??"no branch"],s=d$(e),u=t?.linkedCloudSourceKnown===!1&&!!e.headCommit;return s?i.push(s):u?i.push("upload required"):e.diverged?(e.ahead>0&&i.push(Ms("ahead",e.ahead)),e.behind>0&&i.push(Ms("behind",e.behind)),i.push("diverged")):(e.ahead>0&&i.push(Ms("ahead",e.ahead)),e.behind>0&&i.push(Ms("behind",e.behind))),e.changedFilesCount>0?i.push(`${e.changedFilesCount} changed`):e.dirty&&i.push("dirty"),e.untrackedFilesCount>0&&i.push(`${e.untrackedFilesCount} untracked`),i.length===1&&i.push("synced"),i.join(" / ")}function c$(e,t,a,i={}){const s=e?.linkedSandboxProject??null;if(!s?.projectId&&!t)return"upload required";if(s?.projectId&&i.cloudLinkTrusted===!1)return"uploaded to a different account";const u=s?.defaultBranch??t?.defaultBranch??"main",d=s?.manifestHash??null,f=e?.sandboxTemplate?.manifestHash??null,b=s?.syncedAt??t?.syncedAt??null,p=!!(d&&f&&d!==f),y=!!(s?.projectId&&a?.headCommit&&!s.lastUploadedCommit),k=m$(a);return k?`${u} / ${k}`:y?`${u} / upload required`:`${u} / ${p||!b?"needs sync":"setup ready"}`}function u$(e,t,a={}){if(!e)return"select a local project";if(e.linkedSandboxProject?.projectId&&a.cloudLinkTrusted===!1)return"sync to this account";if(!t)return e.linkedSandboxProject?"sync source to cloud":"push local source to cloud";if(t.error)return"repo status unavailable";if(!t.initialized)return"local repo unavailable";const i=[],s=t.aheadOfLinkedSource>0?t.aheadOfLinkedSource:t.ahead;return e.linkedSandboxProject?.projectId||i.push("upload required"),e.linkedSandboxProject?.projectId&&t.headCommit&&!e.linkedSandboxProject.lastUploadedCommit&&i.push("upload required"),s>0&&i.push($I(s)),t.linkedSourceHeadCommit&&t.headCommit&&t.linkedSourceHeadCommit!==t.headCommit&&t.linkedSourceComparisonError&&s===0&&i.push("source changed"),t.changedFilesCount>0&&i.push(`${t.changedFilesCount} changed file${t.changedFilesCount===1?"":"s"}`),t.untrackedFilesCount>0&&i.push(`${t.untrackedFilesCount} untracked skipped`),i.length>0?i.join(" / "):"nothing to upload"}function d$(e){return e.linkedSourceHeadCommit?e.divergedFromLinkedSource?"diverged":e.aheadOfLinkedSource>0?Ms("local ahead",e.aheadOfLinkedSource):e.behindLinkedSource>0?Ms("cloud ahead",e.behindLinkedSource):e.linkedSourceComparisonError&&e.headCommit&&e.linkedSourceHeadCommit!==e.headCommit?"sync unknown":null:null}function m$(e){return e?.linkedSourceHeadCommit?e.dirty?"local dirty files not in cloud":e.divergedFromLinkedSource?"diverged from local":e.aheadOfLinkedSource>0?Ms("cloud behind local",e.aheadOfLinkedSource):e.behindLinkedSource>0?Ms("cloud ahead local",e.behindLinkedSource):e.linkedSourceComparisonError&&e.headCommit&&e.linkedSourceHeadCommit!==e.headCommit?"source check unavailable":"synced":null}function Ms(e,t){return`${e} by ${$I(t)}`}function $I(e){return`${e} commit${e===1?"":"s"}`}function f$({session:e,onSave:t,onClose:a}){const[i,s]=_.useState(e.title),u=_.useRef(null);_.useEffect(()=>{const b=u.current;b&&(b.focus(),b.select())},[]),_.useEffect(()=>{function b(p){p.key==="Escape"&&a()}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[a]);function d(){const b=i.trim();b&&(t(b),a())}function f(b){b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),d())}return E.jsx("div",{className:"git-dialog-backdrop rename-chat-backdrop",role:"presentation",onMouseDown:a,children:E.jsxs("section",{className:"git-dialog rename-chat-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"rename-chat-title",onMouseDown:b=>b.stopPropagation(),children:[E.jsx("h2",{id:"rename-chat-title",children:"Rename chat"}),E.jsx("textarea",{ref:u,className:"rename-chat-input",value:i,rows:1,maxLength:200,onChange:b=>s(b.target.value),onKeyDown:f,"aria-label":"Chat title"}),E.jsxs("div",{className:"git-dialog-footer",children:[E.jsx("button",{type:"button",className:"git-dialog-secondary",onClick:a,children:"Cancel"}),E.jsx("button",{type:"button",className:"git-dialog-primary",autoFocus:!0,onClick:d,disabled:!i.trim(),children:"Save"})]})]})})}const p$=2650,h$=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}),g$=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit"}),v$=new Intl.DateTimeFormat("en-US",{dateStyle:"medium",timeStyle:"short"});function b$(){return{animationDelay:`${-(Date.now()%p$)}ms`}}function y$(e){const t=e.currentTarget,a=t.firstElementChild;if(!(a instanceof HTMLElement))return;const i=Math.max(0,a.scrollWidth-t.clientWidth),s=i>2;t.dataset.overflowing=String(s),t.style.setProperty("--sidebar-title-ticker-distance",`${-i}px`),t.style.setProperty("--sidebar-title-ticker-duration",`${Math.min(6.5,Math.max(2.8,i/42+2.4))}s`)}function S$({label:e,actions:t,actionsVisible:a=!1,className:i,titleAccessory:s,children:u,collapsed:d=!1,titleActive:f=!1,onTitleClick:b,onToggleCollapsed:p}){return E.jsxs("section",{className:["sidebar-section",i,a?"actions-visible":""].filter(Boolean).join(" "),children:[E.jsxs("div",{className:"section-header",children:[E.jsxs("div",{className:"section-title-row",children:[b?E.jsxs("div",{className:"section-title-combo",children:[E.jsx("button",{type:"button",className:`section-title-link${f?" active":""}`,onClick:b,children:E.jsx("span",{children:e})}),p&&E.jsx("button",{type:"button",className:"section-chevron-button","aria-label":`${d?"Expand":"Collapse"} ${e}`,"aria-expanded":!d,onClick:p,children:d?E.jsx(id,{size:13}):E.jsx(Lc,{size:13})})]}):p?E.jsxs("button",{type:"button",className:"section-title-button","aria-label":`${d?"Expand":"Collapse"} ${e}`,"aria-expanded":!d,onClick:p,children:[E.jsx("span",{children:e}),d?E.jsx(id,{size:13}):E.jsx(Lc,{size:13})]}):E.jsx("span",{children:e}),s]}),t&&E.jsx("div",{className:"section-actions",children:t})]}),!d&&E.jsx("div",{className:"sidebar-section-body",children:u})]})}function q_({children:e,expanded:t=!1,onClick:a}){return E.jsx("button",{type:"button",className:"sidebar-show-more",onClick:a,children:e??(t?"Show less":"Show more")})}function B_({session:e,selected:t,icon:a,archived:i=!1,hideIcon:s=!1,nested:u=!1,dragging:d,placeholder:f,running:b,goalRuntime:p,subagentRuntime:y,terminalIndicator:k,projectLabel:w,childSessionCount:T=0,childSessionsExpanded:A=!1,onSelect:H,onToggleChildSessions:W,onTogglePin:B,onToggleSaveForLater:M,onDockRight:j,onArchive:L,onDragStart:D,onDragEnd:q,onDragOver:$,onDrop:X,onRename:ae}){const[ie,ue]=_.useState(!1),ge=p?.status==="queued",Te=p?.tone==="active"&&!ge,Be=(y?.activeCount??0)>0,Pe=T>0&&!!W,U=s&&!Pe,le=Be||Te||!ge&&(b??e.status==="active"),he=Be&&y?y.label:Te&&p?_$(p):"Running",Me=["sidebar-task-row",qf(e)?"is-draft":"",j?"actions-4":M?"actions-3":"",le?"has-running-dot":"",w?"has-project-detail":""].filter(Boolean).join(" "),Ue=_.useMemo(b$,[]),O=E.jsxs("div",{className:`sidebar-row-actions${w?" sidebar-task-inline-actions":""}`,children:[j?E.jsx(Om,{label:"Open in right panel",onClick:j,children:E.jsx(pv,{size:13})}):null,E.jsx(Om,{label:e.pinned?"Unpin chat":"Pin chat",onClick:B,children:e.pinned?E.jsx(bH,{size:13}):E.jsx(gH,{size:13})}),M?E.jsx(Om,{label:e.savedForLater?"Return to active":"Save for later",onClick:M,children:e.savedForLater?E.jsx(j6,{size:13}):E.jsx(P6,{size:13})}):null,E.jsx(Om,{label:i?"Reopen":"Mark done",onClick:L,children:i?E.jsx(R6,{size:13}):E.jsx(Tc,{size:13})})]}),Z=E.jsxs(w$,{selected:t,dataSessionId:e.id,dragging:d,iconless:U,nested:u,placeholder:f,className:Me||void 0,ariaExpanded:Pe?A:void 0,onSelect:H,onDragStart:D,onDragEnd:q,onDragOver:$,onDrop:X,onDoubleClick:ae?()=>ue(!0):void 0,children:[U?null:Pe?E.jsx("button",{type:"button",className:"sidebar-child-toggle","data-tooltip":A?"Hide subagent conversations":"Show subagent conversations","aria-label":`${A?"Hide":"Show"} ${T} subagent ${T===1?"conversation":"conversations"}`,"aria-expanded":A,onClick:ve=>{ve.stopPropagation(),W?.()},children:A?E.jsx(Lc,{size:13}):E.jsx(id,{size:13})}):a??E.jsx(jb,{size:15}),E.jsxs("span",{className:`row-label-shell${w?" has-detail":""}`,children:[E.jsxs("span",{className:"sidebar-session-title-line",children:[E.jsx("span",{className:"row-label sidebar-task-title","data-overflowing":"false",onPointerEnter:y$,children:E.jsx("span",{className:"sidebar-task-title-text",children:e.title})}),w?null:E.jsx(V_,{value:e.updatedAt})]}),w?E.jsxs("span",{className:"sidebar-session-detail-line",children:[E.jsx("span",{className:"sidebar-session-project-label",children:w}),O,E.jsx(V_,{value:e.updatedAt})]}):null]}),E.jsxs("div",{className:"row-meta",children:[E.jsxs("span",{className:"row-meta-status",children:[k?E.jsx(k$,{indicator:k}):null,le?E.jsx("span",{className:`sidebar-running-dot${Be?" subagent":Te?" goal":""}`,style:Ue,"aria-label":he}):null]}),w?null:O]})]}),be=ie&&ae?E.jsx(f$,{session:e,onSave:ve=>ae(e,ve),onClose:()=>ue(!1)}):null;return E.jsxs(E.Fragment,{children:[Z,be]})}function _$(e){return e.actionLabel}function V_({value:e}){const t=x$(e);if(!t||!e)return null;const a=new Date(e);return E.jsx("time",{className:"sidebar-row-updated-at",dateTime:e,title:`Last updated ${v$.format(a)}`,children:t})}function x$(e,t=new Date){if(!e)return null;const a=new Date(e);if(Number.isNaN(a.getTime()))return null;const i=g$.format(a);return a.getFullYear()===t.getFullYear()&&a.getMonth()===t.getMonth()&&a.getDate()===t.getDate()?i:`${h$.format(a)} ${i}`}function k$({indicator:e}){return E.jsx("span",{className:`sidebar-terminal-indicator ${e.status}`,"data-tooltip":e.label,"aria-label":e.label,title:e.label,children:E.jsx(TI,{size:13})})}function w$({children:e,className:t,dataSessionId:a,dragging:i,iconless:s=!1,nested:u=!1,placeholder:d=!1,selected:f,ariaExpanded:b,ariaDescribedBy:p,onSelect:y,onDragStart:k,onDragEnd:w,onDragOver:T,onDrop:A,onDoubleClick:H}){const W=!!k;return E.jsx("div",{className:["sidebar-row",t??"",f?"selected":"",i?"dragging":"",s?"iconless":"",u?"nested":"",d?"placeholder":""].filter(Boolean).join(" "),draggable:W,"data-session-id":a,role:"button",tabIndex:0,"aria-expanded":b,"aria-describedby":p,onClick:y,onDoubleClick:H,onKeyDown:B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),y())},onDragStart:k,onDragEnd:w,onDragEnter:B=>{T&&(B.preventDefault(),B.dataTransfer.dropEffect="move",T(B))},onDragOver:B=>{T&&(B.preventDefault(),B.dataTransfer.dropEffect="move",T(B))},onDrop:B=>{A&&(B.preventDefault(),A(B))},children:e})}function Om({children:e,label:t,onClick:a}){return E.jsx("button",{type:"button",className:"sidebar-row-action","data-tooltip":t,"aria-label":t,onClick:i=>{i.stopPropagation(),a()},children:e})}function C$({filter:e,noun:t,onFilterChange:a,onTasksetChange:i,onSortChange:s,openMenu:u,setOpenMenu:d,sort:f,selectedTasksetId:b,tasksets:p}){const[y,k]=_.useState(!1),T=p.find(W=>W.id===b)?.name??D_.find(W=>W.value===e)?.label??"Active",A=u==="tasks-filter",H=u==="chats";return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"section-menu",children:[E.jsx("button",{type:"button",className:`section-icon ${H?"active":""}`,"aria-label":`Sort ${t}`,"aria-haspopup":"menu","aria-expanded":H,onClick:()=>d(W=>W==="chats"?null:"chats"),children:E.jsx(mH,{size:14})}),H?E.jsx("div",{className:"section-menu-popover",role:"menu","aria-label":`Sort ${t}`,children:JH.map(W=>E.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":f===W.value,onClick:()=>{s(W.value),d(null)},children:[E.jsx("span",{className:"section-menu-check","aria-hidden":"true",children:f===W.value?E.jsx(Tc,{size:13}):null}),E.jsx("span",{children:W.label})]},W.value))}):null]}),E.jsxs("div",{className:"section-menu",children:[E.jsx("button",{type:"button",className:`section-icon ${A||e!=="active"?"active":""}`,"aria-label":`Filter ${t}: ${T}`,"aria-haspopup":"menu","aria-expanded":A,onClick:()=>d(W=>W==="tasks-filter"?null:"tasks-filter"),children:E.jsx(iH,{size:14})}),A?E.jsx("div",{className:"section-menu-popover",role:"menu","aria-label":`Filter ${t}`,children:D_.map(W=>E.jsxs(_.Fragment,{children:[W.value==="tasksets"?E.jsxs("button",{type:"button",role:"menuitem","aria-expanded":y,onClick:()=>k(B=>!B),children:[E.jsx("span",{className:"section-menu-check","aria-hidden":"true",children:y?E.jsx(Lc,{size:13}):E.jsx(id,{size:13})}),E.jsx("span",{children:W.label})]}):E.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":e===W.value,onClick:()=>{a(W.value),d(null)},children:[E.jsx("span",{className:"section-menu-check","aria-hidden":"true",children:e===W.value?E.jsx(Tc,{size:13}):null}),E.jsx("span",{children:W.label})]}),W.value==="tasksets"&&y?E.jsxs(E.Fragment,{children:[E.jsxs("button",{className:"section-menu-taskset-option",type:"button",role:"menuitemradio","aria-checked":e==="tasksets"&&!b,onClick:()=>{i(null),d(null)},children:[E.jsx("span",{className:"section-menu-check","aria-hidden":"true",children:e==="tasksets"&&!b?E.jsx(Tc,{size:13}):null}),E.jsx("span",{children:"All Tasksets"})]}),p.map(B=>E.jsxs("button",{className:"section-menu-taskset-option",type:"button",role:"menuitemradio","aria-checked":e==="tasksets"&&b===B.id,onClick:()=>{i(B.id),d(null)},children:[E.jsx("span",{className:"section-menu-check","aria-hidden":"true",children:e==="tasksets"&&b===B.id?E.jsx(Tc,{size:13}):null}),E.jsx("span",{children:B.name}),E.jsx("span",{className:"section-menu-option-count","aria-hidden":"true",children:B.chatCount})]},B.id))]}):null]},W.value))}):null]})]})}const I$={},A$=new Map,R$=new Map;function T$(e,t){return Math.min(Math.max(e,Za)+gv,t)}function E$(e,t){const a=Math.max(Za,Math.min(e,t));if(a<=Za)return Za;const i=Math.ceil((a-Za)/gv);return Math.max(Za,Za+(i-1)*gv)}function M$({activeSessions:e,archiveSession:t,archivedSessions:a,chatRowsVisibleCount:i,childSessionRowsByParentId:s={},cloudProjectRows:u,commitTaskDrop:d,commitTaskPreviewDrop:f,dockSessionRight:b,experience:p="work",goalRuntimeBySessionId:y=A$,localProjectRows:k,previewTaskDrop:w,projectRows:T,renameSession:A,restoreSession:H,runningSessionIds:W,savedForLaterSessions:B,sectionMenuOpen:M,selectedSessionId:j,setChatRowsVisibleCount:L,setSectionMenuOpen:D,setSelectedAppId:q,setSelectedProjectId:$,setSelectedSessionId:X,setView:ae,sidebarProjectIdBySessionId:ie,startTaskDrag:ue,subagentRuntimeBySessionId:ge=R$,taskDragSessionId:Te,taskPreviewSessionIds:Be,terminalSummaries:Pe=I$,toggleSessionPinned:U,toggleSessionSavedForLater:le,view:he,clearTaskDrag:Me}){const[Ue,O]=_.useState("active"),[Z,be]=_.useState("recent"),[ve,fe]=_.useState(null),[ee,Ce]=_.useState(()=>new Set),je=p==="chat"?"chats":"tasks",et=p==="chat"?"Chats":"Tasks",We=_.useMemo(()=>e.filter(ye=>Es(ye)===null),[e]),Ve=_.useMemo(()=>B.filter(ye=>Es(ye)===null),[B]),lt=Math.max(0,We.length-Ve.length),st=XH({activeCount:lt,filter:Ue,savedForLaterCount:Ve.length}),Je=T??[...k,...u],Y=_.useMemo(()=>new Map(Je.map(ye=>[ye.id,ye.project.name])),[Je]),oe=_.useMemo(()=>{const ye=new Set(W);for(const Qe of e){const ot=y.get(Qe.id),Ft=ge.get(Qe.id);(ot?.tone==="active"&&ot.status!=="queued"||(Ft?.activeCount??0)>0||Ie(Qe.id)?.status==="running")&&ye.add(Qe.id)}return ye},[e,y,W,ge,Pe]),K=_.useMemo(()=>U_({activeSessions:e,doneSessions:a,filter:"all",inProgressSessionIds:oe,sort:"manual"}),[e,a,oe]),te=_.useMemo(()=>U_({activeSessions:e,doneSessions:a,filter:Ue,inProgressSessionIds:oe,selectedTasksetId:ve,previewSessionIds:Be,sort:Z}),[e,a,oe,ve,Ue,Be,Z]),xe=_.useMemo(()=>{const ye=new Map;for(const Qe of[...e,...a]){const ot=Es(Qe);if(!ot)continue;const Ft=ye.get(ot.id);Ft?Ft.chatCount+=1:ye.set(ot.id,{...ot,chatCount:1})}return[...ye.values()].sort((Qe,ot)=>Qe.name.localeCompare(ot.name))},[e,a]),Oe=te.slice(0,Math.max(Za,i)),Ye=Oe.length<te.length,bt=Oe.length>Za,dt=K.map(ye=>ye.id),wt=te.map(ye=>ye.id),_t=Z==="recent"?te.filter(mf):[],Ge=_t.map(ye=>ye.id),at=_t.length>0&&_t.length<te.length,g=at?_t[0]?.id??null:null,F=at?_t[_t.length-1]?.id??null:null,re=JSON.stringify(Object.entries(s).filter(([ye,Qe])=>Qe.length>0&&(ge.get(ye)?.activeCount??0)>0).flatMap(([ye,Qe])=>Qe.map(ot=>[ye,ot.id])).sort(([ye,Qe],[ot,Ft])=>ye.localeCompare(ot)||Qe.localeCompare(Ft)));_.useEffect(()=>{const ye=JSON.parse(re);if(ye.length===0)return;const Qe=new Set(ye.map(([ot])=>ot));Ce(ot=>[...Qe].every(Ft=>ot.has(Ft))?ot:new Set([...ot,...Qe]))},[re]);function Ie(ye){return r$(Pe[HI({kind:"session",id:ye})])}function G(ye){if(qf(ye))return"Draft";if(p==="chat")return null;const Qe=ie[ye.id];return Qe?Y.get(Qe)??ye.workspaceName??"Project":GH(ye)}function se(ye){X(ye.id);const Qe=ie[ye.id]??null;q(Qe?null:ye.appId),$(Qe),ae("chat")}function R(ye){return s[ye.id]??[]}function V(ye,Qe){return ee.has(ye.id)||Qe.some(ot=>ot.id===j)}function pe(ye){Ce(Qe=>{const ot=new Set(Qe);return ot.has(ye)?ot.delete(ye):ot.add(ye),ot})}function me(ye){const Qe=R(ye);return Qe.length===0||!V(ye,Qe)?null:E.jsx("div",{className:"sidebar-child-session-group",children:Qe.map(ot=>E.jsx(B_,{session:ot,selected:he==="chat"&&j===ot.id,hideIcon:!0,nested:!0,running:oe.has(ot.id),goalRuntime:y.get(ot.id)??null,subagentRuntime:ge.get(ot.id)??null,terminalIndicator:Ie(ot.id),projectLabel:G(ye),onSelect:()=>se(ot),onTogglePin:()=>U(ot),onToggleSaveForLater:()=>le(ot),onDockRight:()=>b(ot),onArchive:()=>ot.archived?H(ot):t(ot),onRename:A},ot.id))})}function ke(ye){const Qe=ye.archived,ot=Te===ye.id,Ft=R(ye),Jn=["sidebar-session-group",ye.id===g?"pinned-group-first":"",ye.id===F?"pinned-group-last":""].filter(Boolean).join(" "),Mn=Z==="recent"&&mf(ye),Hn=Mn?Ge:wt,zt=Z==="manual"||Mn?{onDragStart:Pn=>ue(Pn,{allSessionIds:dt,visibleSessionIds:Hn,sessionId:ye.id}),onDragEnd:Me,onDragOver:Pn=>{ot||w(Pn,ye.id)},onDrop:Pn=>{ot?f():d(Pn,ye.id)}}:{};return E.jsxs("div",{className:Jn,children:[E.jsx(B_,{session:ye,selected:!Qe&&he==="chat"&&j===ye.id,archived:Qe,hideIcon:!0,placeholder:ot,running:oe.has(ye.id),goalRuntime:y.get(ye.id)??null,subagentRuntime:ge.get(ye.id)??null,terminalIndicator:Ie(ye.id),projectLabel:G(ye),childSessionCount:Ft.length,childSessionsExpanded:V(ye,Ft),onToggleChildSessions:()=>pe(ye.id),onSelect:()=>{Qe&&H(ye),se(ye)},onTogglePin:()=>U(ye),onToggleSaveForLater:()=>le(ye),onDockRight:()=>b(ye),onArchive:()=>Qe?H(ye):t(ye),onRename:A,...zt}),ot?null:me(ye)]},ye.id)}function Ee(ye){ye!=="tasksets"&&fe(null),O(ye),L(Za)}function Re(ye){fe(ye),O("tasksets"),L(Za)}function Xe(ye){be(ye),L(Za)}function tt(){L(ye=>T$(ye,te.length))}function qe(){L(ye=>E$(ye,te.length))}return E.jsx("div",{className:"sidebar-scroll",children:E.jsxs(S$,{label:et,className:`sidebar-task-section${p!=="chat"?" development":""}`,titleAccessory:p!=="chat"?E.jsx("div",{className:"sidebar-task-mode-buttons",children:E.jsxs("button",{type:"button",className:`section-icon sidebar-task-count-bubble${Ue==="saved_for_later"?" active":""}`,"aria-label":`Show ${st.count} ${st.targetLabel} ${st.count===1?"task":"tasks"}`,onClick:()=>Ee(st.targetFilter),children:[E.jsx("span",{children:st.label}),E.jsx("span",{className:"sidebar-task-count-badge","aria-hidden":"true",children:st.count>99?"99+":st.count})]})}):null,actionsVisible:M==="chats"||M==="tasks-filter",actions:E.jsx(C$,{filter:Ue,noun:je,onFilterChange:Ee,onTasksetChange:Re,onSortChange:Xe,openMenu:M,setOpenMenu:D,sort:Z,selectedTasksetId:ve,tasksets:xe}),children:[Oe.map(ke),te.length===0?E.jsx("div",{className:"empty-row",children:QH(Ue,je)}):null,te.length>Za&&(Ye||bt)?E.jsxs("div",{className:"sidebar-pagination-controls","aria-label":`Showing ${Oe.length} of ${te.length} ${je}`,children:[Ye?E.jsx(q_,{onClick:tt,children:"Show more"}):null,bt?E.jsx(q_,{onClick:qe,children:"Show less"}):null]}):null]})})}const P$="./";function So(e){return`${P$}${e.replace(/^\.?\//,"")}`}const O$=So("openpond-icon.png"),j$=So("openpond-wordlogo-white.png"),JG=So("tutorials/what-is-an-openpond-agent-poster.png"),XG=So("tutorials/what-is-an-openpond-agent.vtt"),QG=So("tutorials/how-to-make-an-agent-poster.png"),eZ=So("tutorials/how-to-make-an-agent.vtt");function tZ(e){return So(`tutorials/how-to-make-an-agent-${e}-poster.png`)}function nZ(e){return So(`tutorials/how-to-make-an-agent-${e}.vtt`)}const F_={github:So("connected-apps/github.svg"),google:So("connected-apps/google.svg"),microsoft_teams:So("connected-apps/microsoft.svg"),mcp:So("connected-apps/openpond-mcp.svg"),slack:So("connected-apps/slack.svg"),x:So("connected-apps/x.svg")};function aZ(e){return F_[e]??F_.mcp}function N$({value:e,onChange:t}){const[a,i]=_.useState(!1),s=_.useRef(null),u=_.useRef(null),d=_.useRef(null),f=yg.find(w=>w.value===e)??yg[0];_.useEffect(()=>{if(!a)return;const w=A=>{A.target instanceof Node&&!s.current?.contains(A.target)&&i(!1)},T=()=>i(!1);return window.addEventListener("pointerdown",w),window.addEventListener("blur",T),()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("blur",T)}},[a]);const b=w=>{window.requestAnimationFrame(()=>{const T=K_(d.current);if(!T.length)return;(w==="first"?T[0]:w==="last"?T.at(-1):T.find(H=>H.dataset.productArea===e))?.focus()})},p=w=>{i(!0),b(w)},y=w=>{w.key==="ArrowDown"?(w.preventDefault(),p("first")):w.key==="ArrowUp"&&(w.preventDefault(),p("last"))},k=w=>{const T=K_(d.current),A=T.findIndex(B=>B===document.activeElement);if(w.key==="Escape"){w.preventDefault(),i(!1),u.current?.focus();return}if(w.key==="Home"||w.key==="End"){w.preventDefault(),T[w.key==="Home"?0:T.length-1]?.focus();return}if(w.key!=="ArrowDown"&&w.key!=="ArrowUp")return;w.preventDefault();const H=w.key==="ArrowDown"?1:-1,W=A<0?0:(A+H+T.length)%T.length;T[W]?.focus()};return E.jsxs("div",{className:"sidebar-experience-menu",ref:s,children:[E.jsxs("button",{ref:u,type:"button",className:"sidebar-wordmark-button sidebar-experience-trigger","aria-label":`OpenPond product: ${f.label}`,"aria-haspopup":"menu","aria-expanded":a,onClick:()=>{i(w=>!w)},onKeyDown:y,children:[E.jsx("img",{className:"sidebar-wordmark",src:j$,alt:""}),E.jsx("span",{className:"sidebar-experience-label",children:f.label}),E.jsx(Lc,{size:13,"aria-hidden":"true"})]}),a?E.jsx("div",{ref:d,className:"sidebar-experience-popover",role:"menu","aria-label":"Choose product",onKeyDown:k,children:yg.map(w=>{const T=w.value===e;return E.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":T,className:T?"active":"","data-product-area":w.value,onClick:()=>{i(!1),T||t(w.value)},children:[E.jsxs("span",{children:[E.jsx("strong",{children:w.label}),E.jsx("small",{children:w.description})]}),T?E.jsx(Tc,{size:14,"aria-hidden":"true"}):null]},w.value)})}):null]})}function K_(e){return e?Array.from(e.querySelectorAll('[role="menuitemradio"]')):[]}function z$(...e){for(const t of e){const a=t?.trim();if(a)return a}return null}function D$(e){const t=e?.accounts.find(d=>d.isActive)??null,a=e?.profile??null,i=e?.activeProfile?.handle??null;return{label:(e?.state==="signed_in"?z$(e?.label,a?.handle,a?.name,a?.email,t?.displayLabel,t?.handle,i,e?.email,"Signed in"):e?.state==="loading"||e?.state==="switching"?"Loading account":"Sign in")??"Account",image:e?.avatarUrl??a?.image??t?.avatarUrl??null}}function U$({account:e,onOpenApps:t,onOpenActivity:a,onOpenSettings:i}){const[s,u]=_.useState(!1),d=_.useRef(null),f=_.useMemo(()=>D$(e),[e]),b=f.label.trim().slice(0,1).toUpperCase();return _.useEffect(()=>{if(!s)return;function p(k){d.current?.contains(k.target)||u(!1)}function y(k){k.key==="Escape"&&u(!1)}return document.addEventListener("pointerdown",p),document.addEventListener("keydown",y),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("keydown",y)}},[s]),E.jsxs("div",{className:"user-auth-footer",ref:d,children:[E.jsxs("button",{type:"button",className:`user-auth-trigger ${s?"active":""}`,"aria-haspopup":"menu","aria-expanded":s,"aria-label":`${f.label} account menu`,onClick:()=>u(p=>!p),children:[E.jsx("span",{className:"user-auth-avatar","aria-hidden":"true",children:f.image?E.jsx("img",{src:f.image,alt:""}):b?E.jsx("span",{children:b}):E.jsx(RH,{size:16})}),E.jsx("span",{className:"user-auth-name",children:f.label})]}),s?E.jsxs("div",{className:"user-auth-menu",role:"menu","aria-label":"Account",children:[t?E.jsxs("a",{href:"/apps",className:"user-auth-menu-link",role:"menuitem",onClick:p=>{p.preventDefault(),u(!1),t()},children:[E.jsx(SH,{size:15}),E.jsx("span",{children:"Apps"})]}):null,a?E.jsxs("a",{href:"/settings/usage",className:"user-auth-menu-link",role:"menuitem",onClick:p=>{p.preventDefault(),u(!1),a()},children:[E.jsx(wI,{size:15}),E.jsx("span",{children:"Activity"})]}):null,E.jsxs("a",{href:"/settings",className:"user-auth-menu-link",role:"menuitem",onClick:p=>{p.preventDefault(),u(!1),i()},children:[E.jsx(Nb,{size:15}),E.jsx("span",{children:"Settings"})]})]}):null]})}function G_(e){const t=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e?.trim()??"");return t?[Number.parseInt(t[1],10),Number.parseInt(t[2],10),Number.parseInt(t[3],10)]:null}function L$(e,t){const a=G_(e),i=G_(t);if(!a||!i)return!1;for(let s=0;s<i.length;s+=1){if(i[s]>a[s])return!0;if(i[s]<a[s])return!1}return!1}function qI(e){const t=e?.toLowerCase()??"";return t==="darwin"||t.includes("mac")?"mac":t==="linux"||t.includes("linux")?"linux":null}function H$(e){const t=e?.toLowerCase()??"";return t==="arm64"||t==="aarch64"?"arm64":t==="x64"||t==="x86_64"||t==="amd64"?"x64":null}function $$(e,t,a){const i=qI(t),s=H$(a);if(i==="mac"){const u=e.filter(d=>/-mac-.*\.zip$/i.test(d.name));return s==="arm64"?u.find(d=>/-mac-arm64\.zip$/i.test(d.name))??null:s==="x64"?u.find(d=>/-mac-x64\.zip$/i.test(d.name))??u.find(d=>/-mac-universal\.zip$/i.test(d.name))??null:u.find(d=>/-mac-universal\.zip$/i.test(d.name))??u.find(d=>/-mac-arm64\.zip$/i.test(d.name))??u[0]??null}if(i==="linux"){const u=e.filter(d=>/\.AppImage$/i.test(d.name));return s==="arm64"?u.find(d=>/(?:arm64|aarch64).*\.AppImage$/i.test(d.name))??null:s==="x64"?u.find(d=>/(?:x86_64|x64|amd64).*\.AppImage$/i.test(d.name))??u[0]??null:u[0]??null}return null}function q$(e){if(!e.payload||typeof e.payload!="object")return null;const t=e.payload,i=(typeof t.tag_name=="string"?t.tag_name.trim():"").replace(/^v/,"");if(!L$(e.currentVersion,i))return null;const s=typeof t.html_url=="string"?t.html_url:"",d=(Array.isArray(t.assets)?t.assets:[]).flatMap(b=>{if(!b||typeof b!="object")return[];const p=b;return typeof p.name!="string"||typeof p.browser_download_url!="string"?[]:[{name:p.name,downloadUrl:p.browser_download_url}]}),f=$$(d,e.platform,e.arch);return!f||!s?null:{version:i,releaseUrl:s,assetName:f.name,downloadUrl:f.downloadUrl}}const B$=3600*1e3,V$="https://api.github.com/repos/openpond/openpond/releases/latest";function F$(e){const[t,a]=_.useState({status:"idle",update:null,lastCheckedAt:null}),i=e.currentVersion?.trim()??"",s=e.platform??"",u=e.arch??"",d=e.enabled&&!!i&&!!qI(s);return _.useEffect(()=>{if(!d){a({status:"idle",update:null,lastCheckedAt:null});return}let f=!1;async function b(){a(y=>({...y,status:y.update?"available":"checking"}));try{const y=await fetch(V$,{headers:{Accept:"application/vnd.github+json"}});if(!y.ok)throw new Error(`GitHub release check failed: ${y.status}`);const k=await y.json(),w=q$({payload:k,currentVersion:i,platform:s,arch:u});if(f)return;a({status:w?"available":"current",update:w,lastCheckedAt:Date.now()})}catch{if(f)return;a(y=>({status:y.update?"available":"error",update:y.update,lastCheckedAt:Date.now()}))}}b();const p=window.setInterval(()=>{b()},B$);return()=>{f=!0,window.clearInterval(p)}},[u,i,d,s]),t}const BI="openpond.sidebar.continuous-learning.dismissed.v1";function K$(e=VI()){if(!e)return!1;try{return e.getItem(BI)==="true"}catch{return!1}}function G$(e=VI()){if(e)try{e.setItem(BI,"true")}catch{}}function VI(){return typeof window>"u"?null:window.localStorage}function Z$({connection:e,onOpenSettings:t}){const[a,i]=_.useState(null),[s,u]=_.useState(null),[d,f]=_.useState(K$),b=_.useCallback(async()=>{if(!e){i(null);return}try{i(await de.harnessHistory(e))}catch{i(null)}},[e]);if(_.useEffect(()=>{b()},[b]),d||!e||!a?.workspace)return null;const p=a.evaluationReviewSchedule;return E.jsxs("section",{className:"sidebar-learning-notice","aria-label":"Continuous learning",children:[E.jsxs("header",{children:[E.jsx("strong",{children:"Continuous learning"}),E.jsxs("div",{className:"sidebar-learning-notice-actions",children:[E.jsx("button",{className:"sidebar-learning-notice-action","aria-label":"Open Continuous learning settings",onClick:t,type:"button",children:E.jsx(Nb,{size:14})}),E.jsx("button",{className:"sidebar-learning-notice-action","aria-label":"Close continuous learning",onClick:()=>{f(!0),G$()},type:"button",children:E.jsx(Hf,{size:14})})]})]}),E.jsxs("label",{className:"sidebar-learning-control",children:[E.jsx("strong",{children:"Refiner"}),E.jsxs("span",{className:"sidebar-learning-toggle",children:[E.jsx("input",{checked:a.backgroundReview.enabled,disabled:s!==null,onChange:y=>{const k=y.target.checked;u("refiner"),de.updateHarnessBackgroundReview(e,{workspaceId:a.workspace.id,enabled:k}).then(w=>i(w.history)).finally(()=>u(null))},type:"checkbox"}),E.jsx("span",{"aria-hidden":"true"})]})]}),E.jsxs("label",{className:"sidebar-learning-control",children:[E.jsx("strong",{children:"RL review"}),E.jsxs("span",{className:"sidebar-learning-toggle",children:[E.jsx("input",{checked:p.enabled,disabled:s!==null,onChange:y=>{const k=y.target.checked,w=k&&p.cadence==="manual"?"daily":p.cadence;u("review"),de.updateHarnessEvaluationReviewSchedule(e,{workspaceId:a.workspace.id,enabled:k,cadence:w,maxEstimatedCostUsd:p.maxEstimatedCostUsd}).then(T=>i(T.history)).finally(()=>u(null))},type:"checkbox"}),E.jsx("span",{"aria-hidden":"true"})]})]})]})}function W$(e){const{beginNewChat:t,arch:a,currentVersion:i,experience:s,productArea:u,onProductAreaChange:d,onSidebarResizeStart:f,platform:b,setSectionMenuOpen:p,setSelectedAppId:y,setSelectedProjectId:k,setSelectedSessionId:w,setSidebarOpen:T,setSettingsSection:A,setView:H,view:W}=e,B=F$({currentVersion:i,platform:b,arch:a,enabled:$f()}),M=B.status==="available"?B.update:null;return E.jsxs("aside",{className:"sidebar",children:[E.jsxs("div",{className:"sidebar-toolbar",children:[E.jsx("button",{className:"sidebar-icon","aria-label":"Hide sidebar",onClick:()=>T(!1),children:E.jsx(RI,{size:16})}),E.jsx(N$,{value:u,onChange:d}),M&&E.jsxs("button",{type:"button",className:"sidebar-update-pill",title:`Download OpenPond ${M.version}: ${M.assetName}`,"aria-label":`Download OpenPond ${M.version}`,onClick:()=>{Y$(M.downloadUrl)},children:[E.jsx(Y6,{size:14}),E.jsx("span",{children:"Update"})]})]}),E.jsx(zH,{productArea:u,experience:s,beginNewChat:t,setSectionMenuOpen:p,setSelectedAppId:y,setSelectedProjectId:k,setSelectedSessionId:w,setView:H,view:W}),u==="models"?null:E.jsx(M$,{...e}),E.jsxs("div",{className:"sidebar-bottom-stack",children:[u==="models"?null:E.jsx(Z$,{connection:e.connection,onOpenSettings:()=>{p(null),A("harness"),H("settings")}}),E.jsxs("div",{className:"sidebar-footer-row",children:[E.jsx(U$,{account:e.account,onOpenApps:u==="development"||u==="chat"?()=>{p(null),y(null),k(null),w(null),H("apps")}:void 0,onOpenActivity:()=>{p(null),A("usage"),H("settings")},onOpenSettings:()=>{p(null),A("account"),H("settings")}}),E.jsx(DH,{setSectionMenuOpen:p,setSelectedAppId:y,setSelectedProjectId:k,setSelectedSessionId:w,setView:H,view:W})]})]}),E.jsx("div",{className:"sidebar-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",onPointerDown:f})]})}async function Y$(e){const t=window.openpond?.browser;t?.openExternal&&(await t.openExternal({conversationId:"openpond-update",url:e})).ok||window.open(e,"_blank","noopener,noreferrer")}const J$=[/^(?:(?:type)?error:\s*)?failed to fetch\.?$/i,/^networkerror when attempting to fetch resource\.?$/i,/^load failed\.?$/i];function FI(e,t="Something went wrong."){const i=(e instanceof Error?e.message:String(e??"")).trim();return i?KI(i)?"Couldn’t connect to OpenPond.":i:t}function KI(e){const t=e.trim();return J$.some(a=>a.test(t))}const GI=_.createContext(null);function Z_({children:e,showToast:t}){return E.jsx(GI.Provider,{value:t,children:e})}function X$(){return _.useContext(GI)}function W_(e,t={}){const a=X$(),i=_.useRef(null),s=t.enabled??!0,u=t.fallback??"Something went wrong.",d=t.prefix?.trim()??"",f=e==null||e===""?null:`${d}${d?": ":""}${FI(e,u)}`;_.useEffect(()=>{if(!s||!f){i.current=null;return}i.current!==f&&(i.current=f,a?.(f,"error",{dismissible:!0}))},[s,f,a])}function Q$({state:e,onClose:t,onOpenBrowserUrl:a,onStart:i}){if(W_(e?.previewError,{prefix:"Upload preview"}),W_(e?.error,{prefix:"Cloud setup"}),!e)return null;const s=e.status==="uploading",u=e.status==="ready",d=e.status==="error",f=e.projectKind==="cloud",b=e.preview??null;return E.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:E.jsxs("section",{className:"git-dialog cloud-setup-dialog",role:"dialog","aria-modal":"true","aria-label":"Set up Cloud coding",children:[E.jsx("button",{className:"git-dialog-close",disabled:s,type:"button",onClick:t,"aria-label":"Close Cloud setup",title:"Close",children:E.jsx(Hf,{size:14})}),E.jsx("div",{className:"git-dialog-icon",children:u?E.jsx(B6,{size:18}):E.jsx(CI,{size:18})}),E.jsx("h2",{children:u?"Cloud repo ready":"Set up Cloud coding"}),E.jsx("p",{children:u?"Your source is ready in OpenPond Git. Finish by creating the Cloud sandbox environment.":f?"This Cloud Project is ready for a sandbox environment.":"OpenPond will upload tracked and unignored files into OpenPond Git, then send you to the Cloud sandbox setup page."}),E.jsxs("div",{className:"cloud-setup-summary",children:[E.jsxs("div",{className:"git-dialog-row",children:[E.jsx("span",{children:"Project"}),E.jsx("strong",{children:e.projectName})]}),E.jsxs("div",{className:"git-dialog-row",children:[E.jsx("span",{children:"Source"}),E.jsx("strong",{children:f?"OpenPond Git":"Local project upload"})]}),E.jsxs("div",{className:"git-dialog-row",children:[E.jsx("span",{children:"Branch"}),E.jsx("strong",{children:b?.branch??e.branch??"main"})]}),!f&&E.jsxs("div",{className:"git-dialog-row",children:[E.jsx("span",{children:"Cloud project"}),E.jsx("strong",{children:b?.targetProjectId??e.cloudProjectId??"New on upload"})]})]}),!u&&!f&&E.jsx("div",{className:"cloud-setup-upload-preview",role:"status","aria-live":"polite",children:e.previewLoading?E.jsxs(E.Fragment,{children:[E.jsx("strong",{children:"Calculating upload preview"}),E.jsx("span",{children:"Checking tracked and unignored files before anything is pushed."})]}):e.previewError?E.jsxs(E.Fragment,{children:[E.jsx("strong",{children:"Preview unavailable"}),E.jsx("span",{children:"Close and reopen setup to try the preview again."})]}):b?E.jsxs(E.Fragment,{children:[E.jsx("strong",{children:b.initializedEmptyProject?"Will initialize an empty project":`Will upload ${b.fileCount} files`}),E.jsx("span",{children:Y_({byteCount:b.byteCount,skippedCount:b.skippedCount,headCommit:b.headCommit,targetProjectName:b.targetProjectName})})]}):E.jsxs(E.Fragment,{children:[E.jsx("strong",{children:"Upload preview pending"}),E.jsx("span",{children:"File count, byte count, and skipped files will appear here before upload."})]})}),s&&E.jsxs("div",{className:"cloud-setup-progress",role:"status","aria-live":"polite",children:[E.jsx(sH,{className:"cloud-setup-spinner",size:16}),E.jsx("span",{children:"Uploading source to OpenPond Git..."})]}),u&&e.upload&&E.jsxs("div",{className:"cloud-setup-upload-result",children:[E.jsx("strong",{children:e.upload.initializedEmptyProject?"Initialized empty project":`Uploaded ${e.upload.fileCount} files`}),E.jsx("span",{children:Y_({byteCount:e.upload.byteCount,skippedCount:e.upload.skippedCount,headCommit:e.upload.headCommit,targetProjectName:e.upload.branch})})]}),u&&e.setupUrl&&E.jsxs("div",{className:"cloud-setup-next",children:[e.projectUrl?E.jsxs("span",{children:["Your repo is ready here:"," ",E.jsxs("a",{href:e.projectUrl,target:"_blank",rel:"noreferrer",onClick:p=>kg(p,e.projectUrl,a,{newTab:!0}),children:["Project page",E.jsx(vg,{size:13})]})]}):E.jsx("span",{children:"Your repo is ready. Next step:"}),E.jsxs("a",{href:e.setupUrl,target:"_blank",rel:"noreferrer",onClick:p=>kg(p,e.setupUrl,a),children:["Setup the Cloud sandbox",E.jsx(vg,{size:13})]})]}),E.jsxs("div",{className:"git-dialog-footer",children:[E.jsx("button",{className:"git-dialog-secondary",disabled:s,type:"button",onClick:t,children:u?"Done":"Cancel"}),u?e.setupUrl?E.jsxs("a",{className:"git-dialog-primary cloud-setup-primary-link",href:e.setupUrl,target:"_blank",rel:"noreferrer",onClick:p=>kg(p,e.setupUrl,a),children:["Open setup",E.jsx(vg,{size:13})]}):null:E.jsx("button",{className:"git-dialog-primary",disabled:s,type:"button",onClick:i,children:s?"Uploading":d?"Try again":f?"Show setup link":"Upload source"})]})]})})}function kg(e,t,a,i={}){!t||!a||(e.preventDefault(),a(t,i))}function eq(e){return!Number.isFinite(e)||e<=0?"0 B":e<1024?`${Math.round(e)} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Y_({byteCount:e,skippedCount:t,headCommit:a,targetProjectName:i}){const s=[eq(e),`${t} skipped`],u=tq(a);return u&&s.push(`local ${u}`),s.push(i),s.join(" · ")}function tq(e){const t=e?.trim();return t?t.slice(0,7):null}const nq=_.lazy(()=>Al(()=>import("./CommandMenu-C9k5VdaR.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).then(e=>({default:e.CommandMenu}))),aq=_.lazy(()=>Al(()=>import("./SettingsView-CQJoEx-y.js"),__vite__mapDeps([4,5,6,7,8,9,10,11,12,13,14,15,16,2,17,18,19,20,1,21,22,23]),import.meta.url).then(e=>({default:e.SettingsView}))),oq=_.lazy(()=>Al(()=>import("./NewProjectDialog-BOdCdNcG.js"),__vite__mapDeps([24,8,18]),import.meta.url).then(e=>({default:e.NewProjectDialog}))),iq=_.lazy(()=>Al(()=>import("./WorkspaceGitDialogs-hWBfhgaP.js"),__vite__mapDeps([25,14,26,16,27,23]),import.meta.url).then(e=>({default:e.CommitDialog}))),rq=_.lazy(()=>Al(()=>import("./WorkspaceGitDialogs-hWBfhgaP.js"),__vite__mapDeps([25,14,26,16,27,23]),import.meta.url).then(e=>({default:e.BranchDialog})));function sq({payload:e,connection:t,diagnostics:a,initialSection:i,onPayload:s,onError:u,onToast:d,onBack:f,onOpenSourceSession:b,onAcceptEvaluationReview:p,onOpenSkill:y,onOpenExtension:k,teamChatCurrentUserId:w,teamChatEnabled:T,teamChatNotificationMode:A,teamChatThreads:H,onTeamChatNotificationModeChange:W,onTeamChatThreadMuteChange:B,diffPanelWidth:M,diffPanelResizing:j,diffPanelExpanded:L,onDiffPanelResizeStart:D,onDiffPanelExpandedChange:q}){return E.jsx(_.Suspense,{fallback:null,children:E.jsx(aq,{payload:e,connection:t,diagnostics:a,initialSection:i,onPayload:s,onError:u,onToast:d,onBack:f,onOpenSourceSession:b,onAcceptEvaluationReview:p,onOpenSkill:y,onOpenExtension:k,teamChatCurrentUserId:w,teamChatEnabled:T,teamChatNotificationMode:A,teamChatThreads:H,onTeamChatNotificationModeChange:W,onTeamChatThreadMuteChange:B,diffPanelWidth:M,diffPanelResizing:j,diffPanelExpanded:L,onDiffPanelResizeStart:D,onDiffPanelExpandedChange:q})})}function lq({activeSessions:e,branchDialogName:t,branchDialogOpen:a,commitDialogOpen:i,commitDraft:s,commitIncludeUnstaged:u,commitMessage:d,commitNextStep:f,canPublishOpenPondProject:b,expandProject:p,newProjectBusy:y,newProjectDialogOpen:k,newProjectDirectory:w,newProjectMode:T,newProjectName:A,newProjectPath:H,projectRows:W,query:B,searchOpen:M,visibleWorkspaceDiff:j,visibleWorkspaceState:L,workspaceBusy:D,appDispatch:q,beginNewChat:$,openDefaultsSettingsFromBranchDialog:X,setBranchDialogName:ae,setBranchDialogOpen:ie,setCommitDialogOpen:ue,setCommitDraft:ge,setCommitIncludeUnstaged:Te,setCommitMessage:Be,setCommitNextStep:Pe,setNewProjectDialogOpen:U,setNewProjectName:le,setNewProjectPath:he,setQuery:Me,setSearchOpen:Ue,submitCommitDialog:O,submitCreateWorkspaceBranch:Z,submitNewProjectDialog:be}){return E.jsxs(E.Fragment,{children:[M&&E.jsx(_.Suspense,{fallback:null,children:E.jsx(nq,{open:M,query:B,projects:W,sessions:e,onQueryChange:Me,onClose:()=>{Ue(!1),Me("")},onNewChat:()=>{Ue(!1),Me(""),$()},onOpenProject:ve=>{q({type:"selectProject",projectId:ve.id}),q({type:"patch",patch:{searchOpen:!1,query:""}}),p(ve.id)},onOpenSession:ve=>{q({type:"selectSession",sessionId:ve.id,appId:ve.appId,projectId:ve.workspaceKind==="local_project"&&ve.workspaceId?Dt("local",ve.workspaceId):null}),q({type:"patch",patch:{searchOpen:!1,query:""}})}})}),k&&E.jsx(_.Suspense,{fallback:null,children:E.jsx(oq,{open:k,mode:T,name:A,path:H,directory:w,busy:y,onNameChange:le,onPathChange:he,onClose:()=>{y||U(!1)},onSubmit:be})}),i&&E.jsx(_.Suspense,{fallback:null,children:E.jsx(iq,{open:i,branch:L?.currentBranch??null,filesChanged:j?.filesChanged??L?.changedFilesCount??0,additions:j?.additions??0,deletions:j?.deletions??0,message:d,includeUnstaged:u,nextStep:f,draft:s,busy:D,canPush:!!L?.remoteUrl,canPublish:b,onMessageChange:Be,onIncludeUnstagedChange:Te,onNextStepChange:Pe,onDraftChange:ge,onClose:()=>{D||ue(!1)},onSubmit:O})}),a&&E.jsx(_.Suspense,{fallback:null,children:E.jsx(rq,{open:a,branchName:t,busy:D,onBranchNameChange:ae,onSetPrefix:X,onClose:()=>{D||ie(!1)},onSubmit:Z})})]})}function ZI({toast:e,onDismiss:t}){if(!e)return null;const a=!!(e.actionLabel&&e.onAction),i=!!(e.persistent||e.dismissible);return E.jsxs("div",{className:`app-toast ${e.tone} ${e.placement??"bottom-right"}`,role:e.tone==="error"?"alert":"status","aria-live":"polite",children:[E.jsx("span",{className:"app-toast-message",children:e.message}),(a||i)&&E.jsxs("div",{className:"app-toast-actions",children:[a&&E.jsx("button",{type:"button",className:e.actionIcon?"app-toast-icon-action":void 0,"aria-label":e.actionLabel,title:e.actionIcon?e.actionLabel:void 0,onClick:()=>{t(),e.onAction?.()},children:e.actionIcon==="settings"?E.jsx(Nb,{size:15}):e.actionLabel}),i&&E.jsx("button",{type:"button",className:"app-toast-close","aria-label":"Dismiss notification",onClick:t,children:E.jsx(Hf,{size:14})})]})]})}async function cq(e){if(!e)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch(t){console.warn("Clipboard write failed",t)}try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-1000px",t.style.top="-1000px",document.body.appendChild(t),t.select();const a=document.execCommand("copy");return t.remove(),a}catch(t){return console.warn("Clipboard fallback failed",t),!1}}function uq({activeView:e,onDiscoverCommunities:t,onOpenTeamChat:a}){return E.jsxs("div",{className:"titlebar-collaboration-actions",children:[E.jsx("button",{type:"button",className:`titlebar-icon${e==="team"?" active":""}`,"aria-label":"Team chat",title:"Team chat",onClick:a,children:E.jsx(jb,{size:16})}),E.jsx("button",{type:"button",className:`titlebar-icon${e==="community"?" active":""}`,"aria-label":"Discover communities",title:"Discover communities",onClick:t,children:E.jsx(AI,{size:16})})]})}const dq=_.lazy(()=>Al(()=>import("./WorkspaceEnvironmentMenu-BO60uNVj.js"),__vite__mapDeps([28,26,21,29,11,15,16,5,27,30]),import.meta.url).then(e=>({default:e.WorkspaceEnvironmentMenu})));function mq({sidebarOpen:e,title:t,conversationId:a,breadcrumbs:i,backAction:s,workspaceName:u,workspaceId:d,busy:f,workspaceState:b,workspaceKind:p,selectedApp:y,selectedProject:k,workspaceDiff:w,managedWorkspace:T,workspaceBusy:A,defaultTeamId:H,showDiffControls:W,diffPanelOpen:B,terminalOpen:M,rightSidebarAvailable:j=!1,rightSidebarOpen:L=!1,onToggleDiffPanel:D,onToggleRightSidebar:q,onOpenSearch:$,onToggleTerminal:X,onRunTerminalCommand:ae,onWorkspaceToolAction:ie,onOpenCommitDialog:ue,onWorkspaceBranchChange:ge,onWorkspaceBranchCreate:Te,connection:Be,onBootstrap:Pe,onOpenSandboxWorkspace:U,onShowSidebar:le,onOpenTeamChat:he,onDiscoverCommunities:Me,collaborationView:Ue=null,platform:O,showWorkspaceControls:Z=!0}){const be=w?.filesChanged??0,ve=$f()&&!zb(O),fe=!!(he||Me)||Z||j||ve,[ee,Ce]=_.useState(null);_.useEffect(()=>{if(!ee)return;const We=()=>Ce(null);return window.addEventListener("pointerdown",We),window.addEventListener("blur",We),window.addEventListener("resize",We),()=>{window.removeEventListener("pointerdown",We),window.removeEventListener("blur",We),window.removeEventListener("resize",We)}},[ee]);const je=We=>{We.preventDefault(),We.stopPropagation();const Ve=190,lt=a?76:42;Ce({x:Math.min(We.clientX,window.innerWidth-Ve-8),y:Math.min(We.clientY,window.innerHeight-lt-8)})},et=We=>{cq(We),Ce(null)};return E.jsxs("header",{className:"app-titlebar",children:[E.jsxs("div",{className:"titlebar-left",children:[!e&&E.jsx("button",{className:"titlebar-icon",title:"Show sidebar",onClick:le,children:E.jsx(RI,{size:16})}),s?E.jsx("button",{className:"titlebar-icon",type:"button","aria-label":s.label,title:s.label,onClick:s.onSelect,children:E.jsx(E6,{size:16})}):null,i?.length?E.jsx("nav",{className:"titlebar-breadcrumbs","aria-label":"Breadcrumb",children:i.map((We,Ve)=>{const lt=Ve===i.length-1;return E.jsxs("div",{className:"titlebar-breadcrumb-item",children:[We.onSelect&&!lt?E.jsx("button",{type:"button",onClick:We.onSelect,children:We.label}):E.jsx("strong",{children:We.label}),!lt&&E.jsx(id,{size:14})]},`${We.label}-${Ve}`)})}):E.jsxs("div",{className:"titlebar-title",children:[E.jsx("strong",{className:"titlebar-copy-target",title:"Double-click to select; right-click for copy options",onContextMenu:je,children:t}),u&&E.jsx("span",{children:u})]})]}),fe&&E.jsxs("div",{className:"titlebar-right",children:[E.jsx(uq,{activeView:Ue,onDiscoverCommunities:Me,onOpenTeamChat:he}),Z&&E.jsxs("div",{className:"titlebar-actions",children:[E.jsx(_.Suspense,{fallback:null,children:E.jsx(dq,{mode:"topbar",busy:f,workspaceState:b,workspaceId:d,workspaceKind:p,selectedApp:y,selectedProject:k,workspaceBusy:A,defaultTeamId:H,workspaceDiff:w,managedWorkspace:T,showDiffControls:W,diffPanelOpen:B,onToggleDiffPanel:D,onRunTerminalCommand:ae,onWorkspaceToolAction:ie,onOpenCommitDialog:ue,onWorkspaceBranchChange:ge,onWorkspaceBranchCreate:Te,connection:Be,onBootstrap:Pe,onOpenSandboxWorkspace:U})}),E.jsx("button",{type:"button",className:"titlebar-icon",title:"Search chats and projects","aria-label":"Search chats and projects",onClick:$,children:E.jsx(wH,{size:16})}),E.jsx("button",{type:"button",className:`titlebar-icon ${M?"active":""}`,title:`${M?"Hide":"Show"} terminal`,"aria-label":`${M?"Hide":"Show"} terminal`,"aria-pressed":M,onClick:X,children:E.jsx(TI,{size:16})}),W&&E.jsx("button",{type:"button",className:`topbar-diff-button ${L?"active":""}`,title:`${L?"Hide":"Show"} sidebar${be?`, ${be} changed files`:""}`,"aria-label":`${L?"Hide":"Show"} sidebar`,"aria-pressed":L,onClick:D,children:E.jsx(pv,{size:16})})]}),j&&q&&!W?E.jsx("div",{className:"titlebar-actions",children:E.jsx("button",{type:"button",className:`topbar-diff-button ${L?"active":""}`,title:`${L?"Hide":"Show"} sidebar`,"aria-label":`${L?"Hide":"Show"} sidebar`,"aria-pressed":L,onClick:q,children:E.jsx(pv,{size:16})})}):null,E.jsx(EH,{platform:O})]}),ee&&E.jsxs("div",{className:"titlebar-copy-menu",role:"menu","aria-label":"Conversation title actions",style:{left:ee.x,top:ee.y},onPointerDown:We=>We.stopPropagation(),children:[E.jsx("button",{type:"button",role:"menuitem",onClick:()=>et(t),children:"Copy title"}),a&&E.jsx("button",{type:"button",role:"menuitem",onClick:()=>et(a),children:"Copy conversation ID"})]})]})}function fq(){const[e,t]=_.useState(null),a=_.useRef(null),i=_.useCallback(u=>new Promise(d=>{a.current?.resolve(!1);const f={...u,cancelLabel:u.cancelLabel??"Cancel",tone:u.tone??"default",resolve:d};a.current=f,t(f)}),[]),s=_.useCallback(u=>{const d=a.current;a.current=null,t(null),d?.resolve(u)},[]);return{confirmAction:i,confirmDialog:e,resolveConfirmDialog:s}}function pq({state:e,onResolve:t}){const a=_.useId(),i=_.useId();if(_.useEffect(()=>{if(!e)return;function u(d){d.key==="Escape"&&t(!1)}return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[t,e]),!e)return null;const s=e.tone==="danger"?"git-dialog-primary danger":"git-dialog-primary";return E.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:()=>t(!1),children:E.jsxs("section",{className:"git-dialog project-confirm-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":a,"aria-describedby":i,onMouseDown:u=>u.stopPropagation(),children:[E.jsx("h2",{id:a,children:e.title}),E.jsx("p",{id:i,children:e.body}),E.jsxs("div",{className:"git-dialog-footer",children:[E.jsx("button",{type:"button",className:"git-dialog-secondary",onClick:()=>t(!1),children:e.cancelLabel}),E.jsx("button",{type:"button",className:s,autoFocus:!0,onClick:()=>t(!0),children:e.confirmLabel})]})]})})}function hq(){const{confirmAction:e,confirmDialog:t,resolveConfirmDialog:a}=fq();return{confirmProjectAction:_.useCallback(s=>e({tone:"danger",...s}),[e]),projectConfirmDialog:t,resolveProjectConfirmDialog:a}}function gq({state:e,onResolve:t}){return E.jsx(pq,{state:e,onResolve:t})}const ff=new Map,vq=(e,t,a)=>{const i=ff.get(e)??{commits:0,maxActualDurationMs:0,totalActualDurationMs:0};i.commits+=1,i.maxActualDurationMs=Math.max(i.maxActualDurationMs,a),i.totalActualDurationMs+=a,ff.set(e,i)};function bq({children:e,id:t}){return E.jsx(_.Profiler,{id:t,onRender:vq,children:e})}typeof window<"u"&&(window.__OPENPOND_RENDER_COMMITS__={get:()=>Object.fromEntries([...ff.entries()].map(([e,t])=>[e,{...t}])),reset:()=>ff.clear()});const yq=_.lazy(()=>Al(()=>import("./MainPane-COs4xUGo.js").then(e=>e.M),__vite__mapDeps([31,14,1,32,6,29,8,33]),import.meta.url).then(e=>({default:e.MainPane})));function Sq({className:e,style:t,sidebar:a,topBar:i,mainPane:s,cloudSetup:u,projectConfirm:d,lazyPanels:f,toast:b}){return E.jsxs("div",{className:e,style:t,children:[E.jsx(bq,{id:"sidebar",children:E.jsx(W$,{...a})}),E.jsxs("div",{className:"content-shell",children:[E.jsx(mq,{...i}),E.jsx(_.Suspense,{fallback:E.jsx("main",{className:"main-pane","aria-busy":"true","aria-label":"Loading workspace"}),children:E.jsx(yq,{...s})})]}),E.jsx(Q$,{...u}),E.jsx(gq,{...d}),E.jsx(lq,{...f}),E.jsx(ZI,{...b})]})}function _q({settings:e,toast:t}){return E.jsxs(E.Fragment,{children:[E.jsx(sq,{...e}),E.jsx(ZI,{...t})]})}const Wm="OpenPond".split("");function xq({visibleLetterCount:e=Wm.length}){const t=Wm.slice(0,Math.max(0,Math.min(e,Wm.length)));return E.jsxs("div",{className:"app-splash-lockup",children:[E.jsx("div",{className:"app-splash-mark",children:E.jsx("img",{alt:"OpenPond",className:"app-splash-logo",decoding:"async",src:O$})}),E.jsx("span",{"aria-hidden":"true",className:`app-splash-wordmark${t.length>0?" is-visible":""}`,children:t.map((a,i)=>E.jsx("span",{className:"app-splash-letter",children:a},`${a}-${i}`))})]})}const wg=Wm.length,kq=520,wq=240;function J_(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Cq({startup:e}){const[t,a]=_.useState(()=>J_()?wg:0);return _.useEffect(()=>{if(J_()){a(wg);return}const i=Array.from({length:wg},(s,u)=>window.setTimeout(()=>a(u+1),kq+wq*u));return()=>{i.forEach(s=>window.clearTimeout(s))}},[]),E.jsxs("main",{className:"app-splash","aria-busy":"true","aria-label":e.label,role:"status",children:[E.jsx(xq,{visibleLetterCount:t}),E.jsx("span",{className:"app-splash-status",children:e.label})]})}const WI=5e3;function Bi(e,t){if(e.length===0)return t;if(t.length===0)return e;const a=new Set,i=[];for(const s of[...e,...t])a.has(s.id)||(a.add(s.id),i.push(s));return i}function _l(e,t,a=WI){return pf(Bi(e,t),a)}function pf(e,t=WI){return e.length<=t?e:e.slice(e.length-t)}function Iq(e,t,a){return a.length===0?e:{...e,[t]:Bi(e[t]??[],a)}}function Aq(e,t){if(t.length===0)return pf(e);if(e.length===0)return pf(t);const a=new Set(e.map(d=>d.id)),i=$b(e),s=Tq(e),u=t.filter(d=>{if(a.has(d.id))return!1;if(typeof d.sequence=="number")return i===null||d.sequence>i;const f=Date.parse(d.timestamp);return Number.isFinite(f)&&s!==null?f>=s:!0});return _l(e,u)}function $b(e){let t=null;for(const a of e)typeof a.sequence=="number"&&(t=t===null?a.sequence:Math.max(t,a.sequence));return t}function Rq(e){let t=null;for(const a of e)a.sequence!==void 0&&(t===null||a.sequence<t)&&(t=a.sequence);return t}function Tq(e){let t=null;for(const a of e){const i=Date.parse(a.timestamp);Number.isFinite(i)&&(t=t===null?i:Math.max(t,i))}return t}const Eq="codex_history_";function _n(e){return!!e?.startsWith(Eq)}function YI(e){const t=[],a=new Set;for(const i of e)for(const s of[i.workspacePath,i.path]){const u=Bf(s);if(!u)continue;const d=`${i.id}:${u}`;a.has(d)||(a.add(d),t.push({projectId:i.id,path:u}))}return t.sort((i,s)=>s.path.length-i.path.length)}function Mq(e,t,a,i=new Set){if(e.localProjectId&&t.has(e.localProjectId))return e.localProjectId;if(e.workspaceKind==="local_project"&&e.workspaceId&&t.has(e.workspaceId))return e.workspaceId;if(e.metadata?.workspaceTarget==="hybrid"&&e.cwd){const u=JI(e.cwd,a);if(u)return u}if(e.cloudProjectId&&i.has(e.cloudProjectId))return e.cloudProjectId;if(!e.cwd||e.workspaceKind==="sandbox"||e.workspaceKind==="sandbox_template"||e.workspaceKind==="sandbox_app"||!XI(e))return null;const s=Bf(e.cwd);if(!s)return null;for(const u of a)if(qb(s,u.path))return u.projectId;return null}function X_(e,t,a,i=new Set){if(e.localProjectId&&t.has(e.localProjectId))return Dt("local",e.localProjectId);if(e.workspaceKind==="local_project"&&e.workspaceId&&t.has(e.workspaceId))return Dt("local",e.workspaceId);if(e.metadata?.workspaceTarget==="hybrid"&&e.cwd){const u=JI(e.cwd,a);if(u)return Dt("local",u)}if(e.cloudProjectId&&i.has(e.cloudProjectId))return Dt("cloud",e.cloudProjectId);if(!e.cwd||e.workspaceKind==="sandbox"||e.workspaceKind==="sandbox_template"||e.workspaceKind==="sandbox_app"||!XI(e))return null;const s=Bf(e.cwd);if(!s)return null;for(const u of a)if(qb(s,u.path))return Dt("local",u.projectId);return null}function JI(e,t){const a=Bf(e);if(!a)return null;for(const i of t)if(qb(a,i.path))return i.projectId;return null}function XI(e){return e.workspaceKind==="local_project"||e.provider==="codex"||_n(e.id)}function Bf(e){const t=e?.trim();if(!t)return null;let a=t.replace(/^file:\/\/+/i,"/").replace(/\\/g,"/").replace(/\/+/g,"/");return/^[a-z]:/i.test(a)&&(a=a[0].toUpperCase()+a.slice(1)),a=a.replace(/\/+$/g,""),a||"/"}function qb(e,t){const a=Q_(e),i=Q_(t);return a===i||a.startsWith(`${i}/`)}function Q_(e){return/^[A-Z]:\//.test(e)?e.toLowerCase():e}function ex(e){if(e<1e3)return String(e);const t=e/1e3;return t>=10||Number.isInteger(t)?`${Math.round(t)}k`:`${t.toFixed(1)}k`}function Pq(e){return e===null?"unknown":e>=85?"high":e>=65?"medium":"low"}function tx(e,t){const a=e?.triggerPercent??85;return e?.autoEnabled===!1?t>=a?"Auto compaction is off. Start a new chat or turn it on before the provider limit is reached.":"Auto compaction is off.":`Auto compacts at ${a}% context when supported.`}function Oq(e){return e==="codex"}function jq(e){return e==="openpond"}function QI(e){for(let t=e.length-1;t>=0;t-=1){const a=e[t];if(a?.name!=="session.context.updated")continue;const i=KN.safeParse(a.data);if(i.success)return i.data}return null}function eA(e){if(e.snapshot&&e.snapshot.provider===e.provider){const a=e.snapshot.usedTokens,i=e.snapshot.maxContextTokens,s=Math.min(100,Math.round(e.snapshot.percentFull)),u=`${s}% full`,d=`${ex(a)} / ${ex(i)} tokens used`;return{usedTokens:a,maxTokens:i,percent:s,summary:u,tokensLabel:d,detail:tx(e.preferences,s),tooltip:`Context window: ${u} ${d}. ${tx(e.preferences,s)}`,tone:Pq(s)}}if(Oq(e.provider)){const a="Context is managed by Codex app-server.";return{usedTokens:0,maxTokens:null,percent:null,summary:"Managed externally",tokensLabel:"Codex app-server",detail:a,tooltip:`Context window: ${a}`,tone:"unknown"}}if(!jq(e.provider)){const a="Context pressure is unavailable until this provider has model context metadata.";return{usedTokens:0,maxTokens:null,percent:null,summary:"Limit unknown",tokensLabel:"Provider metadata unavailable",detail:a,tooltip:`Context window: ${a}`,tone:"unknown"}}const t="Send a message to measure hosted context.";return{usedTokens:0,maxTokens:null,percent:null,summary:"Not measured yet",tokensLabel:"Hosted context",detail:t,tooltip:`Context window: ${t}`,tone:"unknown"}}function Bb(e){let t=!1;const a=tA(e);for(let i=e.length-1;i>=0;i-=1){const s=e[i];if(Nq(s)){t=!0;continue}const u=Hc(s?.data);if(!(s?.name!=="diagnostic"||!u)){if(u.kind==="thread_goal_cleared")return null;if(u.kind==="thread_goal"){const d=Vb(Hc(u.goal),bo(u.provider),a);if(d){const f=ld(d);return t&&f.tone==="active"?null:f}}if(u.kind==="goal_context"){const d=aA(s.output??"",bo(u.provider)??"codex",a);if(d){const f=ld(d);return t&&f.tone==="active"?null:f}}}}return null}function hf(e){const t=tA(e);for(let a=e.length-1;a>=0;a-=1){const i=e[a],s=Hc(i?.data);if(!(i?.name!=="diagnostic"||!s)){if(s.kind==="thread_goal_cleared"&&s.synthetic!==!0)return null;if(s.kind==="thread_goal"){const u=Vb(Hc(s.goal),bo(s.provider),t);if(!u)continue;const d=ld(u);return d.tone==="active"?d:null}if(s.kind==="goal_context"){const u=aA(i.output??"",bo(s.provider)??"codex",t);if(!u)continue;const d=ld(u);return d.tone==="active"?d:null}}}return null}function Cg(e){const t=Hc(Hc(e)?.codexGoalRuntime),a=Vb(t,bo(t?.provider)??"codex");if(!a)return null;const i=ld(a);return i.tone==="active"?i:null}function Nq(e){return e?.name==="turn.completed"||e?.name==="turn.interrupted"||e?.name==="turn.failed"}function ld(e){const t=oA(e.status),a=sA(e.timeUsedSeconds),i=`Goal ${a}`,s=e.tokensUsed===null?null:e.tokenBudget===null?`${Ig(e.tokensUsed)} tokens`:`${Ig(e.tokensUsed)} / ${Ig(e.tokenBudget)} tokens`,u=s?`${e.statusLabel} · ${s}`:e.statusLabel;return{objective:e.objective,status:e.status,timeUsedSeconds:e.timeUsedSeconds,tokensUsed:e.tokensUsed,tokenBudget:e.tokenBudget,actionLabel:t.actionLabel,timeLabel:a,label:i,detail:u,tooltip:`Goal runtime: ${lA(e.timeUsedSeconds)}. ${u}. ${e.objective}`,tone:t.tone,observedAt:e.observedAt}}function zq(e,t){if(!e||e.tone!=="active"||!e.observedAt)return e;const a=nA(e.observedAt,t);if(a<=0)return e;const i=e.timeUsedSeconds+a,s=sA(i);return{...e,timeUsedSeconds:i,timeLabel:s,label:`Goal ${s}`,tooltip:`Goal runtime: ${lA(i)}. ${e.detail}. ${e.objective}`,observedAt:t}}function Vb(e,t=null,a=null){if(!e)return null;const i=bo(e.objective)??"Active goal",s=bo(e.status)??"active";if((bv(t)??bv(bo(e.provider)))!=="codex")return null;const d=a??bo(e.updatedAt)??bo(e.updated_at)??null,f=yc(e.timeUsedSeconds)??yc(e.time_used_seconds)??0,b=bo(e.activeSinceAt)??bo(e.active_since_at),p=oA(s).tone==="active"?nA(b??bo(e.createdAt)??bo(e.created_at),d):0,y=b?f+p:Math.max(f,p),k=yc(e.tokensUsed)??yc(e.tokens_used),w=yc(e.tokenBudget)??yc(e.token_budget);return{objective:i,status:s,statusLabel:rA(s),timeUsedSeconds:Math.max(0,Math.floor(y)),tokensUsed:k===null?null:Math.max(0,Math.floor(k)),tokenBudget:w===null?null:Math.max(0,Math.floor(w)),observedAt:d}}function tA(e){for(let t=e.length-1;t>=0;t-=1){const a=e[t]?.timestamp;if(a&&Number.isFinite(Date.parse(a)))return a}return null}function nA(e,t){if(!e||!t)return 0;const a=Date.parse(e),i=Date.parse(t);return!Number.isFinite(a)||!Number.isFinite(i)||i<=a?0:Math.floor((i-a)/1e3)}function aA(e,t=null,a=null){if(!e.trim()||bv(t)!=="codex")return null;const i=iA(e,"Status")??"active",s=Lu(e,"Tokens used"),u=Lu(e,"Token budget"),d=Lu(e,"Time used seconds")??Lu(e,"Time spent pursuing goal")??Lu(e,"Elapsed seconds")??0;return{objective:nx(e,"objective")??nx(e,"untrusted_objective")??"Active goal",status:i,statusLabel:rA(i),timeUsedSeconds:Math.max(0,Math.floor(d)),tokensUsed:s,tokenBudget:u,observedAt:a}}function oA(e){switch(Dq(e)){case"active":case"running":return{tone:"active",actionLabel:"Pursuing goal"};case"paused":return{tone:"paused",actionLabel:"Goal paused"};case"blocked":return{tone:"limited",actionLabel:"Goal blocked"};case"complete":case"completed":case"achieved":return{tone:"done",actionLabel:"Goal achieved"};case"failed":return{tone:"limited",actionLabel:"Goal failed"};case"cancelled":case"canceled":case"stopped":return{tone:"limited",actionLabel:"Goal cancelled"};case"budget_limited":return{tone:"limited",actionLabel:"Goal budget limited"};default:return{tone:"active",actionLabel:"Goal status unknown"}}}function Dq(e){return e.trim().toLowerCase().replace(/[-\s]+/g,"_")}function iA(e,t){const a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^\\s*-?\\s*${a}:\\s*(.+?)\\s*$`,"im").exec(e)?.[1]?.trim()||null}function Lu(e,t){const a=iA(e,t);if(!a)return null;const i=a.replace(/,/g,""),s=/-?\d+(?:\.\d+)?/.exec(i);if(!s)return null;const u=Number(s[0]);return Number.isFinite(u)?u:null}function nx(e,t){return new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*<\\/${t}>`,"i").exec(e)?.[1]?.trim()||null}function rA(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function sA(e){if(e<60)return`${e}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const a=Math.floor(t/60),i=t%60;return i>0?`${a}h ${i}m`:`${a}h`}function lA(e){if(e<60)return`${e} ${e===1?"second":"seconds"}`;const t=Math.floor(e/60);if(t<60)return`${t} ${t===1?"minute":"minutes"}`;const a=Math.floor(t/60),i=t%60;return i===0?`${a} ${a===1?"hour":"hours"}`:`${a}h ${i}m`}function Ig(e){if(e<1e3)return String(e);if(e>=1e6){const a=e/1e6;return a<10?`${ax(a,2)}M`:a<100?`${ax(a,1)}M`:`${Math.round(a)}M`}const t=e/1e3;return t>=10||Number.isInteger(t)?`${Math.round(t)}k`:`${t.toFixed(1)}k`}function ax(e,t){return e.toFixed(t).replace(/\.?0+$/,"")}function Hc(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function bo(e){return typeof e=="string"&&e.trim()?e.trim():null}function bv(e){return e?.trim().toLowerCase()||null}function yc(e){return typeof e=="number"&&Number.isFinite(e)?e:null}const Uq=new Set(["planning","applying_source","running_checks","evaluating","pushing_hosted","running_hosted_checks"]),Lq=new Set(["awaiting_questions","awaiting_plan_approval","paused"]);function yv(e){const t=cA(e);return t?Bq(t):null}function cA(e){for(let t=e.length-1;t>=0;t-=1){const a=e[t];if(a?.name!=="create_improve.updated")continue;const i=qq(Zq(a.data));if(i)return i}return null}function Hq(e){if(e.events)return cA(e.events);const t=e.messages??[];for(let a=t.length-1;a>=0;a-=1){const i=t[a]?.createImproveRun??null;if(i)return i}return null}function $q(e,t){const a=e?.target.displayName?.trim()??"",i=a.toLowerCase().replace(/[^a-z0-9]+/g," ").trim();return a&&!/^(?:create|creating|improve|improving|new) (?:an )?agent$/.test(i)?a:t}function qq(e){const t=gd.safeParse(e?.createImproveRun);return t.success?t.data:null}function Bq(e){const t=Vq(e);if(!t)return null;const a=Fq(e.createdAt,e.updatedAt),i=e.blockedReason??Kq(e.state);return{objective:e.objective,status:e.state,timeUsedSeconds:a,tokensUsed:null,tokenBudget:null,actionLabel:t.actionLabel,timeLabel:Gq(a),label:t.actionLabel,detail:i,tooltip:`${t.actionLabel}: ${i}. ${e.objective}`,tone:t.tone}}function Vq(e){const t=e.state,a=e.target.kind==="agent"?"Agent":"Work";return Uq.has(t)?{tone:"active",actionLabel:`${a} running`}:Lq.has(t)?{tone:"active",actionLabel:`${a} awaiting input`}:t==="blocked"?{tone:"limited",actionLabel:`${a} blocked`}:t==="failed"?{tone:"limited",actionLabel:`${a} failed`}:t==="cancelled"?{tone:"limited",actionLabel:`${a} cancelled`}:t==="ready"||t==="ready_local"?{tone:"done",actionLabel:e.target.kind==="agent"?"Agent ready":"Workproduct ready"}:t==="published_hosted"?{tone:"done",actionLabel:e.target.kind==="agent"?"Agent published":"Workproduct published"}:null}function Fq(e,t){const a=Date.parse(e),i=Date.parse(t);return!Number.isFinite(a)||!Number.isFinite(i)||i<a?0:Math.floor((i-a)/1e3)}function Kq(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function Gq(e){if(e<60)return`${e}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const a=Math.floor(t/60),i=t%60;return i>0?`${a}h ${i}m`:`${a}h`}function Zq(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function uA(e,t){if(!t)return null;const a=new Map,i=[];for(const L of e){if(!L.name.startsWith("subagent."))continue;const D=Jq(L);D&&i.push(D);const q=Yq(L);q?.parentSessionId===t&&a.set(q.id,q)}if(a.size===0)return null;const s=[...a.values()].sort((L,D)=>kc(D).localeCompare(kc(L))),u=s.filter(L=>L.status==="queued"||L.status==="running"),d=s.filter(L=>L.status==="completed"),f=s.filter(L=>L.status==="failed"),b=s.filter(L=>L.status==="cancelled"),p=s.filter(L=>L.status==="needs_resume"),y=[...d,...f,...b].sort((L,D)=>kc(D).localeCompare(kc(L))),k=s.reduce((L,D)=>{const q=$c(D.metadata?.usage);return L.totalTokens+=Nm(q?.totalTokens),L.promptTokens+=Nm(q?.promptTokens),L.completionTokens+=Nm(q?.completionTokens),L.requestCount+=Nm(q?.requestCount),L},{totalTokens:0,promptTokens:0,completionTokens:0,requestCount:0}),w=s.flatMap(L=>dA([...L.report?.blockers??[],L.error,L.progress.currentBlocker]).map(D=>({runId:L.id,roleId:L.roleId,status:L.status,message:D}))),T=s.flatMap(L=>mA([...L.report?.artifacts??[],L.report?.patchRef,L.report?.diffRef,...L.progress.patchRefs]).map(D=>({...D,runId:L.id,roleId:L.roleId}))),A=y.map(L=>Wq(L,i)),H=s[0]??null,W=H?{runId:H.id,roleId:H.roleId,status:H.status,message:H.progress.latestMeaningfulActivity||H.report?.summary||H.objective,updatedAt:kc(H)}:null,B=u.length>0?`${u.length} ${u.length===1?"child":"children"} running`:`${y.length} ${y.length===1?"child":"children"} finished`,M=[u.length?`${u.length} active`:null,d.length?`${d.length} completed`:null,f.length?`${f.length} failed`:null,b.length?`${b.length} cancelled`:null,p.length?`${p.length} paused`:null].filter(Boolean).join(" · "),j=W?`${eB(W.roleId)}: ${W.message}`:"";return{sessionId:t,runs:s,activeRuns:u,completedRuns:d,failedRuns:f,cancelledRuns:b,needsResumeRuns:p,terminalRuns:y,latestRun:H,latestMeaningfulUpdate:W,activeCount:u.length,completedCount:d.length,failedCount:f.length,cancelledCount:b.length,needsResumeCount:p.length,terminalCount:y.length,usage:k,blockers:w,evidenceRefs:T,finalResults:A,testsRunCount:s.reduce((L,D)=>L+D.progress.validationAttempts.length,0),label:B,tooltip:[M,j].filter(Boolean).join(". ")}}function Wq(e,t){return{runId:e.id,roleId:e.roleId,status:e.status,objective:e.objective,summary:e.report?.summary||e.error||"Child conversation finished.",findings:e.report?.findings??[],changedFiles:e.progress.changedFiles,refs:mA([...e.report?.artifacts??[],e.report?.patchRef,e.report?.diffRef]),testsRun:e.report?.testsRun??[],validationAttempts:e.progress.validationAttempts.map(a=>a.command),blockers:dA([...e.report?.blockers??[],e.error]),confidence:e.report?.confidence??null,importantMessages:t.filter(a=>a.fromRunId===e.id).map(a=>({id:a.id,runId:e.id,fromRunId:a.fromRunId,kind:a.kind,body:a.body,createdAt:a.createdAt})),workspaceRetention:Xq(e),updatedAt:kc(e)}}function Yq(e){const t=$c(e.data),a=[t?.run,$c(t?.message)?.run];for(const i of a){const s=Lk.safeParse(i);if(s.success)return s.data}return null}function Jq(e){const t=mj.safeParse($c(e.data)?.message);return t.success?t.data:null}function Xq(e){const t=$c($c(e.metadata?.workspaceHandoff)?.workspaceRetention);return t?.status!=="retained"?null:{status:"retained",reason:jm(t.reason),retainedAt:jm(t.retainedAt),expiresAt:jm(t.expiresAt),retentionDays:Qq(t.retentionDays),trigger:jm(t.trigger),cleanupAfterExpiry:t.cleanupAfterExpiry===!0}}function kc(e){return e.updatedAt??e.completedAt??e.startedAt??e.createdAt}function dA(e){return[...new Set(e.map(t=>t?.trim()).filter(t=>!!t))]}function mA(e){const t=new Map;for(const a of e)a&&t.set(`${a.kind}:${a.id}`,a);return[...t.values()]}function $c(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function jm(e){return typeof e=="string"&&e.trim()?e.trim():null}function Nm(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Qq(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function eB(e){return e.slice(0,1).toUpperCase()+e.slice(1).replace(/[-_]+/g," ")}const Sv=[];function _v(e,t){return fA(e,t,null)}function fA(e,t,a){const i=a&&iB(a.events,e)?nB(a.indexes,a.events.length,e):tB(e),s=oB(t);return{...i,...s}}function tB(e){const t=new Map;for(const a of e){if(!a.sessionId)continue;const i=t.get(a.sessionId);i?i.push(a):t.set(a.sessionId,[a])}return aB(t)}function nB(e,t,a){const i=new Map(e.eventsBySessionId),s=new Map(e.latestContextUsageBySessionId),u=new Map(e.latestGoalRuntimeBySessionId),d=new Map(e.latestSubagentRuntimeBySessionId),f=new Set(e.activeGoalSessionIds),b=new Set(e.activeSubagentSessionIds),p=new Set;for(let y=t;y<a.length;y+=1){const k=a[y];if(!k.sessionId)continue;if(p.has(k.sessionId)){i.get(k.sessionId).push(k);continue}const w=i.get(k.sessionId);i.set(k.sessionId,w?[...w,k]:[k]),p.add(k.sessionId)}for(const y of p){const k=i.get(y)??Sv,w=QI(k);w?s.set(y,w):s.delete(y);const T=hA(k);T?(u.set(y,T),T.tone==="active"?f.add(y):f.delete(y)):(u.delete(y),f.delete(y));const A=uA(k,y);A?(d.set(y,A),pA({sessionEvents:k,sessionId:y,latestGoalRuntimeBySessionId:u,activeGoalSessionIds:f}),A.activeCount>0?b.add(y):b.delete(y)):(d.delete(y),b.delete(y))}return{eventsBySessionId:i,latestContextUsageBySessionId:s,latestGoalRuntimeBySessionId:u,latestSubagentRuntimeBySessionId:d,activeGoalSessionIds:f,activeSubagentSessionIds:b}}function aB(e){const t=new Map,a=new Map,i=new Map,s=new Set,u=new Set;for(const[d,f]of e){const b=QI(f);b&&t.set(d,b);const p=hA(f);p&&(a.set(d,p),p.tone==="active"&&s.add(d))}for(const[d,f]of e){const b=uA(f,d);b&&(i.set(d,b),pA({sessionEvents:f,sessionId:d,latestGoalRuntimeBySessionId:a,activeGoalSessionIds:s}),b.activeCount>0&&u.add(d))}return{eventsBySessionId:e,latestContextUsageBySessionId:t,latestGoalRuntimeBySessionId:a,latestSubagentRuntimeBySessionId:i,activeGoalSessionIds:s,activeSubagentSessionIds:u}}function pA(e){if(e.latestGoalRuntimeBySessionId.has(e.sessionId))return;const t=hf(e.sessionEvents);t&&(e.latestGoalRuntimeBySessionId.set(e.sessionId,t),t.tone==="active"&&e.activeGoalSessionIds.add(e.sessionId))}function hA(e){return yv(e)??Bb(e)??hf(e)}function oB(e){const t=new Map,a=new Map,i=new Map,s=new Map;for(const u of e){t.set(u.id,u);const d=a.get(u.status);if(d?d.push(u):a.set(u.status,[u]),u.status!=="pending")continue;const f=i.get(u.sessionId);f?f.push(u):i.set(u.sessionId,[u]);const b=s.get(u.sessionId);(!b||ox(u.createdAt)>ox(b.createdAt))&&s.set(u.sessionId,u)}return{approvalsById:t,approvalsByStatus:a,pendingApprovalsBySessionId:i,latestPendingApprovalBySessionId:s}}function iB(e,t){return e===t?!0:e.length>t.length||e.length===t.length?!1:e.length===0?!0:e[0]===t[0]&&e[e.length-1]===t[e.length-1]}function ki(e,t){return t?e.eventsBySessionId.get(t)??Sv:Sv}function gA(e,t){return t?e.latestContextUsageBySessionId.get(t)??null:null}function vA(e,t){return t?e.latestGoalRuntimeBySessionId.get(t)??null:null}function rB(e,t){return t?e.latestSubagentRuntimeBySessionId.get(t)??null:null}function bA(e,t){return t?e.latestPendingApprovalBySessionId.get(t)??null:null}function ox(e){const t=Date.parse(e);return Number.isFinite(t)?t:Number.NEGATIVE_INFINITY}function sB(e){const t=new Set;if(e.readmePath){const a=e.readmePath.replaceAll("\\","/").split("/").at(-1);a&&t.add(a)}for(const a of e.skills){t.add(a.relativePath);const i=a.relativePath.lastIndexOf("/"),s=i>=0?a.relativePath.slice(0,i):"";for(const u of a.resourceFiles)t.add(s?`${s}/${u}`:u)}return{name:`${e.owner}/${e.repo}`,description:`${e.skills.length} installed skill${e.skills.length===1?"":"s"} from GitHub.`,scope:"extension",packagePath:e.sourcePath,files:[...t]}}function lB(e){return JSON.stringify([e.source,e.repositoryId,e.profileId])}function oZ(e,t){return e.profiles.find(a=>lB(a.ref)===t)?.ref??null}function cB(e,t){return!!(e&&t&&e.source===t.source&&e.repositoryId===t.repositoryId&&e.profileId===t.profileId)}function iZ(e,t){return e.profiles.find(a=>cB(a.ref,t))?.state??null}function uB(e,t){const a=new Map(rD.map(i=>[i.name,{...i,validationMessages:[...i.validationMessages],resourceFiles:[...i.resourceFiles]}]));for(const i of e?.skills??[])a.has(i.name)||a.set(i.name,i);for(const i of t?.extensions??[])if(i.validationStatus==="valid")for(const s of i.skills)s.validationStatus!=="valid"||a.has(s.name)||a.set(s.name,{name:s.name,description:s.description,path:s.relativePath,scope:"profile",enabled:!0,sourcePath:i.sourcePath,charCount:s.charCount,sourceHash:s.sourceHash,validationStatus:"valid",validationMessages:[],resourceFiles:s.resourceFiles});return[...a.values()].sort((i,s)=>i.name.localeCompare(s.name))}function dB(e){return{sourceTaskId:e.sourceTaskId,sourceExperience:e.sourceExperience,targetExperience:e.targetExperience,sourceMessageIds:[...e.sourceMessageIds??[]],sourceContext:e.sourceContext?.trim()||null,outputId:e.output?.id??null,outputRevision:e.output?.revision??null,createdAt:e.createdAt??new Date().toISOString(),checkoutMutation:"none"}}function rZ(e,t){const a=`Continue from the attached Work output "${e.title}" (revision ${e.revision}).`;return t==="work"?`${a} Choose a Project or repository before making source changes; do not mutate a checkout until I choose it.`:a}const yA="openpond:last-chat-task-mode";function mB(e,t){return e==="labs"?"models":"chat"}function fB(e){try{return e.getItem(yA)==="work"?"work":"chat"}catch{return"chat"}}function SA(){if(typeof window>"u")return"chat";try{return fB(window.localStorage)}catch{return"chat"}}function pB(e,t){try{e.setItem(yA,t==="chat"?"chat":"work")}catch{}}function hB(e){if(!(typeof window>"u"))try{pB(window.localStorage,e)}catch{}}const gB="uploaded to a different account";function _A(e,t){const a=e?.linkedSandboxProject??null;if(!a?.projectId||!a.teamId)return{state:"none",linked:null,cloudProject:null};const i=t?.find(s=>s.id===a.projectId&&s.teamId===a.teamId)??null;return i?{state:"confirmed",linked:a,cloudProject:i}:{state:"different_account",linked:a,cloudProject:null}}function oi(e,t){const a=_A(e,t);return a.state==="confirmed"?a.cloudProject:null}function vB(e,t){return _A(e,t).state==="different_account"?gB:null}function Ki(e){return e==="sandbox"||e==="sandbox_template"||e==="sandbox_app"}function xA(e={}){return{...e,workspaceTarget:"hybrid"}}function bB(e={}){return{...e,workspaceTarget:"local"}}function Gi(e){return e?.metadata?.workspaceTarget==="hybrid"}function yB(e){return!!(e&&e.provider==="openpond"&&e.workspaceKind==="local_project"&&e.cloudProjectId&&e.title.trim().endsWith(" Cloud"))}function kA({cloudProjects:e,selectedCloudProject:t,selectedProject:a}){const i=a?.linkedSandboxProject??null,s=e?oi(a,e):null,u=t?.id??s?.id??(e?null:i?.projectId??null),d=t?.teamId??s?.teamId??(e?null:i?.teamId??null);return!u||!d?{kind:"missing_cloud_project",message:"Upload/sync this Project to Cloud before using Hybrid."}:{kind:"ready",cloudProjectId:u,cloudTeamId:d,cwd:a?.workspacePath??null,localProjectId:a?.id??null,workspaceName:t?.name??s?.name??i?.projectName??a?.name??"Hybrid workspace"}}function wA({modelRef:e,provider:t,target:a,title:i}){return{provider:t,...e?{modelRef:e}:{},appId:null,appName:null,workspaceKind:"sandbox",workspaceId:null,workspaceName:a.workspaceName,localProjectId:a.localProjectId,cloudProjectId:a.cloudProjectId,cloudTeamId:a.cloudTeamId,metadata:xA(),cwd:a.cwd,title:i}}function SB(e){return _.useEffect(()=>{const t=LI(e.selectedSession);!t||e.composerDraftStore.getSnapshot()||e.composerDraftStore.set(t)},[e.composerDraftStore,e.selectedSession?.id]),_.useCallback(async t=>{const a=t.trim();if(!e.connection||!a||e.activeExperience==="chat")return!1;const i=ZH(a);try{let s;const u=e.selectedSession;if(u&&qf(u))s=await de.patchSession(e.connection,u.id,{title:i,metadata:xg(u.metadata,a)}),e.setSessions(d=>d.map(f=>f.id===s.id?s:f));else{const d=u?.metadata?.workspaceTarget==="hybrid"?"hybrid":u?.metadata?.workspaceTarget==="local"?"local":null,f=u?.provider??(e.selectedCloudProject?"openpond":e.activeProvider),b=u?.modelRef??(f==="openpond"?{providerId:"openpond",modelId:md}:{providerId:f,modelId:e.activeModel}),p=d?{workspaceTarget:d}:!u&&e.workspaceTarget==="local"?{workspaceTarget:"local"}:{};let y;if(!u&&e.workspaceTarget==="hybrid"){const k=kA({cloudProjects:e.cloudProjects,selectedCloudProject:e.selectedCloudProject,selectedProject:e.selectedProject});if(k.kind!=="ready")throw new Error(k.message);const w=wA({modelRef:b,provider:f,target:k,title:i});y={...w,experience:"work",metadata:xg(w.metadata,a)}}else y={experience:"work",provider:f,modelRef:b,openPondCommandAccessMode:u?.openPondCommandAccessMode??e.activeOpenPondCommandAccessMode,appId:u?.appId??null,appName:u?.appName??null,workspaceKind:u?.workspaceKind??(e.selectedCloudProject?"sandbox":e.selectedProject?"local_project":void 0),workspaceId:u?.workspaceId??e.selectedCloudProject?.id??e.selectedProject?.id??null,workspaceName:u?.workspaceName??e.selectedCloudProject?.name??e.selectedProject?.name??null,localProjectId:u?.localProjectId??e.selectedProject?.id??null,cloudProjectId:u?.cloudProjectId??e.selectedCloudProject?.id??null,cloudTeamId:u?.cloudTeamId??e.selectedCloudProject?.teamId??null,cwd:u?.cwd??e.selectedProject?.workspacePath??null,metadata:xg(p,a),title:i};s=await de.createSession(e.connection,y),e.setSessions(k=>[s,...k])}return e.composerDraftStore.set(""),e.setMentionedAppId(null),e.setSelectedSessionId(null),e.setView("chat"),e.requestComposerFocus(),e.showToast("Task draft saved.","success"),!0}catch(s){return e.showToast(s instanceof Error?s.message:"Could not save task draft.","error"),!1}},[e.activeExperience,e.activeModel,e.activeOpenPondCommandAccessMode,e.activeProvider,e.cloudProjects,e.composerDraftStore,e.connection,e.requestComposerFocus,e.selectedCloudProject,e.selectedProject,e.selectedSession,e.setMentionedAppId,e.setSelectedSessionId,e.setSessions,e.setView,e.showToast,e.workspaceTarget])}const _B=[];function xB({primary:e,secondary:t}){const[a,i]=_.useState(!1),{composerDraftStore:s,appDispatch:u,pendingTerminalCommand:d,setPendingTerminalCommand:f,terminalTabs:b,setTerminalTabs:p,trainingDetailTasksetId:y,setTrainingDetailTasksetId:k,mentionedAppId:w,setMentionedAppId:T,cloudSetupDialog:A,setCloudSetupDialog:H,rightPanelTabRequest:W,workspaceDiffPanelViewState:B,mainComposerFocusRequestId:M,requestMainComposerFocus:j,projectConfirmDialog:L,resolveProjectConfirmDialog:D,query:q,searchOpen:$,archivedChatsOpen:X,sectionMenuOpen:ae,cloudProjectsExpanded:ie,sidebarOpen:ue,view:ge,selectedAppId:Te,selectedProjectId:Be,selectedSessionId:Pe,codexPermissionMode:U,codexReasoningEffort:le,busy:he,diffPanelOpen:Me,diffPanelExpanded:Ue,rightPanelMode:O,activeExperience:Z,changeNewExperience:be,terminalOpen:ve,settingsSection:fe,newProjectDialogOpen:ee,newProjectMode:Ce,newProjectName:je,newProjectPath:et,newProjectBusy:We,commitDialogOpen:Ve,commitMessage:lt,commitIncludeUnstaged:st,commitNextStep:Je,commitDraft:Y,branchDialogOpen:oe,branchDialogName:K,toast:te,labDetailNavigation:xe,setQuery:Oe,setSearchOpen:Ye,setArchivedChatsOpen:bt,setSectionMenuOpen:dt,setCloudProjectsExpanded:wt,setChatRowsVisibleCount:_t,setSidebarOpen:Ge,setView:at,setSelectedAppId:g,setSelectedProjectId:F,setSelectedSessionId:re,setPrompt:Ie,setDraftProvider:G,setDraftModel:se,setDraftExperience:R,setDiffPanelOpen:V,setDiffPanelExpanded:pe,setRightPanelMode:me,setTerminalOpen:ke,setSettingsSection:Ee,setNewProjectDialogOpen:Re,setNewProjectName:Xe,setNewProjectPath:tt,setCommitDialogOpen:qe,setCommitMessage:ye,setCommitIncludeUnstaged:Qe,setCommitNextStep:ot,setCommitDraft:Ft,setBranchDialogOpen:Jn,setBranchDialogName:Mn,setError:Hn,showToast:zt,applyBootstrapPayload:Pn,bootstrap:xn,connection:an,startup:Qa,training:An,pinnedCollapsed:Xn,cloudProjectsCollapsed:kn,chatsCollapsed:on,savedForLaterCollapsed:fn,sidebarWidth:Aa,sidebarResizing:Rn,diffPanelWidth:fa,diffPanelResizing:Ct,togglePinnedCollapsed:ra,toggleCloudProjectsCollapsed:eo,toggleChatsCollapsed:Lo,toggleSavedForLaterCollapsed:Sa,startSidebarResize:La,startDiffPanelResize:Qn,selectedApp:to,selectedCloudProject:wn,selectedProject:no,selectedProjectLinkedApp:jt,selectedSession:Jt,sidebarSessions:At,runtimeIndexes:$t,chatMentionApps:sn,connectedAppMentions:Un,pendingApproval:pa,account:pt,activeModel:Cn,activeProvider:xt,appDefaults:Zt,startMessage:Ho,teamChatOrganization:Ha,teamChatTeamId:ao,teamChat:Tt,publishTeamProfileAgent:$o,communitySidebar:oo,communityView:sa,teamAiThreadId:Ra,toggleTeamAiSidebar:si,activeOpenPondCommandAccessMode:$a,viewWorkspaceAppId:io,viewWorkspaceId:Zi,viewWorkspaceKind:wi,viewWorkspaceName:Co,selectedActionCatalog:$s,expandedProjectIds:Nr,expandProject:li,toggleProjectExpanded:Wi,changeCodexPermissionMode:zr,changeCodexReasoningEffort:Dr,changeOpenPondCommandAccessMode:ci,resolveApproval:qa,beginNewChat:ro,beginNewChatWithTrainingModel:Yi,dismissTrainingChatHandoff:qo,trainingChatHandoff:Bo,selectTrainingChatTaskForComposer:Ur,chatHistoryLoadStates:Ji,loadMoreSelectedChatHistory:Lr,selectedPagedSessionEvents:Vo,activeSessions:ha,archivedSessions:Xi,pinnedSessions:ui,savedForLaterSessions:Ta,savedForLaterFiles:Io,sidebarFileBookmarks:la,setSidebarFileStatus:Qi,setSessions:Fo,projectRows:On,localProjectRows:Hr,cloudProjectRows:bn,projectSessionRowsByProjectId:_a,childSessionRowsByParentId:so,sidebarProjectIdBySessionId:lo,chatRows:qs,visibleChatRows:er,chatRowsVisibleCount:Ci,sessionEvents:Ao,goalRuntime:di,subagentRuntime:Ii,visibleChatMessages:tr,activeTerminalScope:$r,terminalSummaries:qr,runningSessionIds:ga,selectedSessionRunning:Br,selectedSteerAutoDispatchBlocked:nr,selectedSteerAutoDispatchReady:mi,sidebarGoalRuntimeBySessionId:ar,sidebarSubagentRuntimeBySessionId:Ko,taskDragSessionId:Vr,taskPreviewSessionIds:Fr,startTaskDrag:or,clearTaskDrag:Bs,previewTaskDrop:Kr,commitTaskDrop:Ai,commitTaskPreviewDrop:Vs,dragItem:Gr,startPinnedDrag:ir,clearSidebarDrag:Ri,previewPinnedDrop:Go,commitPinnedDrop:Fs,commitPinnedPreviewDrop:Ks,commandProjectRows:Gs,contextWindowStatus:Zr,pinnedRows:Zo,workspaceBusy:Ti,diffBusy:Zs,visibleWorkspaceState:fi,visibleWorkspaceDiff:pi,refreshVisibleWorkspaceDiff:ca,managedWorkspace:Ws,canSyncActiveWorkspace:Wr,canPublishOpenPondProject:Yr,projectTarget:Et,workspaceTarget:pn}=e,{title:co,browserConversationId:ln,handleWorkspaceDiffPanelViewStateChange:Ba,openSessionInChat:va,changeProjectTarget:Jc,submitNewProjectDialog:Rl,changeWorkspaceBranch:Tl,openCommitDialog:rr,openCreateWorkspaceBranchDialog:hi,openDefaultsSettingsFromBranchDialog:El,runWorkspaceTool:Jr,submitCommitDialog:Ml,submitCreateWorkspaceBranch:Pl,syncWorkspaceLocally:Ys,answerCreateImproveQuestion:Js,applyCreateImproveCandidate:Ol,approveCreateImproveRun:jl,cancelCreateImproveRun:Nl,changeDraftProvider:zl,openCreateImprovePullRequest:Xc,reconcileCreateImprovePullRequest:Qc,rejectCreateImproveCandidate:Dl,pauseCreateImproveRun:eu,resumeCreateImproveRun:xa,reviseCreateImproveRun:sr,stopTurn:Xr,archiveSession:Xs,restoreSession:Ul,renameSession:Ll,toggleSessionPinned:Qr,toggleSessionSavedForLater:Hl,startCloudSetupUpload:Ei,changeWorkspaceTarget:lr,sendPromptFromMainComposer:cr,openSandboxWorkspace:es,openUrlInBrowserPanel:$l,showBrowserPanel:Ro,showChangesPanel:Mi,showGoalSidebarTab:ts,rightChatTrainingLaunchRequest:Qs,setRightChatTrainingLaunchRequest:Wo,closeRightChatPanel:ql,openRightChatPanel:ns,rightChatPanelViews:el,showRightChatPanel:tu,showRightPanelDiffTab:nu,submitRightChatPrompt:au,activateRightChatPanel:Bl,updateRightChatModel:Vl,updateRightChatPrompt:Yo,updateRightChatProvider:Ea,updateRightChatScrollState:as,openProfileSettings:Ma,diagnosticEvents:Pi,toggleRightSidebar:os}=t,[Oi,ji]=_.useState(null),[ur,To]=_.useState(null),Fl=uB(xn?.profile,xn?.extensionCatalog),[Ni,Jo]=_.useState(null),[tl,ua]=_.useState(null),[dr,Eo]=_.useState(null),Kl=_.useCallback(()=>{g(null),F(null),re(null),dt(null),at("team")},[dt,g,F,re,at]),is=_.useCallback(()=>{g(null),F(null),re(null),dt(null),oo.discoverCommunities()},[oo.discoverCommunities,dt,g,F,re]),gi=SB({activeExperience:Z,activeModel:Cn,activeOpenPondCommandAccessMode:$a,activeProvider:xt,cloudProjects:xn?.cloudProjects??_B,composerDraftStore:s,connection:an,requestComposerFocus:j,selectedCloudProject:wn,selectedProject:no,selectedSession:Jt,setMentionedAppId:T,setSelectedSessionId:re,setSessions:Fo,setView:at,showToast:zt,workspaceTarget:pn.value}),nl=_.useCallback(async nt=>{if(!an)throw new Error("OpenPond is not connected.");let Gt=xt,yn=Cn;Gt==="codex"&&(Gt=vv(xn?.providers,{enabledOnly:!0}).find(bi=>bi.value!=="codex")?.value??xl,yn=df(Gt,xn?.providers)??Xu);const Ui=At.find(bi=>bi.id===nt.sourceSessionId),Va=await de.createSession(an,{experience:nt.target,provider:Gt,modelRef:{providerId:Gt,modelId:yn},openPondCommandAccessMode:$a,appId:null,appName:null,workspaceId:null,workspaceName:null,localProjectId:null,cloudProjectId:null,cloudTeamId:null,cwd:null,title:`Continue ${Ui?.title??"task"}`.slice(0,120),metadata:{experienceHandoff:dB({sourceTaskId:nt.sourceSessionId,sourceExperience:Ui?.experience??null,targetExperience:nt.target,sourceMessageIds:nt.sourceMessageIds??[],sourceContext:nt.sourceContext,output:nt.output})}});return Fo(bi=>[Va,...bi]),R(nt.target),G(Gt),se(yn),s.set(nt.prompt),u({type:"selectSession",sessionId:Va.id,appId:null,projectId:null}),g(null),F(null),ke(!1),at("chat"),me("home"),V(nt.target==="work"),pe(!1),Va},[Cn,$a,xt,u,xn?.providers,s,an,pe,V,R,se,G,me,g,F,Fo,ke,at,At]),Gl=_.useCallback(nt=>{Jo(nt),ua(null),ro(null),Ge(!0)},[ro,Ge]),al=_.useCallback(nt=>{ua(sB(nt)),Jo(null),ro(null),Ge(!0)},[ro,Ge]);_.useEffect(()=>{!Ni&&!tl||ge!=="chat"||Pe||Be||Te||(ji(Ni),To(tl),Jo(null),ua(null),me("home"),pe(!1),V(!0))},[Ni,tl,Te,Be,Pe,pe,V,me,ge]),_.useEffect(()=>{!Oi&&!ur||ge==="chat"&&Me&&O==="home"||(ji(null),To(null))},[Me,ur,Oi,O,ge]);const Zl=_.useCallback(()=>{ji(null),To(null),pe(!1),V(!1)},[pe,V]),Pa=_.useCallback(nt=>{if(nt.workspaceKind==="local"){const Gt=Dt("local",nt.workspaceId);g(null),F(Gt),re(null),li(Gt),at("chat")}else{const Gt=At.find(yn=>yn.id===nt.sourceSessionId||yn.workspaceId===nt.workspaceId);if(!Gt){zt("This saved file's cloud chat is no longer available.","error");return}va(Gt.id)}me("changes"),V(!0),Eo({id:Date.now(),file:nt}),nt.available||zt(`File unavailable: ${nt.path}`,"error")},[li,va,V,me,g,F,re,at,zt,At]);_.useEffect(()=>{if(!dr)return;const nt=window.setTimeout(()=>{me("changes"),V(!0)},0);return()=>window.clearTimeout(nt)},[Be,Pe,V,me,dr]);const zi=mB(ge),Di=_.useCallback(nt=>{if(dt(null),g(null),F(null),re(null),nt==="models"){at("labs");return}be(SA())},[be,dt,g,F,re,at]),rs=_.useCallback(async(nt,Gt)=>{const yn=await An.actions.acceptHarnessReview(nt,Gt,{providerId:xt,modelId:Cn},le);return yn?(k(yn.materializedTasksetId??null),at("labs"),!0):(zt("Taskset review could not be opened.","error"),!1)},[Cn,xt,le,k,at,zt,An.actions]);if(!Qa.ready)return E.jsx(Cq,{startup:Qa});if(ge==="settings")return E.jsx(Z_,{showToast:zt,children:E.jsx(_q,{settings:{payload:xn,connection:an,diagnostics:Pi,initialSection:fe,onPayload:Pn,onError:Hn,onToast:zt,onOpenSourceSession:va,onAcceptEvaluationReview:rs,onOpenSkill:Gl,onOpenExtension:al,teamChatCurrentUserId:Tt.currentUserId,teamChatEnabled:ao!==null,teamChatNotificationMode:Tt.notificationMode,teamChatThreads:Tt.threads,onTeamChatNotificationModeChange:Tt.setNotificationMode,onTeamChatThreadMuteChange:Tt.setThreadMuted,diffPanelWidth:fa,diffPanelResizing:Ct,diffPanelExpanded:Ue,onDiffPanelResizeStart:Qn,onDiffPanelExpandedChange:pe,onBack:()=>{at("chat"),Ge(!0)}},toast:{toast:te,onDismiss:()=>u({type:"field",key:"toast",value:null})}})});const ss=$f(),$n=an?.platform??navigator.platform,ka=ss&&zb($n),uo=$r,mo=fi?.initialized?fi.repoPath:Jt?.cwd??null,Oa={"--sidebar-width":`${Aa}px`,"--diff-panel-width":`${fa}px`},Mo=ge==="chat"&&Z!=="chat"||ge==="labs"||ge==="scheduled"&&a||ge==="team"&&!!Ra,ol=["app-shell",ka?"platform-macos":"",ue?"sidebar-open":"sidebar-closed",Rn?"sidebar-resizing":"",Ct?"diff-panel-resizing":""].filter(Boolean).join(" "),mr=Pe?Ji[Pe]:null,vi=Pe?mr?.cursorSequence??Rq(_l(Vo,ki($t,Pe))):null,Fn=!!Pe&&!!an&&(_n(Pe)?!0:!!xn?.eventWindow?.hasMoreBefore&&!!vi)&&(mr?.hasMore??!0),cn=!!mr?.loading;return E.jsx(Z_,{showToast:zt,children:E.jsx(Sq,{className:ol,style:Oa,sidebar:{productArea:zi,onProductAreaChange:Di,experience:Z,view:ge,selectedAppId:Te,selectedProjectId:Be,selectedSessionId:Pe,selectedTeamThreadId:Tt.selectedThreadId,teamChatEnabled:ao!==null,teamChatOrganization:Ha,teamChatLoading:Tt.loading,currentUserId:Tt.currentUserId,teamMembers:Tt.members,teamThreads:Tt.threads,...oo,account:pt,connection:an,profile:xn?.profile,pinnedCollapsed:Xn,cloudProjectsCollapsed:kn,chatsCollapsed:on,savedForLaterCollapsed:fn,archivedChatsOpen:X,cloudProjectsExpanded:ie,sectionMenuOpen:ae,dragItem:Gr,taskDragSessionId:Vr,taskPreviewSessionIds:Fr,activeSessions:ha,archivedSessions:Xi,pinnedRows:Zo,pinnedSessions:ui,savedForLaterSessions:Ta,savedForLaterFiles:Io,projectRows:On,localProjectRows:Hr,cloudProjectRows:bn,projectSessionRowsByProjectId:_a,childSessionRowsByParentId:so,sidebarProjectIdBySessionId:lo,terminalSummaries:qr,runningSessionIds:ga,goalRuntimeBySessionId:ar,subagentRuntimeBySessionId:Ko,visibleChatRows:er,chatRows:qs,chatRowsVisibleCount:Ci,expandedProjectIds:Nr,currentVersion:xn?.server.version??null,platform:$n,arch:an?.arch??null,onSidebarResizeStart:La,setSidebarOpen:Ge,setView:at,setSelectedAppId:g,setSelectedProjectId:F,setSelectedSessionId:re,setSearchOpen:Ye,setSectionMenuOpen:dt,setSettingsSection:Ee,onTogglePinnedCollapsed:ra,onToggleCloudProjectsCollapsed:eo,onToggleChatsCollapsed:Lo,onToggleSavedForLaterCollapsed:Sa,setArchivedChatsOpen:bt,setCloudProjectsExpanded:wt,setChatRowsVisibleCount:_t,beginNewChat:ro,dockSessionRight:ns,selectTeamThread:nt=>{at("team"),Tt.selectThread(nt)},openTeamDm:nt=>{at("team"),Tt.openDm(nt)},toggleSessionPinned:Qr,toggleSessionSavedForLater:Hl,openSidebarFile:Pa,setSidebarFileStatus:(nt,Gt)=>{Qi(nt,Gt)},archiveSession:Xs,restoreSession:Ul,renameSession:Ll,expandProject:li,toggleProjectExpanded:Wi,startPinnedDrag:ir,clearSidebarDrag:Ri,previewPinnedDrop:Go,commitPinnedDrop:Fs,commitPinnedPreviewDrop:Ks,startTaskDrag:or,clearTaskDrag:Bs,previewTaskDrop:Kr,commitTaskDrop:Ai,commitTaskPreviewDrop:Vs},topBar:{sidebarOpen:ue,title:co,backAction:xe.backAction,breadcrumbs:xe.breadcrumbs,conversationId:ge==="chat"?Pe:null,workspaceName:Co,workspaceId:Zi,busy:he,workspaceState:fi,workspaceKind:wi,selectedApp:jt??to,selectedProject:no,workspaceDiff:pi,managedWorkspace:Ws,workspaceBusy:Ti,defaultTeamId:Zt.defaultTeamId,showDiffControls:ge==="chat"&&Z==="development",diffPanelOpen:Me,terminalOpen:ve,rightSidebarAvailable:Mo,rightSidebarOpen:ge==="scheduled"?a:Me,onToggleDiffPanel:os,onToggleRightSidebar:ge==="scheduled"?()=>i(nt=>!nt):ge==="team"&&Ra?si:os,onOpenSearch:()=>{dt(null),Ye(!0)},onToggleTerminal:()=>ke(nt=>!nt),onRunTerminalCommand:nt=>{f({id:Date.now(),scope:uo,command:nt}),ke(!0)},onWorkspaceToolAction:Jr,onOpenCommitDialog:rr,onWorkspaceBranchChange:Tl,onWorkspaceBranchCreate:hi,connection:an,onBootstrap:Pn,onOpenSandboxWorkspace:es,onShowSidebar:()=>Ge(!0),onOpenTeamChat:Kl,onDiscoverCommunities:is,collaborationView:ge==="team"||ge==="community"?ge:null,platform:$n,showWorkspaceControls:ge!=="team"&&ge!=="community"&&ge!=="labs"&&ge!=="scheduled"&&ge!=="outputs"&&(Z==="development"||Z==="work"&&!!(no||Jt?.localProjectId||Jt?.cloudProjectId||Jt?.workspaceKind==="local_project"))},mainPane:{experience:Z,onNewExperienceChange:be,view:ge,teamChat:{currentUserId:Tt.currentUserId,members:Tt.members,agents:Tt.agents,profile:xn?.profile??null,teamId:ao,teamName:Ha?.displayName??null,detail:Tt.detail,aiThread:Tt.aiThread,agentConversation:Tt.agentConversation,loading:Tt.loading,busy:Tt.busy,error:Tt.error,connection:an,providerSettings:xn?.providers??null,provider:xt,model:Cn,codexPermissionMode:U,codexReasoningEffort:le,openPondCommandAccessMode:$a,contextWindowStatus:Zr,showToast:zt,onProviderChange:zl,onModelChange:se,onCodexPermissionModeChange:zr,onCodexReasoningEffortChange:Dr,onOpenPondCommandAccessModeChange:ci,onOpenProviderSettings:()=>{Ee("providers"),at("settings")},onSendMessage:Tt.sendMessage,onPublishProfileAgent:$o,onOpenAiThread:async nt=>{await Tt.openAiThread(nt),me("chat"),V(!0)},onOpenAgentConversation:async nt=>{await Tt.openAgentConversation(nt),me("chat"),V(!0)},onCloseAiThread:()=>V(!1),onCloseAgentConversation:()=>{Tt.closeAgentConversation(),V(!1)},onSendAgentTurn:Tt.sendAgentTurn,onSendAiTurn:Tt.sendAiTurn,onStopAiTurn:Tt.stopAiTurn,onEditMessage:Tt.editMessage,onDeleteMessage:Tt.deleteMessage,onRetryMessage:Tt.retryMessage,onDismissFailedMessage:Tt.dismissFailedMessage,onLoadMoreMessages:Tt.loadMoreMessages,onRetryLoad:Tt.refresh},community:sa,bootstrap:xn,runtimeEvents:Ao,chatMessages:tr,contextWindowStatus:Zr,goalRuntime:di,subagentRuntime:Ii,selectedSessionId:Pe,composerDraftStore:s,mainComposerFocusRequestId:M,labCloseDetailRequestId:xe.closeDetailRequestId,labCloseDetailKind:xe.closeDetailKind,sideChatTrainingLaunchRequest:Qs,onSideChatTrainingLaunchHandled:nt=>Wo(Gt=>Gt?.id===nt?null:Gt),steerAutoDispatchBlocked:nr,steerAutoDispatchReady:mi,mentionApps:sn,connectedAppMentions:Un,profileSkills:Fl,selectedMentionAppId:w,busy:he,turnRunning:Br,activeProvider:xt,activeModel:Cn,codexPermissionMode:U,codexReasoningEffort:le,openPondCommandAccessMode:$a,pendingApproval:pa,activeWorkspaceAppId:io,activeWorkspaceId:Zi,activeWorkspaceKind:wi,projectTarget:Et,actionCatalog:$s,workspaceTarget:pn,connection:an,workspaceName:Co,workspaceState:fi,workspaceDiff:pi,workspaceBusy:Ti,diffBusy:Zs,forceChatThread:_n(Pe),diffPanelOpen:Me,diffPanelExpanded:Ue,rightPanelMode:O,rightPanelTabRequest:W,rightChatPanels:el,nativeSkillSidebar:Oi,extensionSkillSidebar:ur,workspaceDiffPanelViewState:B,sidebarFileOpenRequest:dr,sidebarFileBookmarks:la,onSetSidebarFileStatus:(nt,Gt)=>{Qi(nt,Gt)},browserConversationId:ln,terminalScope:uo,terminalTabs:b,terminalCwd:mo,pendingTerminalCommand:d,terminalOpen:ve,onToggleTerminal:()=>ke(nt=>!nt),onWorkspaceDiffPanelViewStateChange:Ba,training:An,trainingSessions:At,trainingChatHandoff:Bo,trainingDetailTasksetId:y,onTrainingDetailTasksetIdChange:k,onTrainingChatTaskSelect:Ur,onTrainingChatHandoffDismiss:qo,onOpenSession:va,onExperienceHandoff:nl,cloudProjects:xn?.cloudProjects??[],chatHistoryHasMore:Fn,chatHistoryLoading:cn,onDiffPanelResizeStart:Qn,onToggleDiffPanelExpanded:()=>pe(nt=>!nt),onShowDiffPanel:Mi,onShowBrowserPanel:Ro,onShowFilesPanel:()=>nu("files"),onShowGoalSidebarTab:ts,onShowTrainingDraftPanel:()=>{me("training"),V(!0)},onShowRightChatPanel:tu,onAddRightChat:()=>ns(null),onOpenRightChatForSession:(nt,Gt)=>{const yn=Gt??At.find(Ui=>Ui.id===nt)??null;yn&&ns(yn,{preserveView:!0})},onLabDetailOpenChange:xe.onDetailOpenChange,scheduledDetailOpen:a,onScheduledDetailOpenChange:i,onTerminalTabsChange:p,onCloseRightChatPanel:ql,onCloseNativeSkillSidebar:Zl,onActivateRightChatPanel:Bl,onRightChatModelChange:Vl,onRightChatPromptChange:Yo,onRightChatScrollStateChange:as,onRightChatProviderChange:Ea,onSubmitRightChat:au,onStopRightChat:nt=>Xr(nt),onCloseTerminal:()=>ke(!1),onLoadMoreChatHistory:Lr,canSyncWorkspace:Wr,startMessage:Ho,onPayload:Pn,onError:Hn,setView:at,onOpenProfileSettings:Ma,onOpenProviderSettings:()=>{Ee("providers"),at("settings")},onOpenTrainingSettings:()=>{Ee("training"),at("settings")},onOpenDatasetStorageSettings:()=>{Ee("dataset-storage"),at("settings")},changeDraftProvider:zl,changeProjectTarget:Jc,changeWorkspaceTarget:lr,setDraftProvider:G,setDraftModel:se,onBeginNewChatWithModel:Yi,changeCodexPermissionMode:zr,changeCodexReasoningEffort:Dr,changeOpenPondCommandAccessMode:ci,resolveApproval:qa,answerCreateImproveQuestion:Js,applyCreateImproveCandidate:Ol,approveCreateImproveRun:jl,cancelCreateImproveRun:Nl,openCreateImprovePullRequest:Xc,reconcileCreateImprovePullRequest:Qc,rejectCreateImproveCandidate:Dl,pauseCreateImproveRun:eu,resumeCreateImproveRun:xa,reviseCreateImproveRun:sr,setMentionedAppId:T,showToast:zt,onSaveTaskDraft:gi,sendPrompt:cr,stopTurn:Xr,syncWorkspaceLocally:Ys,refreshWorkspaceDiff:ca},cloudSetup:{state:A,onClose:()=>H(null),onOpenBrowserUrl:$l,onStart:()=>{Ei()}},projectConfirm:{state:L,onResolve:D},lazyPanels:{activeSessions:ha,branchDialogName:K,branchDialogOpen:oe,commitDialogOpen:Ve,commitDraft:Y,commitIncludeUnstaged:st,commitMessage:lt,commitNextStep:Je,canPublishOpenPondProject:Yr,connection:an,expandProject:li,newProjectBusy:We,newProjectDialogOpen:ee,newProjectDirectory:Zt.defaultNewProjectDirectory,newProjectMode:Ce,newProjectName:je,newProjectPath:et,projectRows:Gs,query:q,searchOpen:$,visibleWorkspaceDiff:pi,visibleWorkspaceState:fi,workspaceBusy:Ti,appDispatch:u,beginNewChat:()=>ro(null),openDefaultsSettingsFromBranchDialog:El,setBranchDialogName:Mn,setBranchDialogOpen:Jn,setCommitDialogOpen:qe,setCommitDraft:Ft,setCommitIncludeUnstaged:Qe,setCommitMessage:ye,setCommitNextStep:ot,setNewProjectDialogOpen:Re,setNewProjectName:Xe,setNewProjectPath:tt,setPrompt:Ie,setQuery:Oe,setSearchOpen:Ye,submitCommitDialog:Ml,submitCreateWorkspaceBranch:Pl,submitNewProjectDialog:Rl},toast:{toast:te,onDismiss:()=>u({type:"field",key:"toast",value:null})}})})}const Ec=new Map,Ym=new Map;function xv(e){if(!e||e.state!=="signed_in")return null;const t=e.accounts.find(s=>s.isActive)??null,a=e.activeProfile?.handle?.trim()||t?.handle?.trim()||e.label.trim()||"signed_in",i=e.activeProfile?.baseUrl??t?.baseUrl??e.baseUrl??"";return[a,i,e.apiBaseUrl??"",e.chatApiBaseUrl??""].join("|")}function kB(e){const t=e?.trim();if(!t)return null;const a=Ec.get(t);return a?.updatedAt?a.organizations:null}function wB(e,t){const a=e?.trim();if(a){Ec.set(a,{organizations:t,promise:null,updatedAt:Date.now()});for(const i of Ym.get(a)??[])i()}}function CB(e,t){const a=e?.trim();if(!a)return()=>{};const i=Ym.get(a)??new Set;return i.add(t),Ym.set(a,i),()=>{i.delete(t),i.size===0&&Ym.delete(a)}}function ix(e){const t=e.accountKey?.trim();if(!t)return Promise.resolve([]);const a=Ec.get(t);if(!e.force){if(a?.updatedAt)return Promise.resolve(a.organizations);if(a?.promise)return a.promise}const i=e.fetchOrganizations().then(s=>(wB(t,s),s)).catch(s=>{const u=Ec.get(t);throw u?.promise===i&&Ec.set(t,{organizations:u.organizations,promise:null,updatedAt:u.updatedAt}),s});return Ec.set(t,{organizations:a?.organizations??[],promise:i,updatedAt:a?.updatedAt??0}),i}const sZ="openpond.config.json";function lZ(e,t,a){return t<=0?-1:a==="Home"?0:a==="End"?t-1:a==="ArrowRight"?(e+1)%t:(e-1+t)%t}function CA(){return{activeTab:"files",openFilePaths:[],selectedPath:null}}function Ag(e){return{activeTab:e.activeTab,openFilePaths:[...e.openFilePaths],selectedPath:e.selectedPath}}function cZ(e,t=null){const a=AB(e.openFilePaths.map(s=>sx(s,t)).filter(Boolean)),i=e.selectedPath&&sx(e.selectedPath,t)||null;return{activeTab:e.activeTab==="file"&&!i?"files":e.activeTab,openFilePaths:a,selectedPath:i}}function rx(e,t){return e.activeTab===t.activeTab&&e.selectedPath===t.selectedPath&&e.openFilePaths.length===t.openFilePaths.length&&e.openFilePaths.every((a,i)=>a===t.openFilePaths[i])}function sx(e,t=null){let a=IB(e);const i=t?.trim().replace(/\\/g,"/").replace(/\/+$/,"");if(!i)return a;if(a===i)return"";a.startsWith(`${i}/`)&&(a=a.slice(i.length+1));const s=i.split("/").filter(Boolean).at(-1);return s&&a.startsWith(`${s}/`)&&(a=a.slice(s.length+1)),a}function uZ(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function dZ(e){return{path:e,status:"unchanged",additions:0,deletions:0,patch:"",content:null}}function mZ(e,t){const a=lx(e.path);return!a||e.path.endsWith("/")||e.content==null&&/Could not access .+\/null['"]?/.test(e.patch)?!0:t.some(i=>{const s=lx(i);return!!(s&&s.startsWith(`${a}/`))})}function fZ(e){return/\.(?:md|markdown|mdx)$/i.test(e)||/(?:^|\/)readme$/i.test(e)}function pZ(e){return/\.(?:doc|docx)$/i.test(e)}function IB(e){let t=e.trim().replace(/^['"`]+|['"`]+$/g,"");if(/^file:\/\//i.test(t))try{t=decodeURIComponent(new URL(t).pathname)}catch{t=t.replace(/^file:\/\//i,"")}return t.replace(/\\/g,"/").replace(/^\.\/+/,"")}function AB(e){return Array.from(new Set(e))}function lx(e){const a=e.replace(/\\/g,"/").replace(/^\.\/+/,"").split("/").filter(Boolean);return a.length===0?null:a.join("/")}function RB(e){if(!e||e.state!=="signed_in")return null;const t=e.accounts.find(f=>f.isActive)??null,a=e.profile?.id?.trim()??"",i=e.activeProfile?.handle?.trim()||t?.handle?.trim()||e.label.trim()||"signed_in",s=e.activeProfile?.baseUrl??t?.baseUrl??e.baseUrl??"",u=e.apiBaseUrl??t?.apiBaseUrl??"",d=e.chatApiBaseUrl??t?.chatApiBaseUrl??"";return[a?`profile:${a}`:"profile:unknown",i,s,u,d].join("|")}function IA(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"cloud-project"}function TB(e){const t=new TextEncoder().encode(e);let a="";for(const i of t)a+=String.fromCharCode(i);return btoa(a)}function Vf(e){const t=e,a=t.teamId||t.id||"";if(!a)return null;const i=t.displayName||t.name||a,s=t.workspaceKind==="personal"||t.isPersonalDefault===!0||t.kind==="personal_default"||t.name?.trim().toLowerCase()==="personal";return{teamId:a,slug:t.slug||IA(i),name:t.name||i,displayName:i,role:t.role==="owner"||t.role==="admin"||t.role==="member"?t.role:"member",workspaceKind:t.workspaceKind==="personal"||t.workspaceKind==="shared"?t.workspaceKind:s?"personal":"shared",status:t.status==="disabled"||t.status==="archived"?t.status:"active",kind:t.kind==="personal_default"||t.kind==="managed_client"||t.kind==="team"?t.kind:void 0,isPersonalDefault:s,isManagedClient:t.isManagedClient===!0||t.kind==="managed_client",primaryContactEmail:t.primaryContactEmail??null,customDomain:t.customDomain??null,planKey:typeof t.planKey=="string"?t.planKey:null,effectiveAccessState:t.effectiveAccessState==="checkout_pending"||t.effectiveAccessState==="active"||t.effectiveAccessState==="grace"||t.effectiveAccessState==="suspended"||t.effectiveAccessState==="cancelling"||t.effectiveAccessState==="cancelled"?t.effectiveAccessState:null,canManageBilling:t.canManageBilling===!0||t.role==="owner",createdAt:t.createdAt??"",updatedAt:t.updatedAt??""}}function EB(e){return e.find(t=>t.workspaceKind==="personal"||t.isPersonalDefault===!0||t.kind==="personal_default")??e.find(t=>t.name.trim().toLowerCase()==="default")??e.find(t=>t.isManagedClient!==!0&&t.kind!=="managed_client")??e[0]??null}function MB(e,t){const a=e.filter(s=>s.status==="active"&&s.workspaceKind==="shared"),i=t?.trim()??"";if(i){const s=a.find(u=>u.teamId===i);if(s)return s}return a.find(s=>s.role==="owner")??a.find(s=>s.role==="admin")??a[0]??null}function PB(...e){for(const t of e){const a=t?.trim();if(a)return a}return""}function OB({draftProvider:e,hasSelectedCloudProject:t,selectedSessionHybridWorkspace:a}){return t&&!a?"openpond":e}const jB=[{value:"action:new-local-project",label:"New local project",detail:"Create a new project folder on this machine",kind:"action"},{value:"action:add-local-project",label:"Use existing folder",detail:"Choose a folder on this machine",kind:"action"},{value:"action:add-local-project-path",label:"Use existing folder path",detail:"Enter a local folder path manually",kind:"action"},{value:"action:new-cloud-project",label:"New cloud project",detail:"Create a project in OpenPond Cloud",kind:"action"},{value:"action:create-cloud-environment",label:"Create cloud environment",detail:"Set up compute for a cloud project",kind:"action"}];function NB(...e){return PB(...e.map(t=>{const a=t?.trim();return a&&!a.includes("@")?a:null}))}function zB(e){if(e?.state!=="signed_in")return"";const t=e.accounts.find(a=>a.isActive)??null;return NB(e.profile?.name,e.label,t?.displayLabel,e.profile?.handle,t?.handle,e.activeProfile?.handle)}function DB({bootstrap:e,draftModel:t,draftProvider:a,selectedApp:i,selectedAppId:s,selectedCloudProject:u,selectedProject:d,selectedSession:f,selectedSessionId:b,selectedSessionLinkedProject:p}){const y=f?.workspaceKind==="local_project"?f.workspaceId??null:p?.id??null,k=_n(b)&&!f,w=f?Ki(f.workspaceKind):!1,T=Gi(f),A=f?yB(f):!1,H=f?.cwd&&(!w||T)?fw(f.cwd):null,W=e?.providers??null,B=oi(d,e?.cloudProjects??[]),M=OB({draftProvider:a,hasSelectedCloudProject:!!u,selectedSessionHybridWorkspace:T}),j=Ls(M,t,W),L=Uo(e?.preferences),D=k?null:f?w?f.workspaceKind??"sandbox":A?"sandbox":y?"local_project":f.workspaceKind??(f.appId?"sandbox_app":H?"local_project":null):u?"sandbox":d?"local_project":s?"sandbox_app":null,q=k?null:f?w&&!T||A?null:y||(f.workspaceId??f.appId??H):u?null:d?.id??s,$=k?null:f?w?f.workspaceId??null:A?null:y??f.workspaceId??f.appId??H:u?null:d?.id??s,X=e?.account??null,ae=!e||X?.state==="loading"||X?.state==="switching",ie=!ae&&X?.state==="signed_out",ue=ae?null:ie?"Sign in":X?.label??X?.activeProfile?.handle??"Account",ge=zB(X),Te=ge?`Welcome, ${ge}`:"Welcome",Be=f?.workspaceName??f?.appName??u?.name??d?.name??i?.name??null,Pe=Ki(D)?"cloud":"local",U=d?.name??p?.name??(f?.workspaceKind==="local_project"?f.workspaceName:null)??"Local workspace",le=(Pe==="cloud"?Be:null)??u?.name??B?.name??d?.name??"Cloud workspace",he=!!(u?.id||B?.id||f?.cloudProjectId||Pe==="cloud");return{account:X,accountLabel:ue,accountPending:ae,accountSignedOut:ie,activeModel:j,activeProvider:M,activeWorkspaceAppId:q,activeWorkspaceId:$,activeWorkspaceKind:D,activeWorkspaceLocation:Pe,appDefaults:L,cloudLinked:he,cloudTargetName:le,localTargetName:U,selectedCodexHistoryPending:k,selectedSessionCloudWorkspace:w,selectedSessionLocalPathWorkspaceId:H,selectedSessionPendingCloudStart:A,selectedSessionProjectId:y,startMessage:Te,workspaceName:Be}}function UB({accountPending:e,accountSignedOut:t,activeWorkspaceLocation:a,bootstrap:i,busy:s,cloudLinked:u,selectedCloudProject:d,selectedProject:f,selectedSession:b,pendingWorkspaceTarget:p,workspaceStates:y,workspaceBusy:k}){const w=oi(f,i?.cloudProjects??[]),A=!!!f?.linkedSandboxProject?.projectId||!!w,H=_.useMemo(()=>{const $=(i?.localProjects??[]).map(ue=>({value:`local:${ue.id}`,label:ue.name,detail:ue.workspacePath,kind:"local"})),X=(i?.cloudProjects??[]).map(ue=>({value:`cloud:${ue.id}`,label:ue.name,detail:ue.organizationName??ue.sourceLabel??"OpenPond Cloud",kind:"cloud"})),ae=f?`local:${f.id}`:d?`cloud:${d.id}`:"none",ie=[...$,...X].find(ue=>ue.value===ae)??null;return{value:ae,label:ie?.label??"Select Project",detail:ie?.detail??"Choose a project for local or cloud work",busy:k||s,options:[...$,...X,...jB,{value:"none",label:"Don't work in a project",detail:"General chat without project files",kind:"none"}]}},[i?.cloudProjects,i?.localProjects,s,d,f,k]),W=!!(u||f),B=!!(d?.id||w?.id||b?.cloudProjectId||Gi(b)),M=f?y[f.id]??null:null,j=l$(M,{branch:f?.linkedSandboxProject?.defaultBranch??null,path:f?.workspacePath??b?.cwd??null,linkedCloudSourceKnown:f?.linkedSandboxProject?.projectId&&A?!!f.linkedSandboxProject.lastUploadedCommit||!M?.headCommit:!0}),L=c$(f,d??w,M,{cloudLinkTrusted:A}),D=u$(f,M,{cloudLinkTrusted:A}),q=_.useMemo(()=>{const $={value:"local",label:f?"Local checkout":"Local",detail:f?"Use the selected checkout on this machine.":"Use an app-managed task workspace on this machine.",stateNote:f?j:"App-managed local task workspace",disabled:!1,disabledReason:null},X={value:"hybrid",label:"Hybrid",detail:"Use your selected model with hosted sandbox edits.",stateNote:B?L:"upload required",disabled:e||t||!B,disabledReason:t?"Add an OpenPond account before using Hybrid.":"Upload/sync this Project to Cloud before using Hybrid."},ae={value:"cloud",label:"Hosted",detail:"Run with hosted compute, with or without a Project.",stateNote:f||d?L:"Projectless hosted task",disabled:e||t,disabledReason:t?"Add an OpenPond account before using Cloud.":e?"Checking OpenPond account.":null},ie={value:"upload_cloud",label:"Upload/sync to cloud",detail:"Push local source to OpenPond Git before cloud work.",stateNote:D,disabled:e||t||!f,disabledReason:t?"Add an OpenPond account before uploading source.":"Select a local Project before uploading source."},ue=a==="cloud"?"local":"cloud",ge=ue==="local"?$:ae;let Te=a==="cloud"?ae:$;return p==="cloud"?Te=ae:p==="local"?Te=$:(Gi(b)||p==="hybrid")&&(Te=X),{value:Te.value,label:Te.label,detail:Te.stateNote||Te.detail,busy:k,action:{...ge,label:ue==="cloud"?"Hosted":f?"Local checkout":"Check out locally"},uploadAction:f?ie:null,options:[$,X,ae]}},[a,e,t,u,W,L,B,j,p,f,b,D,k]);return{projectTarget:H,workspaceTarget:q}}function Da(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}function AA(e){return Da(e.name||e.gitRepo||e.id)}function hZ(e){return`@${AA(e)}`}function RA(e){return Array.from(e.matchAll(/(?:^|\s)@([A-Za-z0-9_-]+)/g)).map(t=>Da(t[1]??"")).filter(Boolean)}function LB(e,t){const a=RA(e);if(a.length===0)return!1;const i=new Set([Da(t.id),AA(t),t.gitRepo?Da(t.gitRepo):""].filter(Boolean));return a.some(s=>i.has(s))}function TA(e){return e.filter(t=>t.sandbox)}function HB(e,t){const a=RA(e);if(a.length===0)return null;const i=new Map;for(const s of a){const u=t.find(d=>{const f=Da(d.id),b=Da(d.name),p=d.gitRepo?Da(d.gitRepo):"";return s===f||s===b||s===p});u&&i.set(u.id,u)}return i.size===1?Array.from(i.values())[0]??null:null}function gZ(e,t){const a=e.slice(0,t),i=a.match(/(?:^|\s)@([A-Za-z0-9_-]*)$/);if(!i||typeof i.index!="number")return null;const s=a.slice(i.index).indexOf("@");return s<0?null:{query:Da(i[1]??""),start:i.index+s}}function $B(e){return new Set(e.map(t=>t.id))}function cx(e,t){const a=e?.linkedOpenPondApp??null;return a?.appId&&t.has(a.appId)?a:null}function qB({bootstrap:e,codexHistorySessions:t,selectedProjectId:a,selectedSessionId:i,selectedAppId:s,sessions:u}){const d=_.useMemo(()=>e?.apps.find(ie=>ie.id===s)??null,[e?.apps,s]),f=_.useMemo(()=>new Map((e?.localProjects??[]).map(ie=>[ie.id,ie])),[e?.localProjects]),b=_.useMemo(()=>new Map((e?.cloudProjects??[]).map(ie=>[ie.id,ie])),[e?.cloudProjects]),p=_.useMemo(()=>jI(a),[a]),y=_.useMemo(()=>p?.kind==="local"?f.get(p.id)??null:null,[f,p]),k=_.useMemo(()=>p?.kind==="cloud"?b.get(p.id)??null:null,[b,p]),w=_.useMemo(()=>$B(e?.apps??[]),[e?.apps]),T=_.useMemo(()=>TA(e?.apps??[]),[e?.apps]),A=_.useMemo(()=>{const ie=[];for(const ue of e?.localProjects??[]){const ge=cx(ue,w);ge&&ie.push([ge.appId,ue.id])}return new Map(ie)},[e?.localProjects,w]),H=_.useMemo(()=>new Set((e?.localProjects??[]).map(ie=>ie.id)),[e?.localProjects]),W=_.useMemo(()=>YI(e?.localProjects??[]),[e?.localProjects]),B=_.useRef([]),M=_.useMemo(()=>BB(u,t,B.current),[t,u]),j=_.useMemo(()=>M.find(ie=>ie.id===i)??null,[M,i]),L=_.useMemo(()=>{if(!j)return null;if(j.localProjectId)return f.get(j.localProjectId)??null;if(j.workspaceKind==="local_project")return j.workspaceId?f.get(j.workspaceId)??null:null;const ie=Mq(j,H,W);if(ie)return f.get(ie)??null;if(!j.appId)return null;const ue=A.get(j.appId);return ue?f.get(ue)??null:null},[A,f,H,W,j]),D=_.useMemo(()=>j?.cloudProjectId?b.get(j.cloudProjectId)??null:null,[b,j]),q=y??L,$=k??D,X=_.useMemo(()=>cx(q,w),[w,q]),ae=_.useMemo(()=>X?e?.apps.find(ie=>ie.id===X.appId)??null:null,[e?.apps,X]);return{cloudProjectById:b,currentAppIds:w,linkedProjectByAppId:A,localProjectById:f,mentionableSandboxApps:T,selectedApp:d,selectedCloudProject:$,selectedProject:q,selectedProjectLinkedApp:ae,selectedProjectLinkedOpenPondApp:X,selectedSession:j,selectedSessionLinkedProject:L,sidebarSessions:M}}function BB(e,t,a){const i=new Map;for(const p of e){const y=ux(p);i.set(y,p)}for(const p of t){const y=ux(p),k=i.get(y);i.set(y,k?VB(k,p):p)}const s=Array.from(i.entries());if(!a)return s.sort((p,y)=>dx(p[1],y[1])).map(p=>p[1]);const u=[],d=new Set;for(const p of a){const y=i.get(p);y&&(u.push([p,y]),d.add(p))}const b=[...s.filter(([p])=>!d.has(p)).sort((p,y)=>dx(p[1],y[1])),...u];return a.splice(0,a.length,...b.map(([p])=>p)),b.map(p=>p[1])}function VB(e,t){return{...e,metadata:FB(e.metadata,t.metadata),status:e.status==="active"||t.status==="active"?"active":e.status,updatedAt:KB(e.updatedAt,t.updatedAt)}}function ux(e){return e.codexThreadId?`codex:${e.codexThreadId}`:`session:${e.id}`}function dx(e,t){const a=mx(t)-mx(e);return a!==0?a:e.title.localeCompare(t.title)}function FB(e,t){const a={...e??{},...t??{}};return Object.keys(a).length>0?a:void 0}function KB(e,t){const a=Date.parse(e);if(!Number.isFinite(a))return t;const i=Date.parse(t);return Number.isFinite(i)&&i>a?t:e}function mx(e){const t=Date.parse(e.updatedAt);if(Number.isFinite(t))return t;const a=Date.parse(e.createdAt);return Number.isFinite(a)?a:0}function GB(e){return!!(e&&Ki(e.workspaceKind)&&!Gi(e)&&e.provider!=="openpond")}function ZB(e,t){const a=DI(e,t);return`${e.id}\0${a.provider}\0${a.model}`}function WB({activeWorkspaceId:e,activeWorkspaceKind:t,appDispatch:a,connection:i,expandProject:s,linkedProjectByAppId:u,providerSettings:d,selectedAppId:f,selectedSession:b,selectedSessionId:p,selectedSessionProjectId:y,setDiffPanelExpanded:k,setDraftModel:w,setDraftProvider:T,setError:A,setSelectedAppId:H,setSelectedProjectId:W,setSessions:B,setTerminalOpen:M,toast:j}){const L=_.useRef(null);_.useEffect(()=>{if(!f)return;const D=y??(p?null:u.get(f)??null);if(!D)return;const q=Dt("local",D);H(null),W(q),s(q)},[s,u,f,p,y,H,W]),_.useEffect(()=>{if(!j||j.persistent)return;const D=window.setTimeout(()=>{a({type:"clearToast",toastId:j.id})},j.durationMs??(j.tone==="error"?7e3:3500));return()=>window.clearTimeout(D)},[a,j]),_.useEffect(()=>{function D(q){(q.metaKey||q.ctrlKey)&&q.key==="`"&&(q.preventDefault(),M($=>!$))}return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[M]),_.useEffect(()=>{k(!1)},[e,t,k]),_.useEffect(()=>{if(!p){L.current=null;return}if(!b||b.id!==p)return;const D=ZB(b,d);if(L.current===D)return;L.current=D;const q=DI(b,d);T(q.provider),w(q.model)},[d,b,p,w,T]),_.useEffect(()=>{!i||!b||!GB(b)||de.patchSession(i,b.id,{provider:"openpond"}).then(D=>{B(q=>q.map($=>$.id===D.id?D:$)),T("openpond"),w(q=>Ls("openpond",q))}).catch(D=>{A(D instanceof Error?D.message:String(D))})},[i,b,w,T,A,B])}function YB({connection:e,setError:t}){return _.useCallback(async(a,i)=>{if(!e){const s=new Error("OpenPond App server is not connected.");throw t(s.message),s}t(null);try{await de.resolveApproval(e,a,{decision:i})}catch(s){const u=s instanceof Error?s.message:String(s);throw t(u),s}},[e,t])}function JB({activeProvider:e,contextCompaction:t,contextUsage:a,pinnedItems:i,pinnedPreviewKeys:s,pinnedProjects:u,projectRows:d,visibleProjectRows:f}){const b=_.useMemo(()=>$H(i,s),[i,s]),p=_.useMemo(()=>eA({provider:e,snapshot:a,preferences:t}),[e,t,a]),y=_.useMemo(()=>Array.from(new Set([...u,...f].filter(Db).map(w=>w.project.id))),[u,f]);return{commandProjectRows:_.useMemo(()=>d,[d]),contextWindowStatus:p,pinnedRows:b,sidebarWorkspaceAppIds:y}}function XB({appDispatch:e,expandProject:t,linkedProjectByAppId:a,requestComposerFocus:i,onBeginNewChat:s,setMentionedAppId:u}){return _.useCallback((d=null)=>{s?.();const f=d?.id?a.get(d.id)??null:null;if(f){const b=Dt("local",f);u(null),e({type:"selectProject",projectId:b}),t(b),i();return}u(null),e({type:"beginNewChat",appId:d?.id??null}),i()},[e,t,a,s,i,u])}const EA={slack:["slack"],microsoft_teams:["teams","microsoft-teams","microsoft_teams"],github:["github","gh"],google:["google","drive","google-drive","docs"],x:["x","twitter"],mcp:["mcp","openpond-mcp"]};function vZ(e){return`@${e.token}`}function QB(e){return`@${o8(e)}`}function e8(e){const t=new Map;for(const a of e){if(!a.connected||a.statusSource!=="integration_connection")continue;const i=t.get(a.providerFamily)??[];i.push(a),t.set(a.providerFamily,i)}return Array.from(t.entries()).map(([a,i])=>{const s=i[0],u=wc(i.flatMap(k=>k.capabilities.map(w=>w.id))),d=wc(i.flatMap(k=>k.capabilityLabels)),f=wc(i.flatMap(k=>k.connections.map(w=>w.id).filter(r8))),b=wc(i.map(k=>k.id)),p=wc(i.map(k=>k.setupSurface)),y=a8(a);return{provider:a,label:s.providerLabel,detail:d.length>0?d.slice(0,4).join(", "):s.description,token:y,tokens:n8(i),ref:{kind:"integration",provider:a,appIds:b,setupSurfaces:p,...f.length>0?{connectionIds:f}:{},...u.length>0?{capabilities:u}:{}}}})}function bZ(e,t){const a=Da(t);return e.filter(i=>a?i.tokens.some(s=>s.includes(a)):!0).slice(0,8)}function t8(e,t){const a=i8(e);if(a.length===0)return[];const i=new Map;for(const s of a){const u=t.find(d=>d.tokens.includes(s));u&&i.set(u.provider,u)}return Array.from(i.values())}function yZ(e,t){if(t.length===0)return[];const a=[];for(const i of e.matchAll(/(?:^|\s)@([A-Za-z0-9_-]+)/g)){const s=i[1]??"",u=Da(s);if(!u)continue;const d=t.find(k=>k.tokens.includes(u));if(!d)continue;const b=(i[0]??"").indexOf("@");if(b<0||typeof i.index!="number")continue;const p=i.index+b,y=`@${s}`;a.push({detail:d.detail,displayText:QB(d),end:p+y.length,label:d.label,provider:d.provider,start:p,text:y})}return a}function n8(e){return wc(e.flatMap(t=>[...EA[t.providerFamily],t.providerFamily,t.id,t.label,t.shortLabel]).map(Da).filter(Boolean))}function a8(e){return Da(EA[e][0]??e)}function o8(e){return e.provider==="github"?"GitHub":e.provider==="x"?"X":e.provider==="mcp"?"MCP":e.label}function i8(e){return Array.from(e.matchAll(/(?:^|\s)@([A-Za-z0-9_-]+)/g)).map(t=>Da(t[1]??"")).filter(Boolean)}function wc(e){return Array.from(new Set(e))}function r8(e){return typeof e=="string"&&e.length>0}function s8({bootstrap:e,connectedAppRows:t,mentionableSandboxApps:a,runtimeIndexes:i,selectedApp:s,selectedCloudProject:u,selectedProject:d,selectedSession:f,selectedSessionId:b}){const p=_.useMemo(()=>{const A=new Map;for(const H of e?.cloudProjects??[]){const W=A.get(H.teamId)??[];W.push(H.id),A.set(H.teamId,W)}return A},[e?.cloudProjects]),k=!!(f||s||d||u)?[]:a,w=_.useMemo(()=>e8(t),[t]),T=_.useMemo(()=>bA(i,b),[i,b]);return{chatMentionApps:k,cloudProjectIdsByTeam:p,connectedAppMentions:w,pendingApproval:T}}const MA="openpond.codexPermissionMode",PA="openpond.codexReasoningEffort";function Ad(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function l8(e){return e==="default"||e==="auto-review"||e==="full-access"?e:null}function c8(e){return e==="low"||e==="medium"||e==="high"||e==="xhigh"?e:null}function OA(e=Ad()){if(!e)return{};const t=l8(e.getItem(MA)),a=c8(e.getItem(PA));return{...t?{codexPermissionMode:t}:{},...a?{codexReasoningEffort:a}:{}}}function u8(e,t=Ad()){try{t?.setItem(MA,e)}catch{}}function d8(e,t=Ad()){try{t?.setItem(PA,e)}catch{}}function fx(e,t=Ad()){const a=Uo(e),i=OA(t);return{codexPermissionMode:i.codexPermissionMode??a.codexPermissionMode??If,codexReasoningEffort:i.codexReasoningEffort??a.codexReasoningEffort??Af}}function m8(e,t=Ad()){const a=Uo(e),i=OA(t),s={};return i.codexPermissionMode&&i.codexPermissionMode!==a.codexPermissionMode&&(s.codexPermissionMode=i.codexPermissionMode),i.codexReasoningEffort&&i.codexReasoningEffort!==a.codexReasoningEffort&&(s.codexReasoningEffort=i.codexReasoningEffort),s}function f8({connection:e,setBootstrap:t,setCodexPermissionMode:a,setCodexReasoningEffort:i,setError:s}){const u=_.useCallback(f=>{a(f),u8(f),e&&de.savePreferences(e,{codexPermissionMode:f}).then(()=>{t(b=>b&&{...b,preferences:{...b.preferences,codexPermissionMode:f}})}).catch(b=>{s(b instanceof Error?b.message:String(b))})},[e,t,a,s]),d=_.useCallback(f=>{i(f),d8(f),e&&de.savePreferences(e,{codexReasoningEffort:f}).then(()=>{t(b=>b&&{...b,preferences:{...b.preferences,codexReasoningEffort:f}})}).catch(b=>{s(b instanceof Error?b.message:String(b))})},[e,t,i,s]);return{changeCodexPermissionMode:u,changeCodexReasoningEffort:d}}const p8=6e4;function Fb(e,t){if(!e)return t;const a=g8(e.updatedAt,t.updatedAt)?{...t,pinned:e.pinned,savedForLater:e.savedForLater,archived:e.archived,order:e.order,status:e.status,updatedAt:e.updatedAt}:t;return NA(e,a)?e:a}function h8(e,t){const a=Fb(e,t),i=e?{...a,pinned:e.pinned,savedForLater:e.savedForLater,archived:e.archived,order:e.order,updatedAt:e.updatedAt}:a;return e&&NA(e,i)?e:i}function Fu(e,t){let a=!1,i=!1;const s=e.map(u=>{if(u.id!==t.id)return u;a=!0;const d=Fb(u,t);return d!==u&&(i=!0),d});return a?i?s:e:[t,...e]}function Ff(e,t){let a=!1,i=!1;const s=e.map(u=>{if(u.id!==t.id)return u;a=!0;const d=h8(u,t);return d!==u&&(i=!0),d});return a?i?s:e:[t,...e]}function kv(e,t,a,i=Date.now()){const s=new Map(e.map(u=>[u.id,u]));return t.map(u=>{const d=s.get(u.id);if(d&&a){const f=b8(d,u,a,i);if(f)return f}return Fb(d,u)})}function px(e,t,a,i=Date.now()){const s=new Map(e.map(p=>[p.id,p])),u=new Map(kv(e,t,a,i).map(p=>[p.id,p])),d=new Set(s.keys()),f=t.filter(p=>!d.has(p.id)).map(p=>u.get(p.id)??p),b=e.map(p=>{const y=u.get(p.id);return y||(jA(p,t)?p:null)}).filter(p=>!!p);return[...f,...b]}function jA(e,t){const a=Date.parse(e.updatedAt);if(!Number.isFinite(a))return!1;const i=v8(t);return i===null||a>=i}function hx(e,t,a,i=Date.now()){const s=new Map(t.map(u=>[u.id,u]));for(const u of a){const d=s.get(u.id);d&&(zA(d,u)||(e[u.id]=i))}}function g8(e,t){const a=Date.parse(e),i=Date.parse(t);return Number.isFinite(a)&&Number.isFinite(i)&&a>i}function NA(e,t){return JSON.stringify(e)===JSON.stringify(t)}function v8(e){let t=null;for(const a of e){const i=Date.parse(a.updatedAt);Number.isFinite(i)&&(t=t===null?i:Math.max(t,i))}return t}function b8(e,t,a,i){const s=a[t.id];return s===void 0?null:i-s>p8||zA(e,t)?(delete a[t.id],null):{...t,pinned:e.pinned,savedForLater:e.savedForLater,archived:e.archived,order:e.order}}function zA(e,t){return e.pinned===t.pinned&&e.savedForLater===t.savedForLater&&e.archived===t.archived&&e.order===t.order}const DA=800,y8=5e3,gx=5e4,S8=16,_8=3e4,yo=new Map;function x8(e,t){return yo.get(LA(e,t))?.payload??null}async function UA(e,t,a={}){const i=LA(e,t),s=yo.get(i),u=a.limit??DA,d=a.tail??!0;if(s?.promise)return s.promise;if(!a.force&&d&&s?.payload&&Date.now()-s.fetchedAt<=_8)return vx(i,s),s.payload;const f=!!(a.force&&d&&s?.payload),b=f?s?.payload?.events.at(-1)?.id:void 0,p=de.codexHistoryThreadIncremental(e,t,{afterEventId:b,limit:u,revision:f?s?.revision:void 0,tail:d}).then(y=>{const k=yo.get(i)?.payload??s?.payload;if(y.unchanged){if(!k)throw new Error("Codex history revision matched without a cached thread.");return yo.set(i,{fetchedAt:Date.now(),payload:k,revision:y.revision}),vx(i,yo.get(i)),k}const w={session:y.session,events:y.events},T=d&&k&&!y.reset?{...w,events:k8(k.events,w.events)}:w;return yo.set(i,{fetchedAt:Date.now(),payload:T,revision:y.revision}),bx(),T}).catch(y=>{throw yo.get(i)?.promise===p&&yo.delete(i),y});return yo.set(i,{fetchedAt:s?.fetchedAt??0,payload:s?.payload,promise:p,revision:s?.revision}),bx(),p}function LA(e,t){return`${e.serverUrl}
|
|
138
|
+
`)))}catch{}}async function X5(e,t){e<=0||t.aborted||await new Promise(a=>{const i=globalThis.setTimeout(a,e);t.addEventListener("abort",()=>{globalThis.clearTimeout(i),a()},{once:!0})})}function R_(e={}){const t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),t}async function ne(e,t,a){const i=new Headers(a?.headers);i.set("Content-Type","application/json"),i.set("Authorization",`Bearer ${e.token}`);const s=await fetch(`${e.serverUrl}${t}`,{...a,headers:i});if(!s.ok){const u=await s.json().catch(()=>({})),d=u&&typeof u=="object"&&"error"in u?String(u.error):s.statusText;throw new Error(d)}return await s.json()}function DG(e){const t=new URL("/v1/terminal",e.serverUrl);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.toString()}function UG(e){return["openpond-terminal",`openpond-token.${e6(e.token)}`]}function Q5(e){const t=new TextEncoder().encode(e);let a="";for(let i=0;i<t.length;i+=32768){const s=t.subarray(i,i+32768);a+=String.fromCharCode(...s)}return btoa(a)}function e6(e){return Q5(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function t6(e){const t=atob(e),a=new Uint8Array(t.length);for(let i=0;i<t.length;i+=1)a[i]=t.charCodeAt(i);return new TextDecoder().decode(a)}const n6={teamInvitations:e=>ne(e,"/v1/team-invitations"),decideTeamInvitation:(e,t,a)=>ne(e,`/v1/team-invitations/${t}`,{method:"POST",body:JSON.stringify({token:a})}),organizations:e=>ne(e,"/v1/organizations"),createOrganization:(e,t)=>ne(e,"/v1/organizations",{method:"POST",body:JSON.stringify(t)}),updateOrganization:(e,t,a)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(a)}),organizationMembers:(e,t)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}/members`),upsertOrganizationMember:(e,t,a)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}/members`,{method:"POST",body:JSON.stringify(a)}),organizationMcpServer:(e,t)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}/mcp-server`),generateOrganizationMcpServer:(e,t,a)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}/mcp-server`,{method:"POST",body:JSON.stringify(a)}),setOrganizationMcpServerStatus:(e,t,a)=>ne(e,`/v1/organizations/${encodeURIComponent(t)}/mcp-server/${a}`,{method:"POST"})},a6={sendTurn:(e,t,a)=>ne(e,`/v1/sessions/${t}/turns`,{method:"POST",body:JSON.stringify(a)}),runSessionCommand:(e,t,a)=>ne(e,`/v1/sessions/${encodeURIComponent(t)}/commands`,{method:"POST",body:JSON.stringify(a)}),recordPreflightTurnFailure:(e,t,a)=>ne(e,`/v1/sessions/${t}/preflight-turns/failure`,{method:"POST",body:JSON.stringify(a)}),listCreateImproveRuns:(e,t={})=>ne(e,`/v1/create-improve-runs?${o6(t).toString()}`),getCreateImproveRun:(e,t)=>ne(e,`/v1/create-improve-runs/${encodeURIComponent(t)}`),getCreateImproveCandidateDiff:(e,t,a)=>ne(e,`/v1/create-improve-runs/${encodeURIComponent(t)}/candidates/${encodeURIComponent(a)}/diff`),applyCreateImproveAction:(e,t,a)=>ne(e,`/v1/create-improve-runs/${encodeURIComponent(t)}/actions`,{method:"POST",body:JSON.stringify(a)}),interruptTurn:(e,t)=>ne(e,`/v1/sessions/${t}/turns/interrupt`,{method:"POST"}),compactSession:(e,t,a={reason:"manual"})=>ne(e,`/v1/sessions/${t}/compact`,{method:"POST",body:JSON.stringify(a)}),workspaceTool:(e,t,a)=>ne(e,`/v1/sessions/${t}/workspace-tools`,{method:"POST",body:JSON.stringify(a)}),ensureCloudWorkspaceReady:(e,t,a)=>ne(e,`/v1/sessions/${encodeURIComponent(t)}/workspace/ensure-ready`,{method:"POST",body:JSON.stringify(a)})};function o6(e){const t=new URLSearchParams;return e.profileId&&t.set("profileId",e.profileId),e.conversationId&&t.set("conversationId",e.conversationId),e.targetKind&&t.set("targetKind",e.targetKind),e.targetId&&t.set("targetId",e.targetId),e.limit&&t.set("limit",String(e.limit)),t}const i6={sandboxFiles:(e,t,a={})=>{const i=new URLSearchParams({list:"1"});return a.path&&i.set("path",a.path),a.recursive!==void 0&&i.set("recursive",String(a.recursive)),a.maxEntries!==void 0&&i.set("maxEntries",String(a.maxEntries)),ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/files?${i.toString()}`)},sandboxUploadFile:(e,t,a)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/files`,{method:"POST",body:JSON.stringify(a)}),preserveSandboxSource:(e,t,a={})=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/preserve-source`,{method:"POST",body:JSON.stringify(a)}),sandboxDownloadFile:async(e,t,a,i={})=>{const s=new URLSearchParams({path:a});i.offsetBytes!==void 0&&s.set("offsetBytes",String(i.offsetBytes)),i.maxBytes!==void 0&&s.set("maxBytes",String(i.maxBytes));const u=await ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/files?${s.toString()}`);return{...u,contents:u.file.isBinary?"":t6(u.file.contentsBase64)}}},r6={sandboxGitStatus:(e,t)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/git/status`),sandboxGitDiff:(e,t,a)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/git/diff`,{method:"POST",body:JSON.stringify(a)})},s6={connectedAppStatus:(e,t={})=>{const a=R_(t);return a.set("status",t.status??"all"),ne(e,`/v1/connected-apps/status${a.size>0?`?${a.toString()}`:""}`)},integrationConnections:(e,t={})=>{const a=R_(t);return t.status&&a.set("status",t.status),ne(e,`/v1/integrations/connections${a.size>0?`?${a.toString()}`:""}`)},sandboxIntegrationLeases:(e,t)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/integrations`),attachSandboxIntegrationConnection:(e,t,a)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/integrations`,{method:"POST",body:JSON.stringify(a)}),removeSandboxIntegrationLease:(e,t,a)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}/integrations`,{method:"DELETE",body:JSON.stringify({leaseId:a})})},l6={listSandboxProjects:(e,t)=>{const a=new URLSearchParams({teamId:t.teamId});return ne(e,`/v1/sandbox-projects?${a.toString()}`)},upsertSandboxProject:(e,t)=>ne(e,"/v1/sandbox-projects",{method:"POST",body:JSON.stringify(t)}),syncSandboxProject:(e,t,a)=>{const i=new URLSearchParams({teamId:a.teamId});return ne(e,`/v1/sandbox-projects/${encodeURIComponent(t)}/sync?${i.toString()}`,{method:"POST"})},uploadSandboxProjectSource:(e,t,a)=>{const i=new URLSearchParams({teamId:a.teamId}),{teamId:s,...u}=a;return ne(e,`/v1/sandbox-projects/${encodeURIComponent(t)}/source?${i.toString()}`,{method:"POST",body:JSON.stringify(u)})},archiveSandboxProject:(e,t,a)=>{const i=new URLSearchParams({teamId:a.teamId});return ne(e,`/v1/sandbox-projects/${encodeURIComponent(t)}?${i.toString()}`,{method:"DELETE"})},listSandboxAgents:(e,t)=>{const a=new URLSearchParams({teamId:t.teamId});return ne(e,`/v1/sandbox-agents?${a.toString()}`)},upsertSandboxAgent:(e,t)=>ne(e,"/v1/sandbox-agents",{method:"POST",body:JSON.stringify(t)}),runSandboxAgent:(e,t,a)=>ne(e,`/v1/sandbox-agents/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(a)}),runProfileAction:(e,t)=>ne(e,"/v1/profile/run",{method:"POST",body:JSON.stringify(t)})},c6={sandbox:(e,t)=>ne(e,`/v1/sandboxes/${encodeURIComponent(t)}`)},u6={...s6,...l6,...c6,...r6,...i6},d6={communities:(e,t)=>{const a=new URLSearchParams;return t&&a.set("cursor",t),ne(e,`/v1/communities${a.size?`?${a}`:""}`)},communityPreview:(e,t)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/preview`),communityRules:(e,t)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/rules/current`),joinCommunity:(e,t,a)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/join`,{method:"POST",body:JSON.stringify({acceptedRulesVersionId:a})}),acceptCommunityRules:(e,t,a)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/rules/accept`,{method:"POST",body:JSON.stringify({acceptedRulesVersionId:a})}),leaveCommunity:(e,t)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/leave`,{method:"POST",body:"{}"}),communityChannels:(e,t)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels`),communityMessages:(e,t,a,i={})=>{const s=new URLSearchParams;return i.beforeSequence!=null&&s.set("beforeSequence",String(i.beforeSequence)),i.limit!=null&&s.set("limit",String(i.limit)),ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/messages${s.size?`?${s}`:""}`)},sendCommunityMessage:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/messages`,{method:"POST",body:JSON.stringify(i)}),editCommunityMessage:(e,t,a,i,s)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/messages/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify({body:s})}),deleteCommunityMessage:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/messages/${encodeURIComponent(i)}`,{method:"DELETE",body:"{}"}),markCommunityRead:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/read`,{method:"POST",body:JSON.stringify({sequence:i})}),setCommunityChannelMuted:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/mute`,{method:"POST",body:JSON.stringify({muted:i})}),searchCommunityMembers:(e,t,a={})=>{const i=new URLSearchParams;return a.query&&i.set("query",a.query),a.cursor&&i.set("cursor",a.cursor),a.limit!=null&&i.set("limit",String(a.limit)),ne(e,`/v1/communities/${encodeURIComponent(t)}/members/search${i.size?`?${i}`:""}`)},updateCommunityNotifications:(e,t,a)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/notifications`,{method:"POST",body:JSON.stringify({mode:a})}),communityEvents:(e,t,a={})=>{const i=new URLSearchParams;return a.after!=null&&i.set("after",String(a.after)),a.limit!=null&&i.set("limit",String(a.limit)),ne(e,`/v1/communities/${encodeURIComponent(t)}/events${i.size?`?${i}`:""}`)},communityRealtimeSession:(e,t)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/realtime-session`),uploadCommunityAttachment:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/attachments/upload`,{method:"POST",body:JSON.stringify({attachment:i})}),communityAttachmentDownload:(e,t,a,i)=>ne(e,`/v1/communities/${encodeURIComponent(t)}/channels/${encodeURIComponent(a)}/attachments/${encodeURIComponent(i)}/download`)},Ob="openpond-app-server-url",od="openpond-app-token",m6=750;function xI(){return window.location.protocol!=="http:"&&window.location.protocol!=="https:"?null:window.location.origin&&window.location.origin!=="null"?window.location.origin:null}function fv(e){const t=e.getItem(Ob)?.trim(),a=e.getItem(od)?.trim();return t&&a?{serverUrl:t,token:a}:null}function lf(e){if(!e)return null;try{const t="__openpond_storage_probe__";return e.setItem(t,"1"),e.removeItem(t),e}catch{return null}}function bc(e,t){e.setItem(Ob,t.serverUrl),e.setItem(od,t.token)}function T_(e,t){const a=fv(e);a?.serverUrl!==t.serverUrl||a.token!==t.token||(e.removeItem(Ob),e.removeItem(od))}function f6(){const e=window.__OPENPOND_WEB_CONNECTION__,t=e?.serverUrl?.trim(),a=e?.token?.trim();return t&&a?{serverUrl:t,token:a}:null}function p6(){const e=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash;if(!e)return null;const t=new URLSearchParams(e),a=t.get("openpondToken")?.trim(),i=t.get("openpondServerUrl")?.trim()||xI();return!i||!a?null:{serverUrl:i,token:a}}function h6(){window.location.hash&&window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}`)}function Mm(e,t){t&&(e.some(a=>a.serverUrl===t.serverUrl&&a.token===t.token)||e.push(t))}function g6(){const e=[],t=lf(window.sessionStorage),a=lf(window.localStorage),i=xI(),s=t?.getItem(od)??a?.getItem(od);return Mm(e,null),Mm(e,i&&s?{serverUrl:i,token:s.trim()}:null),Mm(e,t?fv(t):null),Mm(e,a?fv(a):null),e}async function gg(e){const t=new AbortController,a=window.setTimeout(()=>t.abort(),m6);try{const i=await fetch(`${e}/health`,{signal:t.signal}),s=await i.json().catch(()=>null);return i.ok&&s?.server==="openpond-app-server"}catch{return!1}finally{window.clearTimeout(a)}}async function v6(){if(window.openpond)return window.openpond.getConnection();const e=lf(window.sessionStorage),t=lf(window.localStorage),a=p6();if(a&&await gg(a.serverUrl))return t&&bc(t,a),e&&bc(e,a),h6(),{...a,platform:navigator.platform};const i=f6();if(i&&await gg(i.serverUrl))return t&&bc(t,i),e&&bc(e,i),{...i,platform:navigator.platform};const s=g6();for(const u of s){if(await gg(u.serverUrl))return t&&bc(t,u),e&&bc(e,u),{...u,platform:navigator.platform};e&&T_(e,u),t&&T_(t,u)}throw new Error("No reachable OpenPond app server. Start `openpond ui` again and open the full printed URL.")}const de={...d6,bootstrap:e=>ne(e,"/v1/bootstrap?refreshCodex=1"),extensionCatalog:e=>ne(e,"/v1/extensions"),extensionPreview:(e,t)=>ne(e,"/v1/extensions/preview",{method:"POST",body:JSON.stringify(t)}),extensionAdd:(e,t)=>ne(e,"/v1/extensions",{method:"POST",body:JSON.stringify(t)}),extensionUpdate:(e,t,a={})=>ne(e,`/v1/extensions/github/${encodeURIComponent(t.owner)}/${encodeURIComponent(t.repo)}/update`,{method:"POST",body:JSON.stringify(a)}),extensionUpdateAll:e=>ne(e,"/v1/extensions/update-all",{method:"POST"}),extensionRemove:(e,t)=>ne(e,`/v1/extensions/github/${encodeURIComponent(t.owner)}/${encodeURIComponent(t.repo)}`,{method:"DELETE"}),skillSourceFile:(e,t,a,i)=>ne(e,`/v1/skills/${t}/${encodeURIComponent(a)}/source?path=${encodeURIComponent(i)}`),teamChatMembers:(e,t)=>ne(e,`/v1/team-chat/members?teamId=${encodeURIComponent(t)}`),teamChatAgents:(e,t)=>ne(e,`/v1/team-chat/agents?teamId=${encodeURIComponent(t)}`),teamChatThreads:(e,t)=>ne(e,`/v1/team-chat/threads?teamId=${encodeURIComponent(t)}`),teamChatRealtimeSession:(e,t)=>ne(e,`/v1/team-chat/realtime-session?teamId=${encodeURIComponent(t)}`),teamChatEvents:(e,t,a={})=>{const i=new URLSearchParams({teamId:t});return a.after!=null&&i.set("after",String(a.after)),a.limit!=null&&i.set("limit",String(a.limit)),ne(e,`/v1/team-chat/events?${i.toString()}`)},teamChatGeneral:(e,t)=>ne(e,"/v1/team-chat/threads/general",{method:"POST",body:JSON.stringify({teamId:t})}),teamChatDm:(e,t,a)=>ne(e,"/v1/team-chat/threads/dm",{method:"POST",body:JSON.stringify({teamId:t,otherUserId:a})}),teamChatThread:(e,t,a,i={})=>{const s=new URLSearchParams({teamId:t});return i.beforeSequence!=null&&s.set("beforeSequence",String(i.beforeSequence)),i.limit!=null&&s.set("limit",String(i.limit)),ne(e,`/v1/team-chat/threads/${encodeURIComponent(a)}?${s.toString()}`)},uploadTeamChatAttachment:(e,t,a)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/attachments/upload`,{method:"POST",body:JSON.stringify(a)}),teamChatAttachmentDownload:(e,t,a)=>ne(e,`/v1/team-chat/attachments/${encodeURIComponent(a)}/download?teamId=${encodeURIComponent(t)}`),sendTeamChatMessage:(e,t,a)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/messages`,{method:"POST",body:JSON.stringify(a)}),createTeamChatAgentRun:(e,t,a)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/agent-runs`,{method:"POST",body:JSON.stringify(a)}),teamChatAgentConversation:(e,t,a)=>ne(e,`/v1/team-chat/agent-runs/${encodeURIComponent(a)}?teamId=${encodeURIComponent(t)}`),editTeamChatMessage:(e,t,a,i)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/messages/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(i)}),deleteTeamChatMessage:(e,t,a,i)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/messages/${encodeURIComponent(a)}`,{method:"DELETE",body:JSON.stringify({teamId:i})}),markTeamChatRead:(e,t,a,i)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/read`,{method:"POST",body:JSON.stringify({teamId:a,sequence:i})}),setTeamChatThreadMuted:(e,t,a,i)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/mute`,{method:"POST",body:JSON.stringify({teamId:a,muted:i})}),createTeamChatAiThread:(e,t,a)=>ne(e,`/v1/team-chat/threads/${encodeURIComponent(t)}/ai-threads`,{method:"POST",body:JSON.stringify(a)}),teamChatAiThread:(e,t,a)=>ne(e,`/v1/team-chat/ai-threads/${encodeURIComponent(a)}?teamId=${encodeURIComponent(t)}`),sendTeamChatAiTurn:(e,t,a)=>ne(e,`/v1/team-chat/ai-threads/${encodeURIComponent(t)}/turns`,{method:"POST",body:JSON.stringify(a)}),executeTeamChatAiTurn:(e,t,a)=>ne(e,`/v1/team-chat/ai-turns/${encodeURIComponent(t)}/execute`,{method:"POST",body:JSON.stringify({teamId:a})}),cancelTeamChatAiTurnExecution:(e,t,a)=>ne(e,`/v1/team-chat/ai-turns/${encodeURIComponent(t)}/execute/cancel`,{method:"POST",body:JSON.stringify({teamId:a})}),usage:(e,t={})=>{const a=E_(t),i=a.size?`?${a.toString()}`:"";return ne(e,`/v1/usage${i}`)},usageRecords:(e,t={})=>{const a=E_(t);t.sessionId&&a.set("sessionId",t.sessionId),t.turnId&&a.set("turnId",t.turnId),t.limit!==void 0&&a.set("limit",String(t.limit));const i=a.size?`?${a.toString()}`:"";return ne(e,`/v1/usage/records${i}`)},runtimeEventsPage:(e,t={})=>{const a=new URLSearchParams;t.sessionId&&a.set("sessionId",t.sessionId),t.afterSequence!==void 0&&a.set("afterSequence",String(t.afterSequence)),t.beforeSequence!==void 0&&t.beforeSequence!==null&&a.set("beforeSequence",String(t.beforeSequence)),t.limit!==void 0&&a.set("limit",String(t.limit));const i=a.size?`?${a.toString()}`:"";return ne(e,`/v1/events/page${i}`)},workOutputs:e=>ne(e,"/v1/work/outputs"),harnessHistory:e=>ne(e,"/v1/harness"),updateHarnessBackgroundReview:(e,t)=>ne(e,"/v1/harness/background-review",{method:"POST",body:JSON.stringify(t)}),reviewHarnessEvaluation:(e,t)=>ne(e,"/v1/harness/evaluation-review",{method:"POST",body:JSON.stringify(t)}),updateHarnessEvaluationReviewSchedule:(e,t)=>ne(e,"/v1/harness/evaluation-review/settings",{method:"POST",body:JSON.stringify(t)}),harnessReleaseDiff:(e,t)=>ne(e,"/v1/harness/diff",{method:"POST",body:JSON.stringify(t)}),rollbackHarness:(e,t)=>ne(e,"/v1/harness/rollback",{method:"POST",body:JSON.stringify(t)}),reviewHarnessProposal:(e,t)=>ne(e,"/v1/harness/review",{method:"POST",body:JSON.stringify(t)}),runSubagentLifecycleAction:(e,t,a)=>ne(e,`/v1/subagents/${encodeURIComponent(t)}/lifecycle`,{method:"POST",body:JSON.stringify(a)}),trainingState:(e,t)=>ne(e,`/v1/training?profileId=${encodeURIComponent(t)}`),trainingActivity:(e,t)=>ne(e,`/v1/training/activity?profileId=${encodeURIComponent(t)}`),portableTrainingCatalog:(e,t="",a)=>{const i=new URLSearchParams;return t.trim()&&i.set("query",t.trim()),a&&i.set("method",a),ne(e,`/v1/training/catalog${i.size?`?${i.toString()}`:""}`)},datasetCatalog:(e,t)=>ne(e,`/v1/training/datasets?profileId=${encodeURIComponent(t)}`),trainingRunDetail:(e,t)=>ne(e,`/v1/training/jobs/${encodeURIComponent(t)}/detail`),trainingRequest:(e,t,a,i="POST")=>ne(e,`/v1/training${t}`,{method:i,body:i==="GET"||i==="DELETE"?void 0:JSON.stringify(a)}),datasetStorageState:e=>ne(e,"/v1/settings/dataset-storage"),updateDatasetStorage:(e,t)=>ne(e,"/v1/settings/dataset-storage",{method:"PATCH",body:JSON.stringify({datasetStorePath:t})}),hostedSavedWork:e=>ne(e,"/v1/saved-work"),createHostedSavedWork:(e,t)=>ne(e,"/v1/saved-work",{method:"POST",body:JSON.stringify(t)}),updateHostedSavedWork:(e,t,a)=>ne(e,`/v1/saved-work/schedules/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(a)}),deleteHostedSavedWork:(e,t)=>ne(e,`/v1/saved-work/schedules/${encodeURIComponent(t)}`,{method:"DELETE"}),runHostedSavedWork:(e,t,a)=>ne(e,`/v1/saved-work/schedules/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify({clientRequestId:a})}),localAgentSchedules:(e,t={})=>{const a=new URLSearchParams;t.localProjectId&&a.set("localProjectId",t.localProjectId);const i=a.size?`?${a.toString()}`:"";return ne(e,`/v1/local-agent-schedules${i}`)},syncLocalAgentSchedules:e=>ne(e,"/v1/local-agent-schedules/sync",{method:"POST",body:JSON.stringify({})}),patchLocalAgentSchedule:(e,t,a)=>ne(e,`/v1/local-agent-schedules/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(a)}),runLocalAgentSchedule:(e,t,a={})=>ne(e,`/v1/local-agent-schedules/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(a)}),localAgentScheduleRuns:(e,t,a={})=>{const i=new URLSearchParams;a.limit!==void 0&&i.set("limit",String(a.limit));const s=i.size?`?${i.toString()}`:"";return ne(e,`/v1/local-agent-schedules/${encodeURIComponent(t)}/runs${s}`)},refreshOpenPondAccounts:e=>ne(e,"/v1/openpond/accounts/refresh",{method:"POST",body:JSON.stringify({})}),refreshOpenPondAccount:e=>ne(e,"/v1/openpond/account?refresh=1"),loadMoreOpenPondApps:(e,t)=>ne(e,`/v1/openpond/apps/more?offset=${encodeURIComponent(String(t.offset))}&limit=${encodeURIComponent(String(t.limit))}`),switchOpenPondAccount:(e,t)=>ne(e,"/v1/openpond/accounts/switch",{method:"POST",body:JSON.stringify(t)}),removeOpenPondAccount:(e,t)=>ne(e,"/v1/openpond/accounts",{method:"DELETE",body:JSON.stringify(t)}),saveOpenPondAccount:(e,t)=>ne(e,"/v1/openpond/accounts/login",{method:"POST",body:JSON.stringify(t)}),updateOpenPondAccountConfig:(e,t)=>ne(e,"/v1/openpond/accounts/config",{method:"PATCH",body:JSON.stringify(t)}),savePreferences:(e,t)=>ne(e,"/v1/preferences",{method:"PATCH",body:JSON.stringify(t)}),saveProviderSettings:(e,t)=>ne(e,"/v1/providers",{method:"PATCH",body:JSON.stringify(t)}),providerSettings:e=>ne(e,"/v1/providers"),loadProviderModels:(e,t,a={})=>{const i=new URLSearchParams;a.query?.trim()&&i.set("query",a.query.trim()),a.limit&&i.set("limit",String(a.limit));const s=i.size?`?${i.toString()}`:"";return ne(e,`/v1/providers/${encodeURIComponent(t)}/models${s}`)},refreshProviderModels:(e,t,a)=>ne(e,`/v1/providers/${encodeURIComponent(t)}/models`,{method:"POST",body:JSON.stringify(a)}),saveProviderCredential:(e,t,a)=>ne(e,`/v1/providers/${encodeURIComponent(t)}/credential`,{method:"PUT",body:JSON.stringify(a)}),deleteProviderCredential:(e,t,a)=>ne(e,`/v1/providers/${encodeURIComponent(t)}/credential`,{method:"DELETE",body:JSON.stringify(a)}),startOpenAiSubscriptionAuth:(e,t)=>ne(e,"/v1/providers/openai/subscription-auth",{method:"POST",body:JSON.stringify(t)}),validateProviderCredential:(e,t,a)=>ne(e,`/v1/providers/${encodeURIComponent(t)}/validate`,{method:"POST",body:JSON.stringify(a)}),savePersonalization:(e,t)=>ne(e,"/v1/personalization",{method:"PATCH",body:JSON.stringify(t)}),recordClientDiagnostic:(e,t)=>ne(e,"/v1/diagnostics/client",{method:"POST",body:JSON.stringify(t)}),profileCurrent:e=>ne(e,"/v1/profile"),profileCatalog:e=>ne(e,"/v1/profile/catalog"),profileSelect:(e,t)=>ne(e,"/v1/profile/select",{method:"POST",body:JSON.stringify({ref:t})}),profileRemove:(e,t)=>ne(e,"/v1/profile/remove",{method:"POST",body:JSON.stringify({ref:t})}),profilePublicationPreview:(e,t)=>ne(e,"/v1/profile/publication/preview",{method:"POST",body:JSON.stringify(t)}),profilePublicationPublish:(e,t)=>ne(e,"/v1/profile/publication/publish",{method:"POST",body:JSON.stringify(t)}),profileInstall:(e,t)=>ne(e,"/v1/profile/install",{method:"POST",body:JSON.stringify(t)}),profileUpdate:(e,t)=>ne(e,"/v1/profile/update",{method:"POST",body:JSON.stringify({ref:t})}),profileInit:(e,t)=>ne(e,"/v1/profile/init",{method:"POST",body:JSON.stringify(t)}),profileLoad:(e,t)=>ne(e,"/v1/profile/load",{method:"POST",body:JSON.stringify(t)}),profileCheck:(e,t)=>ne(e,"/v1/profile/check",{method:"POST",body:JSON.stringify(t)}),profileAgentRename:(e,t,a)=>ne(e,`/v1/profile/agents/${encodeURIComponent(t)}/name`,{method:"PATCH",body:JSON.stringify(a)}),profileCommit:(e,t)=>ne(e,"/v1/profile/commit",{method:"POST",body:JSON.stringify(t)}),profilePush:(e,t)=>ne(e,"/v1/profile/push",{method:"POST",body:JSON.stringify(t)}),workspaceLspSettingsStatus:e=>ne(e,"/v1/lsp/settings-status"),workspaceLspRuntimeStatus:e=>ne(e,"/v1/lsp/status"),restartWorkspaceLsp:e=>ne(e,"/v1/lsp/restart",{method:"POST"}),remoteAccess:e=>ne(e,"/v1/remote-access"),enableRemoteAccess:e=>ne(e,"/v1/remote-access/enable",{method:"POST"}),disableRemoteAccess:e=>ne(e,"/v1/remote-access/disable",{method:"POST"}),voiceTranscriptionStatus:e=>ne(e,"/v1/audio/transcriptions/status"),transcribeVoice:(e,t)=>ne(e,"/v1/audio/transcriptions",{method:"POST",body:JSON.stringify(t)}),createSession:(e,t)=>ne(e,"/v1/sessions",{method:"POST",body:JSON.stringify(t)}),patchSession:(e,t,a)=>ne(e,`/v1/sessions/${t}`,{method:"PATCH",body:JSON.stringify(a)}),codexHistoryThread:(e,t,a={})=>{const i=new URLSearchParams;a.limit!==void 0&&i.set("limit",String(a.limit)),a.tail&&i.set("tail","1");const s=i.size?`?${i.toString()}`:"";return ne(e,`/v1/codex-history/${encodeURIComponent(t)}${s}`)},codexHistoryThreadIncremental:(e,t,a={})=>{const i=new URLSearchParams({incremental:"1"});return a.afterEventId&&i.set("afterEventId",a.afterEventId),a.limit!==void 0&&i.set("limit",String(a.limit)),a.revision&&i.set("revision",a.revision),a.tail&&i.set("tail","1"),ne(e,`/v1/codex-history/${encodeURIComponent(t)}?${i.toString()}`)},sendCodexHistoryTurn:(e,t,a)=>ne(e,`/v1/codex-history/${encodeURIComponent(t)}/turns`,{method:"POST",body:JSON.stringify(a)}),interruptCodexHistoryTurn:(e,t)=>ne(e,`/v1/codex-history/${encodeURIComponent(t)}/turns/interrupt`,{method:"POST"}),patchSidebarAppPreference:(e,t,a)=>ne(e,`/v1/sidebar/apps/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(a)}),reorderSidebarApps:(e,t)=>ne(e,"/v1/sidebar/apps/reorder",{method:"POST",body:JSON.stringify(t)}),sidebarFiles:e=>ne(e,"/v1/sidebar/files"),patchSidebarFile:(e,t)=>ne(e,"/v1/sidebar/files",{method:"PATCH",body:JSON.stringify(t)}),workspaceStatus:(e,t,a=!1,i={})=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}${a?"?ensure=1":""}`,{signal:i.signal}),createWorkspaceBranch:(e,t,a)=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/branches`,{method:"POST",body:JSON.stringify(a)}),checkoutWorkspaceBranch:(e,t,a)=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/branch`,{method:"PATCH",body:JSON.stringify(a)}),workspaceDiff:(e,t,a={})=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/diff`,{signal:a.signal}),workspaceFile:(e,t,a)=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/file?path=${encodeURIComponent(a)}`),saveWorkspaceFile:(e,t,a)=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/file`,{method:"PATCH",body:JSON.stringify(a)}),signWorkspaceImageUrl:(e,t)=>ne(e,"/v1/assets/workspace-image-url",{method:"POST",body:JSON.stringify(t)}),signLocalImageUrl:(e,t)=>ne(e,"/v1/assets/local-image-url",{method:"POST",body:JSON.stringify(t)}),signLocalVideoUrl:(e,t)=>ne(e,"/v1/assets/local-video-url",{method:"POST",body:JSON.stringify(t)}),signChatAttachmentImageUrl:(e,t)=>ne(e,"/v1/assets/chat-attachment-image-url",{method:"POST",body:JSON.stringify(t)}),chatAttachmentFile:(e,t)=>ne(e,"/v1/assets/chat-attachment-file",{method:"POST",body:JSON.stringify(t)}),workspaceLspTouch:(e,t,a,i={})=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/lsp/touch`,{method:"POST",body:JSON.stringify(a),signal:i.signal}),workspaceLspAction:(e,t,a)=>ne(e,`/v1/workspaces/${encodeURIComponent(t)}/lsp/action`,{method:"POST",body:JSON.stringify(a)}),workspaceTemplateConfig:(e,t)=>ne(e,`/v1/openpond/apps/${encodeURIComponent(t)}/template-config`),...n6,...u6,createLocalProject:(e,t)=>ne(e,"/v1/projects",{method:"POST",body:JSON.stringify(t)}),updateLocalProjectAgentSetup:(e,t,a)=>ne(e,`/v1/projects/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(a)}),uploadLocalProjectCloudSource:(e,t,a)=>ne(e,`/v1/projects/${encodeURIComponent(t)}/cloud-source`,{method:"POST",body:JSON.stringify(a)}),previewLocalProjectCloudSource:(e,t,a={})=>{const i=new URLSearchParams;a.branch?.trim()&&i.set("branch",a.branch.trim());const s=i.toString()?`?${i.toString()}`:"";return ne(e,`/v1/projects/${encodeURIComponent(t)}/cloud-source/preview${s}`)},deleteLocalProject:(e,t)=>ne(e,`/v1/projects/${encodeURIComponent(t)}`,{method:"DELETE"}),gitAvailability:e=>ne(e,"/v1/system/git"),installMacOSCommandLineTools:e=>ne(e,"/v1/system/git/install-command-line-tools",{method:"POST",body:JSON.stringify({})}),...a6,resolveApproval:(e,t,a)=>ne(e,`/v1/approvals/${t}`,{method:"POST",body:JSON.stringify(a)})};function E_(e){const t=new URLSearchParams;return e.range&&t.set("range",e.range),e.visibility&&t.set("visibility",e.visibility),e.status&&t.set("status",e.status),e.provider&&t.set("provider",e.provider),e.model&&t.set("model",e.model),t}const b6="modulepreload",y6=function(e,t){return new URL(e,t).href},M_={},Al=function(t,a,i){let s=Promise.resolve();if(a&&a.length>0){let p=function(y){return Promise.all(y.map(k=>Promise.resolve(k).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};const d=document.getElementsByTagName("link"),f=document.querySelector("meta[property=csp-nonce]"),b=f?.nonce||f?.getAttribute("nonce");s=p(a.map(y=>{if(y=y6(y,i),y in M_)return;M_[y]=!0;const k=y.endsWith(".css"),w=k?'[rel="stylesheet"]':"";if(i)for(let A=d.length-1;A>=0;A--){const H=d[A];if(H.href===y&&(!k||H.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${w}`))return;const T=document.createElement("link");if(T.rel=k?"stylesheet":b6,k||(T.as="script"),T.crossOrigin="",T.href=y,b&&T.setAttribute("nonce",b),document.head.appendChild(T),k)return new Promise((A,H)=>{T.addEventListener("load",A),T.addEventListener("error",()=>H(new Error(`Unable to preload CSS for ${y}`)))})}))}function u(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return s.then(d=>{for(const f of d||[])f.status==="rejected"&&u(f.reason);return t().catch(u)})};const S6=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_6=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,i)=>i?i.toUpperCase():a.toLowerCase()),P_=e=>{const t=_6(e);return t.charAt(0).toUpperCase()+t.slice(1)},kI=(...e)=>e.filter((t,a,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===a).join(" ").trim(),x6=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var k6={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const w6=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:i,className:s="",children:u,iconNode:d,...f},b)=>_.createElement("svg",{ref:b,...k6,width:t,height:t,stroke:e,strokeWidth:i?Number(a)*24/Number(t):a,className:kI("lucide",s),...!u&&!x6(f)&&{"aria-hidden":"true"},...f},[...d.map(([p,y])=>_.createElement(p,y)),...Array.isArray(u)?u:[u]]));const Ht=(e,t)=>{const a=_.forwardRef(({className:i,...s},u)=>_.createElement(w6,{ref:u,iconNode:t,className:kI(`lucide-${S6(P_(e))}`,`lucide-${e}`,i),...s}));return a.displayName=P_(e),a};const C6=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],I6=Ht("activity",C6);const A6=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],R6=Ht("archive-restore",A6);const T6=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],E6=Ht("arrow-left",T6);const M6=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],P6=Ht("bookmark",M6);const O6=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]],j6=Ht("bookmark-x",O6);const N6=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]],O_=Ht("book-open-text",N6);const z6=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],D6=Ht("boxes",z6);const U6=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],L6=Ht("calendar-clock",U6);const H6=[["path",{d:"M11 13H7",key:"t0o9gq"}],["path",{d:"M19 9h-4",key:"rera1j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]],wI=Ht("chart-column-stacked",H6);const $6=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Tc=Ht("check",$6);const q6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],B6=Ht("circle-check",q6);const V6=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Lc=Ht("chevron-down",V6);const F6=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],id=Ht("chevron-right",F6);const K6=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],CI=Ht("cloud",K6);const G6=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Z6=Ht("credit-card",G6);const W6=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Y6=Ht("download",W6);const J6=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],vg=Ht("external-link",J6);const X6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],II=Ht("file-text",X6);const Q6=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],eH=Ht("github",Q6);const tH=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],AI=Ht("earth",tH);const nH=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aH=Ht("circle-question-mark",nH);const oH=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],iH=Ht("list-filter",oH);const rH=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],sH=Ht("loader-circle",rH);const lH=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],cH=Ht("maximize-2",lH);const uH=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],jb=Ht("message-square",uH);const dH=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],mH=Ht("ellipsis",dH);const fH=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],RI=Ht("panel-left",fH);const pH=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],pv=Ht("panel-right",pH);const hH=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],gH=Ht("pin",hH);const vH=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],bH=Ht("pin-off",vH);const yH=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],SH=Ht("plug",yH);const _H=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],xH=Ht("plus",_H);const kH=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],wH=Ht("search",kH);const CH=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Nb=Ht("settings",CH);const IH=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],TI=Ht("square-terminal",IH);const AH=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],RH=Ht("user-round",AH);const TH=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Hf=Ht("x",TH);function EH({platform:e}){return!$f()||zb(e)?null:E.jsxs("div",{className:"window-controls","aria-label":"Window controls",children:[E.jsx("button",{type:"button",className:"window-control minimize",title:"Minimize",onClick:()=>{bg("minimize")},children:E.jsx(Lc,{size:14})}),E.jsx("button",{type:"button",className:"window-control maximize",title:"Maximize",onClick:()=>{bg("toggleMaximize")},children:E.jsx(cH,{size:12})}),E.jsx("button",{type:"button",className:"window-control close",title:"Close",onClick:()=>{bg("close")},children:E.jsx(Hf,{size:13})})]})}function zb(e){const t=e?.toLowerCase()??"";return t==="darwin"||t.includes("mac")}function $f(){if(typeof window>"u")return!1;const e=window.openpond;return!!(e?.minimizeWindow||e?.toggleMaximizeWindow||e?.closeWindow)}async function bg(e){const t=window.openpond;if(!(t&&(e==="minimize"?await t.minimizeWindow?.():e==="toggleMaximize"?await t.toggleMaximizeWindow?.():await t.closeWindow?.())!==!1)){if(e==="toggleMaximize"&&document.fullscreenEnabled){document.fullscreenElement?await document.exitFullscreen():await document.documentElement.requestFullscreen();return}if(e==="close"){window.close();return}console.warn("Window controls require the Electron desktop shell.")}}const MH=[{destination:"walkthroughs",icon:O_,label:"Walkthroughs"},{destination:"external",icon:O_,label:"Docs",url:"https://openpond.ai/docs"},{destination:"external",icon:II,label:"Blog",url:"https://openpond.ai/blog"},{destination:"external",icon:Z6,label:"Pricing",url:"https://openpond.ai/pricing"},{destination:"external",icon:AI,label:"Web app",url:"https://openpond.ai/sandboxes"},{destination:"external",icon:eH,label:"GitHub",url:"https://github.com/openpond/openpond"},{destination:"external",icon:jb,label:"Submit issue",url:"https://github.com/openpond/openpond/issues/new/choose"}];function PH({onOpenWalkthroughs:e,walkthroughsActive:t}){const[a,i]=_.useState(!1),s=_.useRef(null);return _.useEffect(()=>{if(!a)return;function u(f){s.current?.contains(f.target)||i(!1)}function d(f){f.key==="Escape"&&i(!1)}return document.addEventListener("pointerdown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",u),document.removeEventListener("keydown",d)}},[a]),E.jsxs("div",{className:"sidebar-help-menu",ref:s,children:[E.jsx("button",{"aria-expanded":a,"aria-haspopup":"menu","aria-label":"Open docs and help menu",className:`sidebar-icon sidebar-help-trigger ${t?"active":""}`,"data-tooltip":"Help",onClick:()=>i(u=>!u),type:"button",children:E.jsx(aH,{size:17})}),a?E.jsx("div",{className:"sidebar-help-popover",role:"menu","aria-label":"Help",children:MH.map(u=>{const d=u.icon,f=E.jsxs(E.Fragment,{children:[E.jsx(d,{size:15}),E.jsx("span",{children:u.label})]});return u.destination==="walkthroughs"?E.jsx("button",{"aria-current":t?"page":void 0,className:"sidebar-help-item",onClick:()=>{i(!1),e()},role:"menuitem",type:"button",children:f},u.label):E.jsx("a",{className:"sidebar-help-item",href:u.url,onClick:b=>{b.preventDefault(),i(!1),OH(u.url)},rel:"noreferrer",role:"menuitem",target:"_blank",children:f},u.label)})}):null]})}async function OH(e){const t=window.openpond?.browser;t?.openExternal&&(await t.openExternal({conversationId:"openpond-help",url:e})).ok||window.open(e,"_blank","noopener,noreferrer")}const LG=[{value:"chat",label:"Chat"},{value:"work",label:"Work"}],yg=[{value:"chat",label:"Work",description:"Chat and complete tasks"},{value:"models",label:"Models",description:"Evaluate, train, and serve models"}];function EI(e){return e==="chat"?"New chat":"New task"}const hv="modelsTab",Sg="openpond:models-tab-change",jH=new Set(["models","tasksets","serving","usage"]);function j_(e){const t=new URLSearchParams(e).get(hv);return t&&jH.has(t)?t:"models"}function NH(e,t){const a=new URLSearchParams(e);t==="models"?a.delete(hv):a.set(hv,t);const i=a.toString();return i?`?${i}`:""}function zH({experience:e="work",productArea:t="chat",beginNewChat:a,setSectionMenuOpen:i,setSelectedAppId:s,setSelectedProjectId:u,setSelectedSessionId:d,setView:f,view:b}){const[p,y]=_.useState(()=>typeof window>"u"?"models":j_(window.location.search));_.useEffect(()=>{const T=()=>y(j_(window.location.search));return window.addEventListener("popstate",T),window.addEventListener(Sg,T),()=>{window.removeEventListener("popstate",T),window.removeEventListener(Sg,T)}},[]);function k(){s(null),u(null),d(null),i(null)}function w(T){k(),f("labs"),y(T);const A=NH(window.location.search,T);window.history.pushState(window.history.state,"",`${window.location.pathname}${A}${window.location.hash}`),window.dispatchEvent(new Event(Sg))}return E.jsxs("nav",{className:"sidebar-nav","aria-label":"Primary",children:[t==="models"?null:E.jsxs("button",{className:"nav-command nav-command-new-task",type:"button",onClick:()=>a(null),children:[E.jsx(xH,{size:18}),E.jsx("span",{children:EI(e)})]}),t==="models"?E.jsxs(E.Fragment,{children:[E.jsxs("button",{className:`nav-command ${b==="labs"&&p==="models"?"active":""}`,"aria-label":"Models",type:"button",onClick:()=>w("models"),children:[E.jsx(wI,{size:16}),E.jsx("span",{children:"Models"})]}),E.jsxs("button",{className:`nav-command ${b==="labs"&&p==="tasksets"?"active":""}`,"aria-label":"Tasksets",type:"button",onClick:()=>w("tasksets"),children:[E.jsx(D6,{size:16}),E.jsx("span",{children:"Tasksets"})]}),E.jsxs("button",{className:`nav-command ${b==="labs"&&p==="serving"?"active":""}`,"aria-label":"Serving",type:"button",onClick:()=>w("serving"),children:[E.jsx(CI,{size:16}),E.jsx("span",{children:"Serving"})]}),E.jsxs("button",{className:`nav-command ${b==="labs"&&p==="usage"?"active":""}`,"aria-label":"Usage",type:"button",onClick:()=>w("usage"),children:[E.jsx(I6,{size:16}),E.jsx("span",{children:"Usage"})]})]}):null,t==="chat"?E.jsxs(E.Fragment,{children:[E.jsxs("button",{className:`nav-command nav-command-prominent ${b==="scheduled"?"active":""}`,"aria-label":"Scheduled",type:"button",onClick:()=>{k(),f("scheduled")},children:[E.jsx(L6,{size:18}),E.jsx("span",{children:"Scheduled"})]}),E.jsxs("button",{className:`nav-command nav-command-prominent ${b==="outputs"?"active":""}`,"aria-label":"My files",type:"button",onClick:()=>{k(),f("outputs")},children:[E.jsx(II,{size:18}),E.jsx("span",{children:"My files"})]})]}):null]})}function DH({setSectionMenuOpen:e,setSelectedAppId:t,setSelectedProjectId:a,setSelectedSessionId:i,setView:s,view:u}){function d(){t(null),a(null),i(null),e(null),s("get-started")}return E.jsx("nav",{className:"sidebar-utility-nav","aria-label":"Resources",children:E.jsx(PH,{onOpenWalkthroughs:d,walkthroughsActive:u==="get-started"})})}const Zm=5,Za=15,gv=10,rn={defaultChatProvider:xl,subagents:fj(),codexPermissionMode:If,codexReasoningEffort:Af,openPondCommandAccessMode:fd,defaultBranchPrefix:"feat/",defaultNewProjectDirectory:"",advancedWorkspaceControls:!1,contextCompaction:{autoEnabled:!0,triggerPercent:85,summaryModel:"same_model"},training:{defaultModelRef:null,creationMode:"customize",autoApproveEvidence:!1},sidebarWidth:332,diffPanelWidth:560,sidebarSectionsCollapsed:{pinned:!1,projects:!1,cloudProjects:!1,chats:!1,savedForLater:!0},editor:{languageServers:"auto",diagnosticsWhileEditing:!0,checkOnSave:!0,languages:{typescript:{mode:"auto",customCommand:""},python:{mode:"auto",customCommand:""},rust:{mode:"auto",customCommand:""}}}},HG={activeTemplateId:"default",customized:!1,soul:"",soulPath:null,updatedAt:null,templates:[]},MI=[{value:md,label:"DeepSeek V4 Pro",description:"reasoning"},{value:"accounts/fireworks/models/kimi-k3",label:"Kimi K3",description:"reasoning"},{value:"accounts/fireworks/models/glm-5p2",label:"GLM-5.2",description:"reasoning"},{value:"accounts/fireworks/models/deepseek-v4-pro",label:"DeepSeek V4 Pro (Fireworks)",description:"reasoning"},{value:"accounts/fireworks/models/deepseek-v4-flash",label:"DeepSeek V4 Flash (Fireworks)",description:"reasoning"},{value:"accounts/fireworks/models/minimax-m3",label:"MiniMax M3",description:"reasoning"}],_g=[{value:"openpond",label:"OpenPond Chat"},{value:"codex",label:"OpenAI Codex",description:"Codex login"}],UH=["openai","xai","openrouter","deepseek","zai","moonshot","together","groq","custom-openai-compatible"],LH=["openpond","codex",...UH],PI=new Set(LH),OI=[{value:eb,label:"GPT-5.6 Sol"},{value:"gpt-5.6-terra",label:"GPT-5.6 Terra"},{value:"gpt-5.6-luna",label:"GPT-5.6 Luna"},{value:"gpt-5.5",label:"GPT-5.5"},{value:"gpt-5.4",label:"GPT-5.4"},{value:"gpt-5.4-mini",label:"GPT-5.4 Mini"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex"},{value:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark"},{value:"gpt-5.2",label:"GPT-5.2"}],$G=[{value:"default",label:"Default permissions",shortLabel:"Default",description:"Workspace sandbox; asks before crossing boundaries."},{value:"auto-review",label:"Auto-review",description:"Workspace sandbox; reviewer handles eligible approvals."},{value:"full-access",label:"Full access",description:"No sandbox or approval prompts."}],qG=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra High",shortLabel:"Extra High"}],BG=[{value:"ask",label:"Ask",description:"Ask before running shell commands."},{value:"full-access",label:"Full access",description:"Run shell commands without approval prompts."}],VG=[{value:"auto",label:"Auto",description:"Use installed language servers when available."},{value:"off",label:"Off",description:"Disable editor language servers."}],FG=[{value:"auto",label:"Auto",description:"Find the local executable automatically."},{value:"disabled",label:"Disabled",description:"Do not start this language server."},{value:"custom",label:"Custom",description:"Use a specific executable path or command name."}];function Db(e){return e.kind==="local"}function HH(e){return e.kind==="cloud"}function Dt(e,t){return`${e}:${t}`}function jI(e){const t=e?.trim();if(!t)return null;const a=t.indexOf(":");if(a<=0)return{kind:"local",id:t};const i=t.slice(0,a),s=t.slice(a+1);return(i==="local"||i==="cloud")&&s?{kind:i,id:s}:{kind:"local",id:t}}function vl(e){return`${e.type}:${e.id}`}function cf(e){const t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?"before":"after"}function uf(e,t,a,i="before"){if(t===a)return e;const s=e.filter(d=>d!==t),u=s.indexOf(a);return u===-1?e:(s.splice(i==="after"?u+1:u,0,t),s)}function N_(e,t){return e.length===t.length&&e.every((a,i)=>a===t[i])}function $H(e,t){if(!t)return e;const a=new Map(e.map(u=>[u.key,u])),i=t.map(u=>a.get(u)).filter(u=>!!u),s=new Set(i.map(u=>u.key));return[...i,...e.filter(u=>!s.has(u.key))]}function Ub(e,t){return e?.statuses?.[t]??null}function NI(e,t){return e?.providers?.[t]??null}function zI(e,t){return e?.modelCaches?.[t]??null}function qH(e){const t=[e.contextWindow?`${Math.round(e.contextWindow/1e3)}K context`:"",e.capabilities.reasoning?"reasoning":"",e.source].filter(Boolean);return{value:e.id,label:e.displayName||e.id,description:t.join(" · ")||void 0}}function BH(e){return e==="openpond"?MI:e==="codex"||e==="openai"?OI:[]}function VH(e){const t=new Set,a=[];for(const i of e)!i.value||t.has(i.value)||(t.add(i.value),a.push(i));return a}function KG(e){return PI.has(e)}function vv(e,t={}){if(!e)return t.localOnly,_g;const a=t.includeUnavailable??!1,i=t.enabledOnly??!1,s=[];for(const u of Vv){if(!PI.has(u)||t.localOnly&&u==="openpond")continue;const d=Ub(e,u);d&&(!a&&(u==="codex"&&!d.available&&!d.credential.connected||u!=="openpond"&&u!=="codex"&&!d.enabled)||i&&u!=="openpond"&&!d.enabled||i&&u==="codex"&&!d.available&&!d.credential.connected||s.push({value:u,label:u==="openpond"?"OpenPond Chat":d.displayName,description:u==="openpond"?void 0:d.available?"Connected":d.credential.connected?"Configured":d.routing.localByok?"Set up key":d.enabled?"Enabled":void 0}))}return s.length>0?s:_g}function rd(e,t){const i=(zI(t,e)?.models??[]).map(qH),s=NI(t,e),u=[...s?.modelOverrides??[],s?.defaultModel].filter(d=>!!d?.trim()).map(d=>({value:d,label:d}));return VH([...i,...u,...BH(e)])}function FH(e,t,a){if(e==="codex"||e==="openai")return!0;const i=t.trim();if(!i)return!1;const s=zI(a,e)?.models.find(u=>u.id===i);return s?!!s.capabilities.reasoning:rd(e,a).some(u=>u.value===i&&/\breasoning\b/i.test(u.description??""))}function df(e,t){const a=NI(t,e)?.defaultModel?.trim();if(a)return a;const i=Ub(t,e)?.defaultModel?.trim();if(i)return i;const s=rd(e,t)[0]?.value?.trim();return s||(e==="codex"?eb:e==="openpond"?md:"")}function Ls(e,t,a){const i=t?.trim();if(e==="codex"&&(i==="codex-default"||i==="gpt-5.5"))return eb;const s=rd(e,a);return i&&s.some(u=>u.value===i)||i&&e!=="codex"&&s.length===0&&!a?i:df(e,a)}function DI(e,t){const a=e.modelRef?.providerId??e.provider;return{provider:a,model:Ls(a,e.modelRef?.modelId,t)}}function Lb(e,t,a){return Ls(e,t,a)||void 0}function xi(e,t,a){const i=Lb(e,t,a);return i?{providerId:e,modelId:i}:void 0}function z_(e){return e==="full-access"?{approvalPolicy:"never",sandbox:"danger-full-access"}:{approvalPolicy:"on-request",sandbox:"workspace-write"}}function Uo(e){const t=e?.defaultChatProvider??rn.defaultChatProvider;return{defaultChatProvider:t,defaultChatModel:Ls(t,e?.defaultChatModel),subagents:Yu.parse(e?.subagents??rn.subagents),codexPermissionMode:e?.codexPermissionMode??rn.codexPermissionMode,codexReasoningEffort:e?.codexReasoningEffort??rn.codexReasoningEffort,openPondCommandAccessMode:e?.openPondCommandAccessMode??rn.openPondCommandAccessMode,defaultBranchPrefix:UI(e?.defaultBranchPrefix),defaultNewProjectDirectory:e?.defaultNewProjectDirectory??rn.defaultNewProjectDirectory,defaultTeamId:e?.defaultTeamId?.trim()||null,advancedWorkspaceControls:e?.advancedWorkspaceControls??rn.advancedWorkspaceControls,contextCompaction:{autoEnabled:e?.contextCompaction?.autoEnabled??rn.contextCompaction.autoEnabled,triggerPercent:e?.contextCompaction?.triggerPercent??rn.contextCompaction.triggerPercent,summaryModel:e?.contextCompaction?.summaryModel??rn.contextCompaction.summaryModel},training:{defaultModelRef:e?.training?.defaultModelRef??rn.training.defaultModelRef,creationMode:e?.training?.creationMode??rn.training.creationMode,autoApproveEvidence:e?.training?.autoApproveEvidence??rn.training.autoApproveEvidence},sidebarWidth:e?.sidebarWidth??rn.sidebarWidth,diffPanelWidth:e?.diffPanelWidth??rn.diffPanelWidth,sidebarSectionsCollapsed:{pinned:e?.sidebarSectionsCollapsed?.pinned??rn.sidebarSectionsCollapsed.pinned,projects:e?.sidebarSectionsCollapsed?.projects??rn.sidebarSectionsCollapsed.projects,cloudProjects:e?.sidebarSectionsCollapsed?.cloudProjects??rn.sidebarSectionsCollapsed.cloudProjects,chats:e?.sidebarSectionsCollapsed?.chats??rn.sidebarSectionsCollapsed.chats,savedForLater:e?.sidebarSectionsCollapsed?.savedForLater??rn.sidebarSectionsCollapsed.savedForLater},editor:{languageServers:e?.editor?.languageServers??rn.editor.languageServers,diagnosticsWhileEditing:e?.editor?.diagnosticsWhileEditing??rn.editor.diagnosticsWhileEditing,checkOnSave:e?.editor?.checkOnSave??rn.editor.checkOnSave,languages:{typescript:{mode:e?.editor?.languages?.typescript?.mode??rn.editor.languages.typescript.mode,customCommand:e?.editor?.languages?.typescript?.customCommand??rn.editor.languages.typescript.customCommand},python:{mode:e?.editor?.languages?.python?.mode??rn.editor.languages.python.mode,customCommand:e?.editor?.languages?.python?.customCommand??rn.editor.languages.python.customCommand},rust:{mode:e?.editor?.languages?.rust?.mode??rn.editor.languages.rust.mode,customCommand:e?.editor?.languages?.rust?.customCommand??rn.editor.languages.rust.customCommand}}}}}function UI(e){const t=e?.trim()??rn.defaultBranchPrefix;if(!t)return"";const i=t.toLowerCase().replace(/[^a-z0-9._/-]+/g,"-").replace(/\/{2,}/g,"/").replace(/^-+/,"").slice(0,48).split("/").map(s=>s.replace(/^-+|-+$/g,"")).filter(Boolean).join("/");return i?`${i}/`:""}function GG(e,t){return e==="openpond"?"OpenPond Chat":Ub(t,e)?.displayName??(e==="codex"?"OpenAI Codex":e)}function ZG(e,t,a){if(a){const i=rd(a,t).find(s=>s.value===e);if(i)return i.label}if(t)for(const i of Vv){const s=rd(i,t).find(u=>u.value===e);if(s)return s.label}return[...MI,...OI].find(i=>i.value===e)?.label??e}function KH(e,t){return t==="chat"?e.filter(a=>a.experience==="chat"):e.filter(a=>a.experience==="work"||a.experience==="development")}function GH(e){return e.experience==="chat"?"Chat":"Work"}const Hb="taskDraft";function LI(e){if(e?.experience!=="work")return null;const t=e.metadata?.[Hb];if(!t||typeof t!="object"||Array.isArray(t))return null;const a=t.prompt;return typeof a=="string"&&a.trim()?a:null}function qf(e){return LI(e)!==null}function ZH(e){return(e.split(/\r?\n/u).map(a=>a.trim()).find(Boolean)||"Task draft").slice(0,64)}function xg(e,t,a=new Date().toISOString()){const i={version:1,prompt:t,savedAt:a};return{...e??{},[Hb]:i}}function WH(e){const t={...e??{}};return delete t[Hb],t}function Es(e){const t=Pm(e.metadata?.trainingTasksetId)??Pm(e.metadata?.tasksetId);return t?{id:t,name:Pm(e.metadata?.trainingTasksetName)??Pm(e.metadata?.tasksetName)??YH(t)}:null}function YH(e){const a=e.replace(/[-_][a-f0-9]{8,}$/i,"").replace(/^(?:benchmark[-_])?taskset[-_]/i,"").replace(/^benchmark[-_]/i,"").split(/[-_]+/).filter(Boolean);return a.length===0?"Taskset":a.map(i=>/^[A-Z0-9]{2,}$/.test(i)?i:`${i.charAt(0).toUpperCase()}${i.slice(1)}`).join(" ")}function Pm(e){return typeof e=="string"&&e.trim()?e.trim():null}const D_=[{value:"active",label:"Active"},{value:"in_progress",label:"In progress"},{value:"pinned",label:"Pinned"},{value:"saved_for_later",label:"Save for later"},{value:"tasksets",label:"Tasksets"},{value:"done",label:"Done"},{value:"all",label:"All"}],JH=[{value:"recent",label:"Recent first"},{value:"manual",label:"Manual order"}];function U_(e){const t=[];if(e.filter==="done")t.push(...e.doneSessions.filter(i=>!Es(i)));else if(e.filter==="all")t.push(...e.activeSessions.filter(i=>!Es(i)),...e.doneSessions.filter(i=>!Es(i)));else if(e.filter==="tasksets")t.push(...e.activeSessions.filter(i=>L_(i,e.selectedTasksetId)),...e.doneSessions.filter(i=>L_(i,e.selectedTasksetId)));else for(const i of e.activeSessions)Es(i)||(e.filter==="active"?i.savedForLater||t.push(i):e.filter==="in_progress"?!i.savedForLater&&e.inProgressSessionIds.has(i.id)&&t.push(i):e.filter==="pinned"?i.pinned&&!i.savedForLater&&t.push(i):e.filter==="saved_for_later"&&i.savedForLater&&t.push(i));const a=e.previewSessionIds?new Map(e.previewSessionIds.map((i,s)=>[i,s])):null;return e.sort==="recent"?t.sort((i,s)=>$_(i,s,a)):t.sort((i,s)=>{const u=a?.get(i.id),d=a?.get(s.id);if(u!==void 0||d!==void 0){if(u===void 0)return 1;if(d===void 0)return-1;if(u!==d)return u-d}return i.order!==s.order?i.order-s.order:$_(i,s)})}function L_(e,t){const a=Es(e);return!!(a&&(!t||a.id===t))}function XH(e){return e.filter==="saved_for_later"||e.filter==="tasksets"?{count:Math.max(0,e.activeCount),label:"In Progress",targetFilter:"active",targetLabel:"active"}:{count:Math.max(0,e.savedForLaterCount),label:"Later",targetFilter:"saved_for_later",targetLabel:"saved for later"}}function QH(e,t){switch(e){case"active":return`No active ${t}`;case"in_progress":return"No work in progress";case"pinned":return`No pinned ${t}`;case"saved_for_later":return"Nothing saved for later";case"tasksets":return"No Taskset chats yet";case"done":return`No done ${t}`;case"all":return`No ${t}`}}function H_(e,t,a){const i=new Set(t);let s=0;return e.map(u=>{if(!i.has(u))return u;const d=a[s];return s+=1,d??u})}function $_(e,t,a=null){const i=mf(e),s=mf(t);if(i!==s)return i?-1:1;if(i&&s){const d=a?.get(e.id),f=a?.get(t.id);if(d!==void 0||f!==void 0){if(d===void 0)return 1;if(f===void 0)return-1;if(d!==f)return d-f}if(e.order!==t.order)return e.order-t.order}const u=Date.parse(t.updatedAt)-Date.parse(e.updatedAt);return u!==0?u:e.title.localeCompare(t.title)}function mf(e){return e.pinned&&!e.savedForLater&&!e.archived}function HI(e){return`${e.kind}:${e.id}`}function sd(e,t){return!!(e&&t&&e.kind===t.kind&&e.id===t.id)}function e$(e){return{kind:"session",id:e}}function t$(e){return{kind:"project",id:e}}function n$(e){return{kind:"draft",id:e}}function a$(e){return e.selectedSessionId?e$(e.selectedSessionId):e.selectedProjectId?t$(e.selectedProjectId):n$(e.selectedAppId?`app:${e.selectedAppId}`:"new-chat")}function o$(e){if(!e.previousScope||e.previousScope.kind!=="draft"||e.activeScope.kind!=="session")return[...e.tabs];if(sd(e.previousScope,e.activeScope))return[...e.tabs];const t=e.now??Date.now();return e.tabs.map(a=>sd(a.scope,e.previousScope)?{...a,scope:e.activeScope,updatedAt:t}:a)}function WG(e,t){return e.filter(a=>sd(a.scope,t))}function YG(e,t){return!!(e&&sd(e.scope,t))}function i$(e){const t={};for(const a of e){const i=HI(a.scope),s=t[i]??{scope:a.scope,tabCount:0,runningCount:0,failedCount:0,lastExitCode:null,status:"none"};s.tabCount+=1,a.commandStatus==="running"&&(s.runningCount+=1),(a.commandStatus==="failed"||a.status==="error")&&(s.failedCount+=1),a.lastExitCode!==null&&(s.lastExitCode=a.lastExitCode),s.status=s$(s.status,a.status,a.commandStatus),t[i]=s}return t}function r$(e){return!e||e.status==="none"||e.tabCount===0?null:e.status==="running"?{status:"running",label:"Terminal running"}:e.status==="failed"?{status:"failed",label:"Terminal last command failed"}:e.status==="success"?{status:"success",label:"Terminal last command succeeded"}:e.status==="idle"?{status:"idle",label:"Terminal idle"}:{status:"unknown",label:"Terminal open"}}function s$(e,t,a){return a==="running"?"running":e==="running"?e:a==="failed"||t==="error"?"failed":e==="failed"?e:a==="success"?e==="none"||e==="unknown"||e==="idle"?"success":e:a==="idle"?e==="none"||e==="unknown"?"idle":e:e==="none"?"unknown":e}function l$(e,t){if(!e)return t?.path??"Use files on this machine";if(e.error)return"status unavailable";if(!e.initialized)return"not checked out";const i=[e.currentBranch??t?.branch??e.defaultBranch??"no branch"],s=d$(e),u=t?.linkedCloudSourceKnown===!1&&!!e.headCommit;return s?i.push(s):u?i.push("upload required"):e.diverged?(e.ahead>0&&i.push(Ms("ahead",e.ahead)),e.behind>0&&i.push(Ms("behind",e.behind)),i.push("diverged")):(e.ahead>0&&i.push(Ms("ahead",e.ahead)),e.behind>0&&i.push(Ms("behind",e.behind))),e.changedFilesCount>0?i.push(`${e.changedFilesCount} changed`):e.dirty&&i.push("dirty"),e.untrackedFilesCount>0&&i.push(`${e.untrackedFilesCount} untracked`),i.length===1&&i.push("synced"),i.join(" / ")}function c$(e,t,a,i={}){const s=e?.linkedSandboxProject??null;if(!s?.projectId&&!t)return"upload required";if(s?.projectId&&i.cloudLinkTrusted===!1)return"uploaded to a different account";const u=s?.defaultBranch??t?.defaultBranch??"main",d=s?.manifestHash??null,f=e?.sandboxTemplate?.manifestHash??null,b=s?.syncedAt??t?.syncedAt??null,p=!!(d&&f&&d!==f),y=!!(s?.projectId&&a?.headCommit&&!s.lastUploadedCommit),k=m$(a);return k?`${u} / ${k}`:y?`${u} / upload required`:`${u} / ${p||!b?"needs sync":"setup ready"}`}function u$(e,t,a={}){if(!e)return"select a local project";if(e.linkedSandboxProject?.projectId&&a.cloudLinkTrusted===!1)return"sync to this account";if(!t)return e.linkedSandboxProject?"sync source to cloud":"push local source to cloud";if(t.error)return"repo status unavailable";if(!t.initialized)return"local repo unavailable";const i=[],s=t.aheadOfLinkedSource>0?t.aheadOfLinkedSource:t.ahead;return e.linkedSandboxProject?.projectId||i.push("upload required"),e.linkedSandboxProject?.projectId&&t.headCommit&&!e.linkedSandboxProject.lastUploadedCommit&&i.push("upload required"),s>0&&i.push($I(s)),t.linkedSourceHeadCommit&&t.headCommit&&t.linkedSourceHeadCommit!==t.headCommit&&t.linkedSourceComparisonError&&s===0&&i.push("source changed"),t.changedFilesCount>0&&i.push(`${t.changedFilesCount} changed file${t.changedFilesCount===1?"":"s"}`),t.untrackedFilesCount>0&&i.push(`${t.untrackedFilesCount} untracked skipped`),i.length>0?i.join(" / "):"nothing to upload"}function d$(e){return e.linkedSourceHeadCommit?e.divergedFromLinkedSource?"diverged":e.aheadOfLinkedSource>0?Ms("local ahead",e.aheadOfLinkedSource):e.behindLinkedSource>0?Ms("cloud ahead",e.behindLinkedSource):e.linkedSourceComparisonError&&e.headCommit&&e.linkedSourceHeadCommit!==e.headCommit?"sync unknown":null:null}function m$(e){return e?.linkedSourceHeadCommit?e.dirty?"local dirty files not in cloud":e.divergedFromLinkedSource?"diverged from local":e.aheadOfLinkedSource>0?Ms("cloud behind local",e.aheadOfLinkedSource):e.behindLinkedSource>0?Ms("cloud ahead local",e.behindLinkedSource):e.linkedSourceComparisonError&&e.headCommit&&e.linkedSourceHeadCommit!==e.headCommit?"source check unavailable":"synced":null}function Ms(e,t){return`${e} by ${$I(t)}`}function $I(e){return`${e} commit${e===1?"":"s"}`}function f$({session:e,onSave:t,onClose:a}){const[i,s]=_.useState(e.title),u=_.useRef(null);_.useEffect(()=>{const b=u.current;b&&(b.focus(),b.select())},[]),_.useEffect(()=>{function b(p){p.key==="Escape"&&a()}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[a]);function d(){const b=i.trim();b&&(t(b),a())}function f(b){b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),d())}return E.jsx("div",{className:"git-dialog-backdrop rename-chat-backdrop",role:"presentation",onMouseDown:a,children:E.jsxs("section",{className:"git-dialog rename-chat-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"rename-chat-title",onMouseDown:b=>b.stopPropagation(),children:[E.jsx("h2",{id:"rename-chat-title",children:"Rename chat"}),E.jsx("textarea",{ref:u,className:"rename-chat-input",value:i,rows:1,maxLength:200,onChange:b=>s(b.target.value),onKeyDown:f,"aria-label":"Chat title"}),E.jsxs("div",{className:"git-dialog-footer",children:[E.jsx("button",{type:"button",className:"git-dialog-secondary",onClick:a,children:"Cancel"}),E.jsx("button",{type:"button",className:"git-dialog-primary",autoFocus:!0,onClick:d,disabled:!i.trim(),children:"Save"})]})]})})}const p$=2650,h$=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}),g$=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit"}),v$=new Intl.DateTimeFormat("en-US",{dateStyle:"medium",timeStyle:"short"});function b$(){return{animationDelay:`${-(Date.now()%p$)}ms`}}function y$(e){const t=e.currentTarget,a=t.firstElementChild;if(!(a instanceof HTMLElement))return;const i=Math.max(0,a.scrollWidth-t.clientWidth),s=i>2;t.dataset.overflowing=String(s),t.style.setProperty("--sidebar-title-ticker-distance",`${-i}px`),t.style.setProperty("--sidebar-title-ticker-duration",`${Math.min(6.5,Math.max(2.8,i/42+2.4))}s`)}function S$({label:e,actions:t,actionsVisible:a=!1,className:i,titleAccessory:s,children:u,collapsed:d=!1,titleActive:f=!1,onTitleClick:b,onToggleCollapsed:p}){return E.jsxs("section",{className:["sidebar-section",i,a?"actions-visible":""].filter(Boolean).join(" "),children:[E.jsxs("div",{className:"section-header",children:[E.jsxs("div",{className:"section-title-row",children:[b?E.jsxs("div",{className:"section-title-combo",children:[E.jsx("button",{type:"button",className:`section-title-link${f?" active":""}`,onClick:b,children:E.jsx("span",{children:e})}),p&&E.jsx("button",{type:"button",className:"section-chevron-button","aria-label":`${d?"Expand":"Collapse"} ${e}`,"aria-expanded":!d,onClick:p,children:d?E.jsx(id,{size:13}):E.jsx(Lc,{size:13})})]}):p?E.jsxs("button",{type:"button",className:"section-title-button","aria-label":`${d?"Expand":"Collapse"} ${e}`,"aria-expanded":!d,onClick:p,children:[E.jsx("span",{children:e}),d?E.jsx(id,{size:13}):E.jsx(Lc,{size:13})]}):E.jsx("span",{children:e}),s]}),t&&E.jsx("div",{className:"section-actions",children:t})]}),!d&&E.jsx("div",{className:"sidebar-section-body",children:u})]})}function q_({children:e,expanded:t=!1,onClick:a}){return E.jsx("button",{type:"button",className:"sidebar-show-more",onClick:a,children:e??(t?"Show less":"Show more")})}function B_({session:e,selected:t,icon:a,archived:i=!1,hideIcon:s=!1,nested:u=!1,dragging:d,placeholder:f,running:b,goalRuntime:p,subagentRuntime:y,terminalIndicator:k,projectLabel:w,childSessionCount:T=0,childSessionsExpanded:A=!1,onSelect:H,onToggleChildSessions:W,onTogglePin:B,onToggleSaveForLater:M,onDockRight:j,onArchive:L,onDragStart:D,onDragEnd:q,onDragOver:$,onDrop:X,onRename:ae}){const[ie,ue]=_.useState(!1),ge=p?.status==="queued",Te=p?.tone==="active"&&!ge,Be=(y?.activeCount??0)>0,Pe=T>0&&!!W,U=s&&!Pe,le=Be||Te||!ge&&(b??e.status==="active"),he=Be&&y?y.label:Te&&p?_$(p):"Running",Me=["sidebar-task-row",qf(e)?"is-draft":"",j?"actions-4":M?"actions-3":"",le?"has-running-dot":"",w?"has-project-detail":""].filter(Boolean).join(" "),Ue=_.useMemo(b$,[]),O=E.jsxs("div",{className:`sidebar-row-actions${w?" sidebar-task-inline-actions":""}`,children:[j?E.jsx(Om,{label:"Open in right panel",onClick:j,children:E.jsx(pv,{size:13})}):null,E.jsx(Om,{label:e.pinned?"Unpin chat":"Pin chat",onClick:B,children:e.pinned?E.jsx(bH,{size:13}):E.jsx(gH,{size:13})}),M?E.jsx(Om,{label:e.savedForLater?"Return to active":"Save for later",onClick:M,children:e.savedForLater?E.jsx(j6,{size:13}):E.jsx(P6,{size:13})}):null,E.jsx(Om,{label:i?"Reopen":"Mark done",onClick:L,children:i?E.jsx(R6,{size:13}):E.jsx(Tc,{size:13})})]}),Z=E.jsxs(w$,{selected:t,dataSessionId:e.id,dragging:d,iconless:U,nested:u,placeholder:f,className:Me||void 0,ariaExpanded:Pe?A:void 0,onSelect:H,onDragStart:D,onDragEnd:q,onDragOver:$,onDrop:X,onDoubleClick:ae?()=>ue(!0):void 0,children:[U?null:Pe?E.jsx("button",{type:"button",className:"sidebar-child-toggle","data-tooltip":A?"Hide subagent conversations":"Show subagent conversations","aria-label":`${A?"Hide":"Show"} ${T} subagent ${T===1?"conversation":"conversations"}`,"aria-expanded":A,onClick:ve=>{ve.stopPropagation(),W?.()},children:A?E.jsx(Lc,{size:13}):E.jsx(id,{size:13})}):a??E.jsx(jb,{size:15}),E.jsxs("span",{className:`row-label-shell${w?" has-detail":""}`,children:[E.jsxs("span",{className:"sidebar-session-title-line",children:[E.jsx("span",{className:"row-label sidebar-task-title","data-overflowing":"false",onPointerEnter:y$,children:E.jsx("span",{className:"sidebar-task-title-text",children:e.title})}),w?null:E.jsx(V_,{value:e.updatedAt})]}),w?E.jsxs("span",{className:"sidebar-session-detail-line",children:[E.jsx("span",{className:"sidebar-session-project-label",children:w}),O,E.jsx(V_,{value:e.updatedAt})]}):null]}),E.jsxs("div",{className:"row-meta",children:[E.jsxs("span",{className:"row-meta-status",children:[k?E.jsx(k$,{indicator:k}):null,le?E.jsx("span",{className:`sidebar-running-dot${Be?" subagent":Te?" goal":""}`,style:Ue,"aria-label":he}):null]}),w?null:O]})]}),be=ie&&ae?E.jsx(f$,{session:e,onSave:ve=>ae(e,ve),onClose:()=>ue(!1)}):null;return E.jsxs(E.Fragment,{children:[Z,be]})}function _$(e){return e.actionLabel}function V_({value:e}){const t=x$(e);if(!t||!e)return null;const a=new Date(e);return E.jsx("time",{className:"sidebar-row-updated-at",dateTime:e,title:`Last updated ${v$.format(a)}`,children:t})}function x$(e,t=new Date){if(!e)return null;const a=new Date(e);if(Number.isNaN(a.getTime()))return null;const i=g$.format(a);return a.getFullYear()===t.getFullYear()&&a.getMonth()===t.getMonth()&&a.getDate()===t.getDate()?i:`${h$.format(a)} ${i}`}function k$({indicator:e}){return E.jsx("span",{className:`sidebar-terminal-indicator ${e.status}`,"data-tooltip":e.label,"aria-label":e.label,title:e.label,children:E.jsx(TI,{size:13})})}function w$({children:e,className:t,dataSessionId:a,dragging:i,iconless:s=!1,nested:u=!1,placeholder:d=!1,selected:f,ariaExpanded:b,ariaDescribedBy:p,onSelect:y,onDragStart:k,onDragEnd:w,onDragOver:T,onDrop:A,onDoubleClick:H}){const W=!!k;return E.jsx("div",{className:["sidebar-row",t??"",f?"selected":"",i?"dragging":"",s?"iconless":"",u?"nested":"",d?"placeholder":""].filter(Boolean).join(" "),draggable:W,"data-session-id":a,role:"button",tabIndex:0,"aria-expanded":b,"aria-describedby":p,onClick:y,onDoubleClick:H,onKeyDown:B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),y())},onDragStart:k,onDragEnd:w,onDragEnter:B=>{T&&(B.preventDefault(),B.dataTransfer.dropEffect="move",T(B))},onDragOver:B=>{T&&(B.preventDefault(),B.dataTransfer.dropEffect="move",T(B))},onDrop:B=>{A&&(B.preventDefault(),A(B))},children:e})}function Om({children:e,label:t,onClick:a}){return E.jsx("button",{type:"button",className:"sidebar-row-action","data-tooltip":t,"aria-label":t,onClick:i=>{i.stopPropagation(),a()},children:e})}function C$({filter:e,noun:t,onFilterChange:a,onTasksetChange:i,onSortChange:s,openMenu:u,setOpenMenu:d,sort:f,selectedTasksetId:b,tasksets:p}){const[y,k]=_.useState(!1),T=p.find(W=>W.id===b)?.name??D_.find(W=>W.value===e)?.label??"Active",A=u==="tasks-filter",H=u==="chats";return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"section-menu",children:[E.jsx("button",{type:"button",className:`section-icon ${H?"active":""}`,"aria-label":`Sort ${t}`,"aria-haspopup":"menu","aria-expanded":H,onClick:()=>d(W=>W==="chats"?null:"chats"),children:E.jsx(mH,{size:14})}),H?E.jsx("div",{className:"section-menu-popover",role:"menu","aria-label":`Sort ${t}`,children:JH.map(W=>E.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":f===W.value,onClick:()=>{s(W.value),d(null)},children:[E.jsx("span",{className:"section-menu-check","aria-hidden":"true",children:f===W.value?E.jsx(Tc,{size:13}):null}),E.jsx("span",{children:W.label})]},W.value))}):null]}),E.jsxs("div",{className:"section-menu",children:[E.jsx("button",{type:"button",className:`section-icon ${A||e!=="active"?"active":""}`,"aria-label":`Filter ${t}: ${T}`,"aria-haspopup":"menu","aria-expanded":A,onClick:()=>d(W=>W==="tasks-filter"?null:"tasks-filter"),children:E.jsx(iH,{size:14})}),A?E.jsx("div",{className:"section-menu-popover",role:"menu","aria-label":`Filter ${t}`,children:D_.map(W=>E.jsxs(_.Fragment,{children:[W.value==="tasksets"?E.jsxs("button",{type:"button",role:"menuitem","aria-expanded":y,onClick:()=>k(B=>!B),children:[E.jsx("span",{className:"section-menu-check","aria-hidden":"true",children:y?E.jsx(Lc,{size:13}):E.jsx(id,{size:13})}),E.jsx("span",{children:W.label})]}):E.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":e===W.value,onClick:()=>{a(W.value),d(null)},children:[E.jsx("span",{className:"section-menu-check","aria-hidden":"true",children:e===W.value?E.jsx(Tc,{size:13}):null}),E.jsx("span",{children:W.label})]}),W.value==="tasksets"&&y?E.jsxs(E.Fragment,{children:[E.jsxs("button",{className:"section-menu-taskset-option",type:"button",role:"menuitemradio","aria-checked":e==="tasksets"&&!b,onClick:()=>{i(null),d(null)},children:[E.jsx("span",{className:"section-menu-check","aria-hidden":"true",children:e==="tasksets"&&!b?E.jsx(Tc,{size:13}):null}),E.jsx("span",{children:"All Tasksets"})]}),p.map(B=>E.jsxs("button",{className:"section-menu-taskset-option",type:"button",role:"menuitemradio","aria-checked":e==="tasksets"&&b===B.id,onClick:()=>{i(B.id),d(null)},children:[E.jsx("span",{className:"section-menu-check","aria-hidden":"true",children:e==="tasksets"&&b===B.id?E.jsx(Tc,{size:13}):null}),E.jsx("span",{children:B.name}),E.jsx("span",{className:"section-menu-option-count","aria-hidden":"true",children:B.chatCount})]},B.id))]}):null]},W.value))}):null]})]})}const I$={},A$=new Map,R$=new Map;function T$(e,t){return Math.min(Math.max(e,Za)+gv,t)}function E$(e,t){const a=Math.max(Za,Math.min(e,t));if(a<=Za)return Za;const i=Math.ceil((a-Za)/gv);return Math.max(Za,Za+(i-1)*gv)}function M$({activeSessions:e,archiveSession:t,archivedSessions:a,chatRowsVisibleCount:i,childSessionRowsByParentId:s={},cloudProjectRows:u,commitTaskDrop:d,commitTaskPreviewDrop:f,dockSessionRight:b,experience:p="work",goalRuntimeBySessionId:y=A$,localProjectRows:k,previewTaskDrop:w,projectRows:T,renameSession:A,restoreSession:H,runningSessionIds:W,savedForLaterSessions:B,sectionMenuOpen:M,selectedSessionId:j,setChatRowsVisibleCount:L,setSectionMenuOpen:D,setSelectedAppId:q,setSelectedProjectId:$,setSelectedSessionId:X,setView:ae,sidebarProjectIdBySessionId:ie,startTaskDrag:ue,subagentRuntimeBySessionId:ge=R$,taskDragSessionId:Te,taskPreviewSessionIds:Be,terminalSummaries:Pe=I$,toggleSessionPinned:U,toggleSessionSavedForLater:le,view:he,clearTaskDrag:Me}){const[Ue,O]=_.useState("active"),[Z,be]=_.useState("recent"),[ve,fe]=_.useState(null),[ee,Ce]=_.useState(()=>new Set),je=p==="chat"?"chats":"tasks",et=p==="chat"?"Chats":"Tasks",We=_.useMemo(()=>e.filter(ye=>Es(ye)===null),[e]),Ve=_.useMemo(()=>B.filter(ye=>Es(ye)===null),[B]),lt=Math.max(0,We.length-Ve.length),st=XH({activeCount:lt,filter:Ue,savedForLaterCount:Ve.length}),Je=T??[...k,...u],Y=_.useMemo(()=>new Map(Je.map(ye=>[ye.id,ye.project.name])),[Je]),oe=_.useMemo(()=>{const ye=new Set(W);for(const Qe of e){const ot=y.get(Qe.id),Ft=ge.get(Qe.id);(ot?.tone==="active"&&ot.status!=="queued"||(Ft?.activeCount??0)>0||Ie(Qe.id)?.status==="running")&&ye.add(Qe.id)}return ye},[e,y,W,ge,Pe]),K=_.useMemo(()=>U_({activeSessions:e,doneSessions:a,filter:"all",inProgressSessionIds:oe,sort:"manual"}),[e,a,oe]),te=_.useMemo(()=>U_({activeSessions:e,doneSessions:a,filter:Ue,inProgressSessionIds:oe,selectedTasksetId:ve,previewSessionIds:Be,sort:Z}),[e,a,oe,ve,Ue,Be,Z]),xe=_.useMemo(()=>{const ye=new Map;for(const Qe of[...e,...a]){const ot=Es(Qe);if(!ot)continue;const Ft=ye.get(ot.id);Ft?Ft.chatCount+=1:ye.set(ot.id,{...ot,chatCount:1})}return[...ye.values()].sort((Qe,ot)=>Qe.name.localeCompare(ot.name))},[e,a]),Oe=te.slice(0,Math.max(Za,i)),Ye=Oe.length<te.length,bt=Oe.length>Za,dt=K.map(ye=>ye.id),wt=te.map(ye=>ye.id),_t=Z==="recent"?te.filter(mf):[],Ge=_t.map(ye=>ye.id),at=_t.length>0&&_t.length<te.length,g=at?_t[0]?.id??null:null,F=at?_t[_t.length-1]?.id??null:null,re=JSON.stringify(Object.entries(s).filter(([ye,Qe])=>Qe.length>0&&(ge.get(ye)?.activeCount??0)>0).flatMap(([ye,Qe])=>Qe.map(ot=>[ye,ot.id])).sort(([ye,Qe],[ot,Ft])=>ye.localeCompare(ot)||Qe.localeCompare(Ft)));_.useEffect(()=>{const ye=JSON.parse(re);if(ye.length===0)return;const Qe=new Set(ye.map(([ot])=>ot));Ce(ot=>[...Qe].every(Ft=>ot.has(Ft))?ot:new Set([...ot,...Qe]))},[re]);function Ie(ye){return r$(Pe[HI({kind:"session",id:ye})])}function G(ye){if(qf(ye))return"Draft";if(p==="chat")return null;const Qe=ie[ye.id];return Qe?Y.get(Qe)??ye.workspaceName??"Project":GH(ye)}function se(ye){X(ye.id);const Qe=ie[ye.id]??null;q(Qe?null:ye.appId),$(Qe),ae("chat")}function R(ye){return s[ye.id]??[]}function V(ye,Qe){return ee.has(ye.id)||Qe.some(ot=>ot.id===j)}function pe(ye){Ce(Qe=>{const ot=new Set(Qe);return ot.has(ye)?ot.delete(ye):ot.add(ye),ot})}function me(ye){const Qe=R(ye);return Qe.length===0||!V(ye,Qe)?null:E.jsx("div",{className:"sidebar-child-session-group",children:Qe.map(ot=>E.jsx(B_,{session:ot,selected:he==="chat"&&j===ot.id,hideIcon:!0,nested:!0,running:oe.has(ot.id),goalRuntime:y.get(ot.id)??null,subagentRuntime:ge.get(ot.id)??null,terminalIndicator:Ie(ot.id),projectLabel:G(ye),onSelect:()=>se(ot),onTogglePin:()=>U(ot),onToggleSaveForLater:()=>le(ot),onDockRight:()=>b(ot),onArchive:()=>ot.archived?H(ot):t(ot),onRename:A},ot.id))})}function ke(ye){const Qe=ye.archived,ot=Te===ye.id,Ft=R(ye),Jn=["sidebar-session-group",ye.id===g?"pinned-group-first":"",ye.id===F?"pinned-group-last":""].filter(Boolean).join(" "),Mn=Z==="recent"&&mf(ye),Hn=Mn?Ge:wt,zt=Z==="manual"||Mn?{onDragStart:Pn=>ue(Pn,{allSessionIds:dt,visibleSessionIds:Hn,sessionId:ye.id}),onDragEnd:Me,onDragOver:Pn=>{ot||w(Pn,ye.id)},onDrop:Pn=>{ot?f():d(Pn,ye.id)}}:{};return E.jsxs("div",{className:Jn,children:[E.jsx(B_,{session:ye,selected:!Qe&&he==="chat"&&j===ye.id,archived:Qe,hideIcon:!0,placeholder:ot,running:oe.has(ye.id),goalRuntime:y.get(ye.id)??null,subagentRuntime:ge.get(ye.id)??null,terminalIndicator:Ie(ye.id),projectLabel:G(ye),childSessionCount:Ft.length,childSessionsExpanded:V(ye,Ft),onToggleChildSessions:()=>pe(ye.id),onSelect:()=>{Qe&&H(ye),se(ye)},onTogglePin:()=>U(ye),onToggleSaveForLater:()=>le(ye),onDockRight:()=>b(ye),onArchive:()=>Qe?H(ye):t(ye),onRename:A,...zt}),ot?null:me(ye)]},ye.id)}function Ee(ye){ye!=="tasksets"&&fe(null),O(ye),L(Za)}function Re(ye){fe(ye),O("tasksets"),L(Za)}function Xe(ye){be(ye),L(Za)}function tt(){L(ye=>T$(ye,te.length))}function qe(){L(ye=>E$(ye,te.length))}return E.jsx("div",{className:"sidebar-scroll",children:E.jsxs(S$,{label:et,className:`sidebar-task-section${p!=="chat"?" development":""}`,titleAccessory:p!=="chat"?E.jsx("div",{className:"sidebar-task-mode-buttons",children:E.jsxs("button",{type:"button",className:`section-icon sidebar-task-count-bubble${Ue==="saved_for_later"?" active":""}`,"aria-label":`Show ${st.count} ${st.targetLabel} ${st.count===1?"task":"tasks"}`,onClick:()=>Ee(st.targetFilter),children:[E.jsx("span",{children:st.label}),E.jsx("span",{className:"sidebar-task-count-badge","aria-hidden":"true",children:st.count>99?"99+":st.count})]})}):null,actionsVisible:M==="chats"||M==="tasks-filter",actions:E.jsx(C$,{filter:Ue,noun:je,onFilterChange:Ee,onTasksetChange:Re,onSortChange:Xe,openMenu:M,setOpenMenu:D,sort:Z,selectedTasksetId:ve,tasksets:xe}),children:[Oe.map(ke),te.length===0?E.jsx("div",{className:"empty-row",children:QH(Ue,je)}):null,te.length>Za&&(Ye||bt)?E.jsxs("div",{className:"sidebar-pagination-controls","aria-label":`Showing ${Oe.length} of ${te.length} ${je}`,children:[Ye?E.jsx(q_,{onClick:tt,children:"Show more"}):null,bt?E.jsx(q_,{onClick:qe,children:"Show less"}):null]}):null]})})}const P$="./";function So(e){return`${P$}${e.replace(/^\.?\//,"")}`}const O$=So("openpond-icon.png"),j$=So("openpond-wordlogo-white.png"),JG=So("tutorials/what-is-an-openpond-agent-poster.png"),XG=So("tutorials/what-is-an-openpond-agent.vtt"),QG=So("tutorials/how-to-make-an-agent-poster.png"),eZ=So("tutorials/how-to-make-an-agent.vtt");function tZ(e){return So(`tutorials/how-to-make-an-agent-${e}-poster.png`)}function nZ(e){return So(`tutorials/how-to-make-an-agent-${e}.vtt`)}const F_={github:So("connected-apps/github.svg"),google:So("connected-apps/google.svg"),microsoft_teams:So("connected-apps/microsoft.svg"),mcp:So("connected-apps/openpond-mcp.svg"),slack:So("connected-apps/slack.svg"),x:So("connected-apps/x.svg")};function aZ(e){return F_[e]??F_.mcp}function N$({value:e,onChange:t}){const[a,i]=_.useState(!1),s=_.useRef(null),u=_.useRef(null),d=_.useRef(null),f=yg.find(w=>w.value===e)??yg[0];_.useEffect(()=>{if(!a)return;const w=A=>{A.target instanceof Node&&!s.current?.contains(A.target)&&i(!1)},T=()=>i(!1);return window.addEventListener("pointerdown",w),window.addEventListener("blur",T),()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("blur",T)}},[a]);const b=w=>{window.requestAnimationFrame(()=>{const T=K_(d.current);if(!T.length)return;(w==="first"?T[0]:w==="last"?T.at(-1):T.find(H=>H.dataset.productArea===e))?.focus()})},p=w=>{i(!0),b(w)},y=w=>{w.key==="ArrowDown"?(w.preventDefault(),p("first")):w.key==="ArrowUp"&&(w.preventDefault(),p("last"))},k=w=>{const T=K_(d.current),A=T.findIndex(B=>B===document.activeElement);if(w.key==="Escape"){w.preventDefault(),i(!1),u.current?.focus();return}if(w.key==="Home"||w.key==="End"){w.preventDefault(),T[w.key==="Home"?0:T.length-1]?.focus();return}if(w.key!=="ArrowDown"&&w.key!=="ArrowUp")return;w.preventDefault();const H=w.key==="ArrowDown"?1:-1,W=A<0?0:(A+H+T.length)%T.length;T[W]?.focus()};return E.jsxs("div",{className:"sidebar-experience-menu",ref:s,children:[E.jsxs("button",{ref:u,type:"button",className:"sidebar-wordmark-button sidebar-experience-trigger","aria-label":`OpenPond product: ${f.label}`,"aria-haspopup":"menu","aria-expanded":a,onClick:()=>{i(w=>!w)},onKeyDown:y,children:[E.jsx("img",{className:"sidebar-wordmark",src:j$,alt:""}),E.jsx("span",{className:"sidebar-experience-label",children:f.label}),E.jsx(Lc,{size:13,"aria-hidden":"true"})]}),a?E.jsx("div",{ref:d,className:"sidebar-experience-popover",role:"menu","aria-label":"Choose product",onKeyDown:k,children:yg.map(w=>{const T=w.value===e;return E.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":T,className:T?"active":"","data-product-area":w.value,onClick:()=>{i(!1),T||t(w.value)},children:[E.jsxs("span",{children:[E.jsx("strong",{children:w.label}),E.jsx("small",{children:w.description})]}),T?E.jsx(Tc,{size:14,"aria-hidden":"true"}):null]},w.value)})}):null]})}function K_(e){return e?Array.from(e.querySelectorAll('[role="menuitemradio"]')):[]}function z$(...e){for(const t of e){const a=t?.trim();if(a)return a}return null}function D$(e){const t=e?.accounts.find(d=>d.isActive)??null,a=e?.profile??null,i=e?.activeProfile?.handle??null;return{label:(e?.state==="signed_in"?z$(e?.label,a?.handle,a?.name,a?.email,t?.displayLabel,t?.handle,i,e?.email,"Signed in"):e?.state==="loading"||e?.state==="switching"?"Loading account":"Sign in")??"Account",image:e?.avatarUrl??a?.image??t?.avatarUrl??null}}function U$({account:e,onOpenApps:t,onOpenActivity:a,onOpenSettings:i}){const[s,u]=_.useState(!1),d=_.useRef(null),f=_.useMemo(()=>D$(e),[e]),b=f.label.trim().slice(0,1).toUpperCase();return _.useEffect(()=>{if(!s)return;function p(k){d.current?.contains(k.target)||u(!1)}function y(k){k.key==="Escape"&&u(!1)}return document.addEventListener("pointerdown",p),document.addEventListener("keydown",y),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("keydown",y)}},[s]),E.jsxs("div",{className:"user-auth-footer",ref:d,children:[E.jsxs("button",{type:"button",className:`user-auth-trigger ${s?"active":""}`,"aria-haspopup":"menu","aria-expanded":s,"aria-label":`${f.label} account menu`,onClick:()=>u(p=>!p),children:[E.jsx("span",{className:"user-auth-avatar","aria-hidden":"true",children:f.image?E.jsx("img",{src:f.image,alt:""}):b?E.jsx("span",{children:b}):E.jsx(RH,{size:16})}),E.jsx("span",{className:"user-auth-name",children:f.label})]}),s?E.jsxs("div",{className:"user-auth-menu",role:"menu","aria-label":"Account",children:[t?E.jsxs("a",{href:"/apps",className:"user-auth-menu-link",role:"menuitem",onClick:p=>{p.preventDefault(),u(!1),t()},children:[E.jsx(SH,{size:15}),E.jsx("span",{children:"Apps"})]}):null,a?E.jsxs("a",{href:"/settings/usage",className:"user-auth-menu-link",role:"menuitem",onClick:p=>{p.preventDefault(),u(!1),a()},children:[E.jsx(wI,{size:15}),E.jsx("span",{children:"Activity"})]}):null,E.jsxs("a",{href:"/settings",className:"user-auth-menu-link",role:"menuitem",onClick:p=>{p.preventDefault(),u(!1),i()},children:[E.jsx(Nb,{size:15}),E.jsx("span",{children:"Settings"})]})]}):null]})}function G_(e){const t=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e?.trim()??"");return t?[Number.parseInt(t[1],10),Number.parseInt(t[2],10),Number.parseInt(t[3],10)]:null}function L$(e,t){const a=G_(e),i=G_(t);if(!a||!i)return!1;for(let s=0;s<i.length;s+=1){if(i[s]>a[s])return!0;if(i[s]<a[s])return!1}return!1}function qI(e){const t=e?.toLowerCase()??"";return t==="darwin"||t.includes("mac")?"mac":t==="linux"||t.includes("linux")?"linux":null}function H$(e){const t=e?.toLowerCase()??"";return t==="arm64"||t==="aarch64"?"arm64":t==="x64"||t==="x86_64"||t==="amd64"?"x64":null}function $$(e,t,a){const i=qI(t),s=H$(a);if(i==="mac"){const u=e.filter(d=>/-mac-.*\.zip$/i.test(d.name));return s==="arm64"?u.find(d=>/-mac-arm64\.zip$/i.test(d.name))??null:s==="x64"?u.find(d=>/-mac-x64\.zip$/i.test(d.name))??u.find(d=>/-mac-universal\.zip$/i.test(d.name))??null:u.find(d=>/-mac-universal\.zip$/i.test(d.name))??u.find(d=>/-mac-arm64\.zip$/i.test(d.name))??u[0]??null}if(i==="linux"){const u=e.filter(d=>/\.AppImage$/i.test(d.name));return s==="arm64"?u.find(d=>/(?:arm64|aarch64).*\.AppImage$/i.test(d.name))??null:s==="x64"?u.find(d=>/(?:x86_64|x64|amd64).*\.AppImage$/i.test(d.name))??u[0]??null:u[0]??null}return null}function q$(e){if(!e.payload||typeof e.payload!="object")return null;const t=e.payload,i=(typeof t.tag_name=="string"?t.tag_name.trim():"").replace(/^v/,"");if(!L$(e.currentVersion,i))return null;const s=typeof t.html_url=="string"?t.html_url:"",d=(Array.isArray(t.assets)?t.assets:[]).flatMap(b=>{if(!b||typeof b!="object")return[];const p=b;return typeof p.name!="string"||typeof p.browser_download_url!="string"?[]:[{name:p.name,downloadUrl:p.browser_download_url}]}),f=$$(d,e.platform,e.arch);return!f||!s?null:{version:i,releaseUrl:s,assetName:f.name,downloadUrl:f.downloadUrl}}const B$=3600*1e3,V$="https://api.github.com/repos/openpond/openpond/releases/latest";function F$(e){const[t,a]=_.useState({status:"idle",update:null,lastCheckedAt:null}),i=e.currentVersion?.trim()??"",s=e.platform??"",u=e.arch??"",d=e.enabled&&!!i&&!!qI(s);return _.useEffect(()=>{if(!d){a({status:"idle",update:null,lastCheckedAt:null});return}let f=!1;async function b(){a(y=>({...y,status:y.update?"available":"checking"}));try{const y=await fetch(V$,{headers:{Accept:"application/vnd.github+json"}});if(!y.ok)throw new Error(`GitHub release check failed: ${y.status}`);const k=await y.json(),w=q$({payload:k,currentVersion:i,platform:s,arch:u});if(f)return;a({status:w?"available":"current",update:w,lastCheckedAt:Date.now()})}catch{if(f)return;a(y=>({status:y.update?"available":"error",update:y.update,lastCheckedAt:Date.now()}))}}b();const p=window.setInterval(()=>{b()},B$);return()=>{f=!0,window.clearInterval(p)}},[u,i,d,s]),t}const BI="openpond.sidebar.continuous-learning.dismissed.v1";function K$(e=VI()){if(!e)return!1;try{return e.getItem(BI)==="true"}catch{return!1}}function G$(e=VI()){if(e)try{e.setItem(BI,"true")}catch{}}function VI(){return typeof window>"u"?null:window.localStorage}function Z$({connection:e,onOpenSettings:t}){const[a,i]=_.useState(null),[s,u]=_.useState(null),[d,f]=_.useState(K$),b=_.useCallback(async()=>{if(!e){i(null);return}try{i(await de.harnessHistory(e))}catch{i(null)}},[e]);if(_.useEffect(()=>{b()},[b]),d||!e||!a?.workspace)return null;const p=a.evaluationReviewSchedule;return E.jsxs("section",{className:"sidebar-learning-notice","aria-label":"Continuous learning",children:[E.jsxs("header",{children:[E.jsx("strong",{children:"Continuous learning"}),E.jsxs("div",{className:"sidebar-learning-notice-actions",children:[E.jsx("button",{className:"sidebar-learning-notice-action","aria-label":"Open Continuous learning settings",onClick:t,type:"button",children:E.jsx(Nb,{size:14})}),E.jsx("button",{className:"sidebar-learning-notice-action","aria-label":"Close continuous learning",onClick:()=>{f(!0),G$()},type:"button",children:E.jsx(Hf,{size:14})})]})]}),E.jsxs("label",{className:"sidebar-learning-control",children:[E.jsx("strong",{children:"Refiner"}),E.jsxs("span",{className:"sidebar-learning-toggle",children:[E.jsx("input",{checked:a.backgroundReview.enabled,disabled:s!==null,onChange:y=>{const k=y.target.checked;u("refiner"),de.updateHarnessBackgroundReview(e,{workspaceId:a.workspace.id,enabled:k}).then(w=>i(w.history)).finally(()=>u(null))},type:"checkbox"}),E.jsx("span",{"aria-hidden":"true"})]})]}),E.jsxs("label",{className:"sidebar-learning-control",children:[E.jsx("strong",{children:"RL review"}),E.jsxs("span",{className:"sidebar-learning-toggle",children:[E.jsx("input",{checked:p.enabled,disabled:s!==null,onChange:y=>{const k=y.target.checked,w=k&&p.cadence==="manual"?"daily":p.cadence;u("review"),de.updateHarnessEvaluationReviewSchedule(e,{workspaceId:a.workspace.id,enabled:k,cadence:w,maxEstimatedCostUsd:p.maxEstimatedCostUsd}).then(T=>i(T.history)).finally(()=>u(null))},type:"checkbox"}),E.jsx("span",{"aria-hidden":"true"})]})]})]})}function W$(e){const{beginNewChat:t,arch:a,currentVersion:i,experience:s,productArea:u,onProductAreaChange:d,onSidebarResizeStart:f,platform:b,setSectionMenuOpen:p,setSelectedAppId:y,setSelectedProjectId:k,setSelectedSessionId:w,setSidebarOpen:T,setSettingsSection:A,setView:H,view:W}=e,B=F$({currentVersion:i,platform:b,arch:a,enabled:$f()}),M=B.status==="available"?B.update:null;return E.jsxs("aside",{className:"sidebar",children:[E.jsxs("div",{className:"sidebar-toolbar",children:[E.jsx("button",{className:"sidebar-icon","aria-label":"Hide sidebar",onClick:()=>T(!1),children:E.jsx(RI,{size:16})}),E.jsx(N$,{value:u,onChange:d}),M&&E.jsxs("button",{type:"button",className:"sidebar-update-pill",title:`Download OpenPond ${M.version}: ${M.assetName}`,"aria-label":`Download OpenPond ${M.version}`,onClick:()=>{Y$(M.downloadUrl)},children:[E.jsx(Y6,{size:14}),E.jsx("span",{children:"Update"})]})]}),E.jsx(zH,{productArea:u,experience:s,beginNewChat:t,setSectionMenuOpen:p,setSelectedAppId:y,setSelectedProjectId:k,setSelectedSessionId:w,setView:H,view:W}),u==="models"?null:E.jsx(M$,{...e}),E.jsxs("div",{className:"sidebar-bottom-stack",children:[u==="models"?null:E.jsx(Z$,{connection:e.connection,onOpenSettings:()=>{p(null),A("harness"),H("settings")}}),E.jsxs("div",{className:"sidebar-footer-row",children:[E.jsx(U$,{account:e.account,onOpenApps:u==="development"||u==="chat"?()=>{p(null),y(null),k(null),w(null),H("apps")}:void 0,onOpenActivity:()=>{p(null),A("usage"),H("settings")},onOpenSettings:()=>{p(null),A("account"),H("settings")}}),E.jsx(DH,{setSectionMenuOpen:p,setSelectedAppId:y,setSelectedProjectId:k,setSelectedSessionId:w,setView:H,view:W})]})]}),E.jsx("div",{className:"sidebar-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",onPointerDown:f})]})}async function Y$(e){const t=window.openpond?.browser;t?.openExternal&&(await t.openExternal({conversationId:"openpond-update",url:e})).ok||window.open(e,"_blank","noopener,noreferrer")}const J$=[/^(?:(?:type)?error:\s*)?failed to fetch\.?$/i,/^networkerror when attempting to fetch resource\.?$/i,/^load failed\.?$/i];function FI(e,t="Something went wrong."){const i=(e instanceof Error?e.message:String(e??"")).trim();return i?KI(i)?"Couldn’t connect to OpenPond.":i:t}function KI(e){const t=e.trim();return J$.some(a=>a.test(t))}const GI=_.createContext(null);function Z_({children:e,showToast:t}){return E.jsx(GI.Provider,{value:t,children:e})}function X$(){return _.useContext(GI)}function W_(e,t={}){const a=X$(),i=_.useRef(null),s=t.enabled??!0,u=t.fallback??"Something went wrong.",d=t.prefix?.trim()??"",f=e==null||e===""?null:`${d}${d?": ":""}${FI(e,u)}`;_.useEffect(()=>{if(!s||!f){i.current=null;return}i.current!==f&&(i.current=f,a?.(f,"error",{dismissible:!0}))},[s,f,a])}function Q$({state:e,onClose:t,onOpenBrowserUrl:a,onStart:i}){if(W_(e?.previewError,{prefix:"Upload preview"}),W_(e?.error,{prefix:"Cloud setup"}),!e)return null;const s=e.status==="uploading",u=e.status==="ready",d=e.status==="error",f=e.projectKind==="cloud",b=e.preview??null;return E.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:E.jsxs("section",{className:"git-dialog cloud-setup-dialog",role:"dialog","aria-modal":"true","aria-label":"Set up Cloud coding",children:[E.jsx("button",{className:"git-dialog-close",disabled:s,type:"button",onClick:t,"aria-label":"Close Cloud setup",title:"Close",children:E.jsx(Hf,{size:14})}),E.jsx("div",{className:"git-dialog-icon",children:u?E.jsx(B6,{size:18}):E.jsx(CI,{size:18})}),E.jsx("h2",{children:u?"Cloud repo ready":"Set up Cloud coding"}),E.jsx("p",{children:u?"Your source is ready in OpenPond Git. Finish by creating the Cloud sandbox environment.":f?"This Cloud Project is ready for a sandbox environment.":"OpenPond will upload tracked and unignored files into OpenPond Git, then send you to the Cloud sandbox setup page."}),E.jsxs("div",{className:"cloud-setup-summary",children:[E.jsxs("div",{className:"git-dialog-row",children:[E.jsx("span",{children:"Project"}),E.jsx("strong",{children:e.projectName})]}),E.jsxs("div",{className:"git-dialog-row",children:[E.jsx("span",{children:"Source"}),E.jsx("strong",{children:f?"OpenPond Git":"Local project upload"})]}),E.jsxs("div",{className:"git-dialog-row",children:[E.jsx("span",{children:"Branch"}),E.jsx("strong",{children:b?.branch??e.branch??"main"})]}),!f&&E.jsxs("div",{className:"git-dialog-row",children:[E.jsx("span",{children:"Cloud project"}),E.jsx("strong",{children:b?.targetProjectId??e.cloudProjectId??"New on upload"})]})]}),!u&&!f&&E.jsx("div",{className:"cloud-setup-upload-preview",role:"status","aria-live":"polite",children:e.previewLoading?E.jsxs(E.Fragment,{children:[E.jsx("strong",{children:"Calculating upload preview"}),E.jsx("span",{children:"Checking tracked and unignored files before anything is pushed."})]}):e.previewError?E.jsxs(E.Fragment,{children:[E.jsx("strong",{children:"Preview unavailable"}),E.jsx("span",{children:"Close and reopen setup to try the preview again."})]}):b?E.jsxs(E.Fragment,{children:[E.jsx("strong",{children:b.initializedEmptyProject?"Will initialize an empty project":`Will upload ${b.fileCount} files`}),E.jsx("span",{children:Y_({byteCount:b.byteCount,skippedCount:b.skippedCount,headCommit:b.headCommit,targetProjectName:b.targetProjectName})})]}):E.jsxs(E.Fragment,{children:[E.jsx("strong",{children:"Upload preview pending"}),E.jsx("span",{children:"File count, byte count, and skipped files will appear here before upload."})]})}),s&&E.jsxs("div",{className:"cloud-setup-progress",role:"status","aria-live":"polite",children:[E.jsx(sH,{className:"cloud-setup-spinner",size:16}),E.jsx("span",{children:"Uploading source to OpenPond Git..."})]}),u&&e.upload&&E.jsxs("div",{className:"cloud-setup-upload-result",children:[E.jsx("strong",{children:e.upload.initializedEmptyProject?"Initialized empty project":`Uploaded ${e.upload.fileCount} files`}),E.jsx("span",{children:Y_({byteCount:e.upload.byteCount,skippedCount:e.upload.skippedCount,headCommit:e.upload.headCommit,targetProjectName:e.upload.branch})})]}),u&&e.setupUrl&&E.jsxs("div",{className:"cloud-setup-next",children:[e.projectUrl?E.jsxs("span",{children:["Your repo is ready here:"," ",E.jsxs("a",{href:e.projectUrl,target:"_blank",rel:"noreferrer",onClick:p=>kg(p,e.projectUrl,a,{newTab:!0}),children:["Project page",E.jsx(vg,{size:13})]})]}):E.jsx("span",{children:"Your repo is ready. Next step:"}),E.jsxs("a",{href:e.setupUrl,target:"_blank",rel:"noreferrer",onClick:p=>kg(p,e.setupUrl,a),children:["Setup the Cloud sandbox",E.jsx(vg,{size:13})]})]}),E.jsxs("div",{className:"git-dialog-footer",children:[E.jsx("button",{className:"git-dialog-secondary",disabled:s,type:"button",onClick:t,children:u?"Done":"Cancel"}),u?e.setupUrl?E.jsxs("a",{className:"git-dialog-primary cloud-setup-primary-link",href:e.setupUrl,target:"_blank",rel:"noreferrer",onClick:p=>kg(p,e.setupUrl,a),children:["Open setup",E.jsx(vg,{size:13})]}):null:E.jsx("button",{className:"git-dialog-primary",disabled:s,type:"button",onClick:i,children:s?"Uploading":d?"Try again":f?"Show setup link":"Upload source"})]})]})})}function kg(e,t,a,i={}){!t||!a||(e.preventDefault(),a(t,i))}function eq(e){return!Number.isFinite(e)||e<=0?"0 B":e<1024?`${Math.round(e)} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Y_({byteCount:e,skippedCount:t,headCommit:a,targetProjectName:i}){const s=[eq(e),`${t} skipped`],u=tq(a);return u&&s.push(`local ${u}`),s.push(i),s.join(" · ")}function tq(e){const t=e?.trim();return t?t.slice(0,7):null}const nq=_.lazy(()=>Al(()=>import("./CommandMenu-CQcaEB76.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).then(e=>({default:e.CommandMenu}))),aq=_.lazy(()=>Al(()=>import("./SettingsView-CTLTakyn.js"),__vite__mapDeps([4,5,6,7,8,9,10,11,12,13,14,15,16,2,17,18,19,20,1,21,22,23]),import.meta.url).then(e=>({default:e.SettingsView}))),oq=_.lazy(()=>Al(()=>import("./NewProjectDialog-B-1KuU5u.js"),__vite__mapDeps([24,8,18]),import.meta.url).then(e=>({default:e.NewProjectDialog}))),iq=_.lazy(()=>Al(()=>import("./WorkspaceGitDialogs-BvurXjNP.js"),__vite__mapDeps([25,14,26,16,27,23]),import.meta.url).then(e=>({default:e.CommitDialog}))),rq=_.lazy(()=>Al(()=>import("./WorkspaceGitDialogs-BvurXjNP.js"),__vite__mapDeps([25,14,26,16,27,23]),import.meta.url).then(e=>({default:e.BranchDialog})));function sq({payload:e,connection:t,diagnostics:a,initialSection:i,onPayload:s,onError:u,onToast:d,onBack:f,onOpenSourceSession:b,onAcceptEvaluationReview:p,onOpenSkill:y,onOpenExtension:k,teamChatCurrentUserId:w,teamChatEnabled:T,teamChatNotificationMode:A,teamChatThreads:H,onTeamChatNotificationModeChange:W,onTeamChatThreadMuteChange:B,diffPanelWidth:M,diffPanelResizing:j,diffPanelExpanded:L,onDiffPanelResizeStart:D,onDiffPanelExpandedChange:q}){return E.jsx(_.Suspense,{fallback:null,children:E.jsx(aq,{payload:e,connection:t,diagnostics:a,initialSection:i,onPayload:s,onError:u,onToast:d,onBack:f,onOpenSourceSession:b,onAcceptEvaluationReview:p,onOpenSkill:y,onOpenExtension:k,teamChatCurrentUserId:w,teamChatEnabled:T,teamChatNotificationMode:A,teamChatThreads:H,onTeamChatNotificationModeChange:W,onTeamChatThreadMuteChange:B,diffPanelWidth:M,diffPanelResizing:j,diffPanelExpanded:L,onDiffPanelResizeStart:D,onDiffPanelExpandedChange:q})})}function lq({activeSessions:e,branchDialogName:t,branchDialogOpen:a,commitDialogOpen:i,commitDraft:s,commitIncludeUnstaged:u,commitMessage:d,commitNextStep:f,canPublishOpenPondProject:b,expandProject:p,newProjectBusy:y,newProjectDialogOpen:k,newProjectDirectory:w,newProjectMode:T,newProjectName:A,newProjectPath:H,projectRows:W,query:B,searchOpen:M,visibleWorkspaceDiff:j,visibleWorkspaceState:L,workspaceBusy:D,appDispatch:q,beginNewChat:$,openDefaultsSettingsFromBranchDialog:X,setBranchDialogName:ae,setBranchDialogOpen:ie,setCommitDialogOpen:ue,setCommitDraft:ge,setCommitIncludeUnstaged:Te,setCommitMessage:Be,setCommitNextStep:Pe,setNewProjectDialogOpen:U,setNewProjectName:le,setNewProjectPath:he,setQuery:Me,setSearchOpen:Ue,submitCommitDialog:O,submitCreateWorkspaceBranch:Z,submitNewProjectDialog:be}){return E.jsxs(E.Fragment,{children:[M&&E.jsx(_.Suspense,{fallback:null,children:E.jsx(nq,{open:M,query:B,projects:W,sessions:e,onQueryChange:Me,onClose:()=>{Ue(!1),Me("")},onNewChat:()=>{Ue(!1),Me(""),$()},onOpenProject:ve=>{q({type:"selectProject",projectId:ve.id}),q({type:"patch",patch:{searchOpen:!1,query:""}}),p(ve.id)},onOpenSession:ve=>{q({type:"selectSession",sessionId:ve.id,appId:ve.appId,projectId:ve.workspaceKind==="local_project"&&ve.workspaceId?Dt("local",ve.workspaceId):null}),q({type:"patch",patch:{searchOpen:!1,query:""}})}})}),k&&E.jsx(_.Suspense,{fallback:null,children:E.jsx(oq,{open:k,mode:T,name:A,path:H,directory:w,busy:y,onNameChange:le,onPathChange:he,onClose:()=>{y||U(!1)},onSubmit:be})}),i&&E.jsx(_.Suspense,{fallback:null,children:E.jsx(iq,{open:i,branch:L?.currentBranch??null,filesChanged:j?.filesChanged??L?.changedFilesCount??0,additions:j?.additions??0,deletions:j?.deletions??0,message:d,includeUnstaged:u,nextStep:f,draft:s,busy:D,canPush:!!L?.remoteUrl,canPublish:b,onMessageChange:Be,onIncludeUnstagedChange:Te,onNextStepChange:Pe,onDraftChange:ge,onClose:()=>{D||ue(!1)},onSubmit:O})}),a&&E.jsx(_.Suspense,{fallback:null,children:E.jsx(rq,{open:a,branchName:t,busy:D,onBranchNameChange:ae,onSetPrefix:X,onClose:()=>{D||ie(!1)},onSubmit:Z})})]})}function ZI({toast:e,onDismiss:t}){if(!e)return null;const a=!!(e.actionLabel&&e.onAction),i=!!(e.persistent||e.dismissible);return E.jsxs("div",{className:`app-toast ${e.tone} ${e.placement??"bottom-right"}`,role:e.tone==="error"?"alert":"status","aria-live":"polite",children:[E.jsx("span",{className:"app-toast-message",children:e.message}),(a||i)&&E.jsxs("div",{className:"app-toast-actions",children:[a&&E.jsx("button",{type:"button",className:e.actionIcon?"app-toast-icon-action":void 0,"aria-label":e.actionLabel,title:e.actionIcon?e.actionLabel:void 0,onClick:()=>{t(),e.onAction?.()},children:e.actionIcon==="settings"?E.jsx(Nb,{size:15}):e.actionLabel}),i&&E.jsx("button",{type:"button",className:"app-toast-close","aria-label":"Dismiss notification",onClick:t,children:E.jsx(Hf,{size:14})})]})]})}async function cq(e){if(!e)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch(t){console.warn("Clipboard write failed",t)}try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-1000px",t.style.top="-1000px",document.body.appendChild(t),t.select();const a=document.execCommand("copy");return t.remove(),a}catch(t){return console.warn("Clipboard fallback failed",t),!1}}function uq({activeView:e,onDiscoverCommunities:t,onOpenTeamChat:a}){return E.jsxs("div",{className:"titlebar-collaboration-actions",children:[E.jsx("button",{type:"button",className:`titlebar-icon${e==="team"?" active":""}`,"aria-label":"Team chat",title:"Team chat",onClick:a,children:E.jsx(jb,{size:16})}),E.jsx("button",{type:"button",className:`titlebar-icon${e==="community"?" active":""}`,"aria-label":"Discover communities",title:"Discover communities",onClick:t,children:E.jsx(AI,{size:16})})]})}const dq=_.lazy(()=>Al(()=>import("./WorkspaceEnvironmentMenu-C3s3mTyu.js"),__vite__mapDeps([28,26,21,29,11,15,16,5,27,30]),import.meta.url).then(e=>({default:e.WorkspaceEnvironmentMenu})));function mq({sidebarOpen:e,title:t,conversationId:a,breadcrumbs:i,backAction:s,workspaceName:u,workspaceId:d,busy:f,workspaceState:b,workspaceKind:p,selectedApp:y,selectedProject:k,workspaceDiff:w,managedWorkspace:T,workspaceBusy:A,defaultTeamId:H,showDiffControls:W,diffPanelOpen:B,terminalOpen:M,rightSidebarAvailable:j=!1,rightSidebarOpen:L=!1,onToggleDiffPanel:D,onToggleRightSidebar:q,onOpenSearch:$,onToggleTerminal:X,onRunTerminalCommand:ae,onWorkspaceToolAction:ie,onOpenCommitDialog:ue,onWorkspaceBranchChange:ge,onWorkspaceBranchCreate:Te,connection:Be,onBootstrap:Pe,onOpenSandboxWorkspace:U,onShowSidebar:le,onOpenTeamChat:he,onDiscoverCommunities:Me,collaborationView:Ue=null,platform:O,showWorkspaceControls:Z=!0}){const be=w?.filesChanged??0,ve=$f()&&!zb(O),fe=!!(he||Me)||Z||j||ve,[ee,Ce]=_.useState(null);_.useEffect(()=>{if(!ee)return;const We=()=>Ce(null);return window.addEventListener("pointerdown",We),window.addEventListener("blur",We),window.addEventListener("resize",We),()=>{window.removeEventListener("pointerdown",We),window.removeEventListener("blur",We),window.removeEventListener("resize",We)}},[ee]);const je=We=>{We.preventDefault(),We.stopPropagation();const Ve=190,lt=a?76:42;Ce({x:Math.min(We.clientX,window.innerWidth-Ve-8),y:Math.min(We.clientY,window.innerHeight-lt-8)})},et=We=>{cq(We),Ce(null)};return E.jsxs("header",{className:"app-titlebar",children:[E.jsxs("div",{className:"titlebar-left",children:[!e&&E.jsx("button",{className:"titlebar-icon",title:"Show sidebar",onClick:le,children:E.jsx(RI,{size:16})}),s?E.jsx("button",{className:"titlebar-icon",type:"button","aria-label":s.label,title:s.label,onClick:s.onSelect,children:E.jsx(E6,{size:16})}):null,i?.length?E.jsx("nav",{className:"titlebar-breadcrumbs","aria-label":"Breadcrumb",children:i.map((We,Ve)=>{const lt=Ve===i.length-1;return E.jsxs("div",{className:"titlebar-breadcrumb-item",children:[We.onSelect&&!lt?E.jsx("button",{type:"button",onClick:We.onSelect,children:We.label}):E.jsx("strong",{children:We.label}),!lt&&E.jsx(id,{size:14})]},`${We.label}-${Ve}`)})}):E.jsxs("div",{className:"titlebar-title",children:[E.jsx("strong",{className:"titlebar-copy-target",title:"Double-click to select; right-click for copy options",onContextMenu:je,children:t}),u&&E.jsx("span",{children:u})]})]}),fe&&E.jsxs("div",{className:"titlebar-right",children:[E.jsx(uq,{activeView:Ue,onDiscoverCommunities:Me,onOpenTeamChat:he}),Z&&E.jsxs("div",{className:"titlebar-actions",children:[E.jsx(_.Suspense,{fallback:null,children:E.jsx(dq,{mode:"topbar",busy:f,workspaceState:b,workspaceId:d,workspaceKind:p,selectedApp:y,selectedProject:k,workspaceBusy:A,defaultTeamId:H,workspaceDiff:w,managedWorkspace:T,showDiffControls:W,diffPanelOpen:B,onToggleDiffPanel:D,onRunTerminalCommand:ae,onWorkspaceToolAction:ie,onOpenCommitDialog:ue,onWorkspaceBranchChange:ge,onWorkspaceBranchCreate:Te,connection:Be,onBootstrap:Pe,onOpenSandboxWorkspace:U})}),E.jsx("button",{type:"button",className:"titlebar-icon",title:"Search chats and projects","aria-label":"Search chats and projects",onClick:$,children:E.jsx(wH,{size:16})}),E.jsx("button",{type:"button",className:`titlebar-icon ${M?"active":""}`,title:`${M?"Hide":"Show"} terminal`,"aria-label":`${M?"Hide":"Show"} terminal`,"aria-pressed":M,onClick:X,children:E.jsx(TI,{size:16})}),W&&E.jsx("button",{type:"button",className:`topbar-diff-button ${L?"active":""}`,title:`${L?"Hide":"Show"} sidebar${be?`, ${be} changed files`:""}`,"aria-label":`${L?"Hide":"Show"} sidebar`,"aria-pressed":L,onClick:D,children:E.jsx(pv,{size:16})})]}),j&&q&&!W?E.jsx("div",{className:"titlebar-actions",children:E.jsx("button",{type:"button",className:`topbar-diff-button ${L?"active":""}`,title:`${L?"Hide":"Show"} sidebar`,"aria-label":`${L?"Hide":"Show"} sidebar`,"aria-pressed":L,onClick:q,children:E.jsx(pv,{size:16})})}):null,E.jsx(EH,{platform:O})]}),ee&&E.jsxs("div",{className:"titlebar-copy-menu",role:"menu","aria-label":"Conversation title actions",style:{left:ee.x,top:ee.y},onPointerDown:We=>We.stopPropagation(),children:[E.jsx("button",{type:"button",role:"menuitem",onClick:()=>et(t),children:"Copy title"}),a&&E.jsx("button",{type:"button",role:"menuitem",onClick:()=>et(a),children:"Copy conversation ID"})]})]})}function fq(){const[e,t]=_.useState(null),a=_.useRef(null),i=_.useCallback(u=>new Promise(d=>{a.current?.resolve(!1);const f={...u,cancelLabel:u.cancelLabel??"Cancel",tone:u.tone??"default",resolve:d};a.current=f,t(f)}),[]),s=_.useCallback(u=>{const d=a.current;a.current=null,t(null),d?.resolve(u)},[]);return{confirmAction:i,confirmDialog:e,resolveConfirmDialog:s}}function pq({state:e,onResolve:t}){const a=_.useId(),i=_.useId();if(_.useEffect(()=>{if(!e)return;function u(d){d.key==="Escape"&&t(!1)}return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[t,e]),!e)return null;const s=e.tone==="danger"?"git-dialog-primary danger":"git-dialog-primary";return E.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:()=>t(!1),children:E.jsxs("section",{className:"git-dialog project-confirm-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":a,"aria-describedby":i,onMouseDown:u=>u.stopPropagation(),children:[E.jsx("h2",{id:a,children:e.title}),E.jsx("p",{id:i,children:e.body}),E.jsxs("div",{className:"git-dialog-footer",children:[E.jsx("button",{type:"button",className:"git-dialog-secondary",onClick:()=>t(!1),children:e.cancelLabel}),E.jsx("button",{type:"button",className:s,autoFocus:!0,onClick:()=>t(!0),children:e.confirmLabel})]})]})})}function hq(){const{confirmAction:e,confirmDialog:t,resolveConfirmDialog:a}=fq();return{confirmProjectAction:_.useCallback(s=>e({tone:"danger",...s}),[e]),projectConfirmDialog:t,resolveProjectConfirmDialog:a}}function gq({state:e,onResolve:t}){return E.jsx(pq,{state:e,onResolve:t})}const ff=new Map,vq=(e,t,a)=>{const i=ff.get(e)??{commits:0,maxActualDurationMs:0,totalActualDurationMs:0};i.commits+=1,i.maxActualDurationMs=Math.max(i.maxActualDurationMs,a),i.totalActualDurationMs+=a,ff.set(e,i)};function bq({children:e,id:t}){return E.jsx(_.Profiler,{id:t,onRender:vq,children:e})}typeof window<"u"&&(window.__OPENPOND_RENDER_COMMITS__={get:()=>Object.fromEntries([...ff.entries()].map(([e,t])=>[e,{...t}])),reset:()=>ff.clear()});const yq=_.lazy(()=>Al(()=>import("./MainPane-CNoHJkXy.js").then(e=>e.M),__vite__mapDeps([31,14,1,32,6,29,8,33]),import.meta.url).then(e=>({default:e.MainPane})));function Sq({className:e,style:t,sidebar:a,topBar:i,mainPane:s,cloudSetup:u,projectConfirm:d,lazyPanels:f,toast:b}){return E.jsxs("div",{className:e,style:t,children:[E.jsx(bq,{id:"sidebar",children:E.jsx(W$,{...a})}),E.jsxs("div",{className:"content-shell",children:[E.jsx(mq,{...i}),E.jsx(_.Suspense,{fallback:E.jsx("main",{className:"main-pane","aria-busy":"true","aria-label":"Loading workspace"}),children:E.jsx(yq,{...s})})]}),E.jsx(Q$,{...u}),E.jsx(gq,{...d}),E.jsx(lq,{...f}),E.jsx(ZI,{...b})]})}function _q({settings:e,toast:t}){return E.jsxs(E.Fragment,{children:[E.jsx(sq,{...e}),E.jsx(ZI,{...t})]})}const Wm="OpenPond".split("");function xq({visibleLetterCount:e=Wm.length}){const t=Wm.slice(0,Math.max(0,Math.min(e,Wm.length)));return E.jsxs("div",{className:"app-splash-lockup",children:[E.jsx("div",{className:"app-splash-mark",children:E.jsx("img",{alt:"OpenPond",className:"app-splash-logo",decoding:"async",src:O$})}),E.jsx("span",{"aria-hidden":"true",className:`app-splash-wordmark${t.length>0?" is-visible":""}`,children:t.map((a,i)=>E.jsx("span",{className:"app-splash-letter",children:a},`${a}-${i}`))})]})}const wg=Wm.length,kq=520,wq=240;function J_(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Cq({startup:e}){const[t,a]=_.useState(()=>J_()?wg:0);return _.useEffect(()=>{if(J_()){a(wg);return}const i=Array.from({length:wg},(s,u)=>window.setTimeout(()=>a(u+1),kq+wq*u));return()=>{i.forEach(s=>window.clearTimeout(s))}},[]),E.jsxs("main",{className:"app-splash","aria-busy":"true","aria-label":e.label,role:"status",children:[E.jsx(xq,{visibleLetterCount:t}),E.jsx("span",{className:"app-splash-status",children:e.label})]})}const WI=5e3;function Bi(e,t){if(e.length===0)return t;if(t.length===0)return e;const a=new Set,i=[];for(const s of[...e,...t])a.has(s.id)||(a.add(s.id),i.push(s));return i}function _l(e,t,a=WI){return pf(Bi(e,t),a)}function pf(e,t=WI){return e.length<=t?e:e.slice(e.length-t)}function Iq(e,t,a){return a.length===0?e:{...e,[t]:Bi(e[t]??[],a)}}function Aq(e,t){if(t.length===0)return pf(e);if(e.length===0)return pf(t);const a=new Set(e.map(d=>d.id)),i=$b(e),s=Tq(e),u=t.filter(d=>{if(a.has(d.id))return!1;if(typeof d.sequence=="number")return i===null||d.sequence>i;const f=Date.parse(d.timestamp);return Number.isFinite(f)&&s!==null?f>=s:!0});return _l(e,u)}function $b(e){let t=null;for(const a of e)typeof a.sequence=="number"&&(t=t===null?a.sequence:Math.max(t,a.sequence));return t}function Rq(e){let t=null;for(const a of e)a.sequence!==void 0&&(t===null||a.sequence<t)&&(t=a.sequence);return t}function Tq(e){let t=null;for(const a of e){const i=Date.parse(a.timestamp);Number.isFinite(i)&&(t=t===null?i:Math.max(t,i))}return t}const Eq="codex_history_";function _n(e){return!!e?.startsWith(Eq)}function YI(e){const t=[],a=new Set;for(const i of e)for(const s of[i.workspacePath,i.path]){const u=Bf(s);if(!u)continue;const d=`${i.id}:${u}`;a.has(d)||(a.add(d),t.push({projectId:i.id,path:u}))}return t.sort((i,s)=>s.path.length-i.path.length)}function Mq(e,t,a,i=new Set){if(e.localProjectId&&t.has(e.localProjectId))return e.localProjectId;if(e.workspaceKind==="local_project"&&e.workspaceId&&t.has(e.workspaceId))return e.workspaceId;if(e.metadata?.workspaceTarget==="hybrid"&&e.cwd){const u=JI(e.cwd,a);if(u)return u}if(e.cloudProjectId&&i.has(e.cloudProjectId))return e.cloudProjectId;if(!e.cwd||e.workspaceKind==="sandbox"||e.workspaceKind==="sandbox_template"||e.workspaceKind==="sandbox_app"||!XI(e))return null;const s=Bf(e.cwd);if(!s)return null;for(const u of a)if(qb(s,u.path))return u.projectId;return null}function X_(e,t,a,i=new Set){if(e.localProjectId&&t.has(e.localProjectId))return Dt("local",e.localProjectId);if(e.workspaceKind==="local_project"&&e.workspaceId&&t.has(e.workspaceId))return Dt("local",e.workspaceId);if(e.metadata?.workspaceTarget==="hybrid"&&e.cwd){const u=JI(e.cwd,a);if(u)return Dt("local",u)}if(e.cloudProjectId&&i.has(e.cloudProjectId))return Dt("cloud",e.cloudProjectId);if(!e.cwd||e.workspaceKind==="sandbox"||e.workspaceKind==="sandbox_template"||e.workspaceKind==="sandbox_app"||!XI(e))return null;const s=Bf(e.cwd);if(!s)return null;for(const u of a)if(qb(s,u.path))return Dt("local",u.projectId);return null}function JI(e,t){const a=Bf(e);if(!a)return null;for(const i of t)if(qb(a,i.path))return i.projectId;return null}function XI(e){return e.workspaceKind==="local_project"||e.provider==="codex"||_n(e.id)}function Bf(e){const t=e?.trim();if(!t)return null;let a=t.replace(/^file:\/\/+/i,"/").replace(/\\/g,"/").replace(/\/+/g,"/");return/^[a-z]:/i.test(a)&&(a=a[0].toUpperCase()+a.slice(1)),a=a.replace(/\/+$/g,""),a||"/"}function qb(e,t){const a=Q_(e),i=Q_(t);return a===i||a.startsWith(`${i}/`)}function Q_(e){return/^[A-Z]:\//.test(e)?e.toLowerCase():e}function ex(e){if(e<1e3)return String(e);const t=e/1e3;return t>=10||Number.isInteger(t)?`${Math.round(t)}k`:`${t.toFixed(1)}k`}function Pq(e){return e===null?"unknown":e>=85?"high":e>=65?"medium":"low"}function tx(e,t){const a=e?.triggerPercent??85;return e?.autoEnabled===!1?t>=a?"Auto compaction is off. Start a new chat or turn it on before the provider limit is reached.":"Auto compaction is off.":`Auto compacts at ${a}% context when supported.`}function Oq(e){return e==="codex"}function jq(e){return e==="openpond"}function QI(e){for(let t=e.length-1;t>=0;t-=1){const a=e[t];if(a?.name!=="session.context.updated")continue;const i=KN.safeParse(a.data);if(i.success)return i.data}return null}function eA(e){if(e.snapshot&&e.snapshot.provider===e.provider){const a=e.snapshot.usedTokens,i=e.snapshot.maxContextTokens,s=Math.min(100,Math.round(e.snapshot.percentFull)),u=`${s}% full`,d=`${ex(a)} / ${ex(i)} tokens used`;return{usedTokens:a,maxTokens:i,percent:s,summary:u,tokensLabel:d,detail:tx(e.preferences,s),tooltip:`Context window: ${u} ${d}. ${tx(e.preferences,s)}`,tone:Pq(s)}}if(Oq(e.provider)){const a="Context is managed by Codex app-server.";return{usedTokens:0,maxTokens:null,percent:null,summary:"Managed externally",tokensLabel:"Codex app-server",detail:a,tooltip:`Context window: ${a}`,tone:"unknown"}}if(!jq(e.provider)){const a="Context pressure is unavailable until this provider has model context metadata.";return{usedTokens:0,maxTokens:null,percent:null,summary:"Limit unknown",tokensLabel:"Provider metadata unavailable",detail:a,tooltip:`Context window: ${a}`,tone:"unknown"}}const t="Send a message to measure hosted context.";return{usedTokens:0,maxTokens:null,percent:null,summary:"Not measured yet",tokensLabel:"Hosted context",detail:t,tooltip:`Context window: ${t}`,tone:"unknown"}}function Bb(e){let t=!1;const a=tA(e);for(let i=e.length-1;i>=0;i-=1){const s=e[i];if(Nq(s)){t=!0;continue}const u=Hc(s?.data);if(!(s?.name!=="diagnostic"||!u)){if(u.kind==="thread_goal_cleared")return null;if(u.kind==="thread_goal"){const d=Vb(Hc(u.goal),bo(u.provider),a);if(d){const f=ld(d);return t&&f.tone==="active"?null:f}}if(u.kind==="goal_context"){const d=aA(s.output??"",bo(u.provider)??"codex",a);if(d){const f=ld(d);return t&&f.tone==="active"?null:f}}}}return null}function hf(e){const t=tA(e);for(let a=e.length-1;a>=0;a-=1){const i=e[a],s=Hc(i?.data);if(!(i?.name!=="diagnostic"||!s)){if(s.kind==="thread_goal_cleared"&&s.synthetic!==!0)return null;if(s.kind==="thread_goal"){const u=Vb(Hc(s.goal),bo(s.provider),t);if(!u)continue;const d=ld(u);return d.tone==="active"?d:null}if(s.kind==="goal_context"){const u=aA(i.output??"",bo(s.provider)??"codex",t);if(!u)continue;const d=ld(u);return d.tone==="active"?d:null}}}return null}function Cg(e){const t=Hc(Hc(e)?.codexGoalRuntime),a=Vb(t,bo(t?.provider)??"codex");if(!a)return null;const i=ld(a);return i.tone==="active"?i:null}function Nq(e){return e?.name==="turn.completed"||e?.name==="turn.interrupted"||e?.name==="turn.failed"}function ld(e){const t=oA(e.status),a=sA(e.timeUsedSeconds),i=`Goal ${a}`,s=e.tokensUsed===null?null:e.tokenBudget===null?`${Ig(e.tokensUsed)} tokens`:`${Ig(e.tokensUsed)} / ${Ig(e.tokenBudget)} tokens`,u=s?`${e.statusLabel} · ${s}`:e.statusLabel;return{objective:e.objective,status:e.status,timeUsedSeconds:e.timeUsedSeconds,tokensUsed:e.tokensUsed,tokenBudget:e.tokenBudget,actionLabel:t.actionLabel,timeLabel:a,label:i,detail:u,tooltip:`Goal runtime: ${lA(e.timeUsedSeconds)}. ${u}. ${e.objective}`,tone:t.tone,observedAt:e.observedAt}}function zq(e,t){if(!e||e.tone!=="active"||!e.observedAt)return e;const a=nA(e.observedAt,t);if(a<=0)return e;const i=e.timeUsedSeconds+a,s=sA(i);return{...e,timeUsedSeconds:i,timeLabel:s,label:`Goal ${s}`,tooltip:`Goal runtime: ${lA(i)}. ${e.detail}. ${e.objective}`,observedAt:t}}function Vb(e,t=null,a=null){if(!e)return null;const i=bo(e.objective)??"Active goal",s=bo(e.status)??"active";if((bv(t)??bv(bo(e.provider)))!=="codex")return null;const d=a??bo(e.updatedAt)??bo(e.updated_at)??null,f=yc(e.timeUsedSeconds)??yc(e.time_used_seconds)??0,b=bo(e.activeSinceAt)??bo(e.active_since_at),p=oA(s).tone==="active"?nA(b??bo(e.createdAt)??bo(e.created_at),d):0,y=b?f+p:Math.max(f,p),k=yc(e.tokensUsed)??yc(e.tokens_used),w=yc(e.tokenBudget)??yc(e.token_budget);return{objective:i,status:s,statusLabel:rA(s),timeUsedSeconds:Math.max(0,Math.floor(y)),tokensUsed:k===null?null:Math.max(0,Math.floor(k)),tokenBudget:w===null?null:Math.max(0,Math.floor(w)),observedAt:d}}function tA(e){for(let t=e.length-1;t>=0;t-=1){const a=e[t]?.timestamp;if(a&&Number.isFinite(Date.parse(a)))return a}return null}function nA(e,t){if(!e||!t)return 0;const a=Date.parse(e),i=Date.parse(t);return!Number.isFinite(a)||!Number.isFinite(i)||i<=a?0:Math.floor((i-a)/1e3)}function aA(e,t=null,a=null){if(!e.trim()||bv(t)!=="codex")return null;const i=iA(e,"Status")??"active",s=Lu(e,"Tokens used"),u=Lu(e,"Token budget"),d=Lu(e,"Time used seconds")??Lu(e,"Time spent pursuing goal")??Lu(e,"Elapsed seconds")??0;return{objective:nx(e,"objective")??nx(e,"untrusted_objective")??"Active goal",status:i,statusLabel:rA(i),timeUsedSeconds:Math.max(0,Math.floor(d)),tokensUsed:s,tokenBudget:u,observedAt:a}}function oA(e){switch(Dq(e)){case"active":case"running":return{tone:"active",actionLabel:"Pursuing goal"};case"paused":return{tone:"paused",actionLabel:"Goal paused"};case"blocked":return{tone:"limited",actionLabel:"Goal blocked"};case"complete":case"completed":case"achieved":return{tone:"done",actionLabel:"Goal achieved"};case"failed":return{tone:"limited",actionLabel:"Goal failed"};case"cancelled":case"canceled":case"stopped":return{tone:"limited",actionLabel:"Goal cancelled"};case"budget_limited":return{tone:"limited",actionLabel:"Goal budget limited"};default:return{tone:"active",actionLabel:"Goal status unknown"}}}function Dq(e){return e.trim().toLowerCase().replace(/[-\s]+/g,"_")}function iA(e,t){const a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^\\s*-?\\s*${a}:\\s*(.+?)\\s*$`,"im").exec(e)?.[1]?.trim()||null}function Lu(e,t){const a=iA(e,t);if(!a)return null;const i=a.replace(/,/g,""),s=/-?\d+(?:\.\d+)?/.exec(i);if(!s)return null;const u=Number(s[0]);return Number.isFinite(u)?u:null}function nx(e,t){return new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*<\\/${t}>`,"i").exec(e)?.[1]?.trim()||null}function rA(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function sA(e){if(e<60)return`${e}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const a=Math.floor(t/60),i=t%60;return i>0?`${a}h ${i}m`:`${a}h`}function lA(e){if(e<60)return`${e} ${e===1?"second":"seconds"}`;const t=Math.floor(e/60);if(t<60)return`${t} ${t===1?"minute":"minutes"}`;const a=Math.floor(t/60),i=t%60;return i===0?`${a} ${a===1?"hour":"hours"}`:`${a}h ${i}m`}function Ig(e){if(e<1e3)return String(e);if(e>=1e6){const a=e/1e6;return a<10?`${ax(a,2)}M`:a<100?`${ax(a,1)}M`:`${Math.round(a)}M`}const t=e/1e3;return t>=10||Number.isInteger(t)?`${Math.round(t)}k`:`${t.toFixed(1)}k`}function ax(e,t){return e.toFixed(t).replace(/\.?0+$/,"")}function Hc(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function bo(e){return typeof e=="string"&&e.trim()?e.trim():null}function bv(e){return e?.trim().toLowerCase()||null}function yc(e){return typeof e=="number"&&Number.isFinite(e)?e:null}const Uq=new Set(["planning","applying_source","running_checks","evaluating","pushing_hosted","running_hosted_checks"]),Lq=new Set(["awaiting_questions","awaiting_plan_approval","paused"]);function yv(e){const t=cA(e);return t?Bq(t):null}function cA(e){for(let t=e.length-1;t>=0;t-=1){const a=e[t];if(a?.name!=="create_improve.updated")continue;const i=qq(Zq(a.data));if(i)return i}return null}function Hq(e){if(e.events)return cA(e.events);const t=e.messages??[];for(let a=t.length-1;a>=0;a-=1){const i=t[a]?.createImproveRun??null;if(i)return i}return null}function $q(e,t){const a=e?.target.displayName?.trim()??"",i=a.toLowerCase().replace(/[^a-z0-9]+/g," ").trim();return a&&!/^(?:create|creating|improve|improving|new) (?:an )?agent$/.test(i)?a:t}function qq(e){const t=gd.safeParse(e?.createImproveRun);return t.success?t.data:null}function Bq(e){const t=Vq(e);if(!t)return null;const a=Fq(e.createdAt,e.updatedAt),i=e.blockedReason??Kq(e.state);return{objective:e.objective,status:e.state,timeUsedSeconds:a,tokensUsed:null,tokenBudget:null,actionLabel:t.actionLabel,timeLabel:Gq(a),label:t.actionLabel,detail:i,tooltip:`${t.actionLabel}: ${i}. ${e.objective}`,tone:t.tone}}function Vq(e){const t=e.state,a=e.target.kind==="agent"?"Agent":"Work";return Uq.has(t)?{tone:"active",actionLabel:`${a} running`}:Lq.has(t)?{tone:"active",actionLabel:`${a} awaiting input`}:t==="blocked"?{tone:"limited",actionLabel:`${a} blocked`}:t==="failed"?{tone:"limited",actionLabel:`${a} failed`}:t==="cancelled"?{tone:"limited",actionLabel:`${a} cancelled`}:t==="ready"||t==="ready_local"?{tone:"done",actionLabel:e.target.kind==="agent"?"Agent ready":"Workproduct ready"}:t==="published_hosted"?{tone:"done",actionLabel:e.target.kind==="agent"?"Agent published":"Workproduct published"}:null}function Fq(e,t){const a=Date.parse(e),i=Date.parse(t);return!Number.isFinite(a)||!Number.isFinite(i)||i<a?0:Math.floor((i-a)/1e3)}function Kq(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function Gq(e){if(e<60)return`${e}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const a=Math.floor(t/60),i=t%60;return i>0?`${a}h ${i}m`:`${a}h`}function Zq(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function uA(e,t){if(!t)return null;const a=new Map,i=[];for(const L of e){if(!L.name.startsWith("subagent."))continue;const D=Jq(L);D&&i.push(D);const q=Yq(L);q?.parentSessionId===t&&a.set(q.id,q)}if(a.size===0)return null;const s=[...a.values()].sort((L,D)=>kc(D).localeCompare(kc(L))),u=s.filter(L=>L.status==="queued"||L.status==="running"),d=s.filter(L=>L.status==="completed"),f=s.filter(L=>L.status==="failed"),b=s.filter(L=>L.status==="cancelled"),p=s.filter(L=>L.status==="needs_resume"),y=[...d,...f,...b].sort((L,D)=>kc(D).localeCompare(kc(L))),k=s.reduce((L,D)=>{const q=$c(D.metadata?.usage);return L.totalTokens+=Nm(q?.totalTokens),L.promptTokens+=Nm(q?.promptTokens),L.completionTokens+=Nm(q?.completionTokens),L.requestCount+=Nm(q?.requestCount),L},{totalTokens:0,promptTokens:0,completionTokens:0,requestCount:0}),w=s.flatMap(L=>dA([...L.report?.blockers??[],L.error,L.progress.currentBlocker]).map(D=>({runId:L.id,roleId:L.roleId,status:L.status,message:D}))),T=s.flatMap(L=>mA([...L.report?.artifacts??[],L.report?.patchRef,L.report?.diffRef,...L.progress.patchRefs]).map(D=>({...D,runId:L.id,roleId:L.roleId}))),A=y.map(L=>Wq(L,i)),H=s[0]??null,W=H?{runId:H.id,roleId:H.roleId,status:H.status,message:H.progress.latestMeaningfulActivity||H.report?.summary||H.objective,updatedAt:kc(H)}:null,B=u.length>0?`${u.length} ${u.length===1?"child":"children"} running`:`${y.length} ${y.length===1?"child":"children"} finished`,M=[u.length?`${u.length} active`:null,d.length?`${d.length} completed`:null,f.length?`${f.length} failed`:null,b.length?`${b.length} cancelled`:null,p.length?`${p.length} paused`:null].filter(Boolean).join(" · "),j=W?`${eB(W.roleId)}: ${W.message}`:"";return{sessionId:t,runs:s,activeRuns:u,completedRuns:d,failedRuns:f,cancelledRuns:b,needsResumeRuns:p,terminalRuns:y,latestRun:H,latestMeaningfulUpdate:W,activeCount:u.length,completedCount:d.length,failedCount:f.length,cancelledCount:b.length,needsResumeCount:p.length,terminalCount:y.length,usage:k,blockers:w,evidenceRefs:T,finalResults:A,testsRunCount:s.reduce((L,D)=>L+D.progress.validationAttempts.length,0),label:B,tooltip:[M,j].filter(Boolean).join(". ")}}function Wq(e,t){return{runId:e.id,roleId:e.roleId,status:e.status,objective:e.objective,summary:e.report?.summary||e.error||"Child conversation finished.",findings:e.report?.findings??[],changedFiles:e.progress.changedFiles,refs:mA([...e.report?.artifacts??[],e.report?.patchRef,e.report?.diffRef]),testsRun:e.report?.testsRun??[],validationAttempts:e.progress.validationAttempts.map(a=>a.command),blockers:dA([...e.report?.blockers??[],e.error]),confidence:e.report?.confidence??null,importantMessages:t.filter(a=>a.fromRunId===e.id).map(a=>({id:a.id,runId:e.id,fromRunId:a.fromRunId,kind:a.kind,body:a.body,createdAt:a.createdAt})),workspaceRetention:Xq(e),updatedAt:kc(e)}}function Yq(e){const t=$c(e.data),a=[t?.run,$c(t?.message)?.run];for(const i of a){const s=Lk.safeParse(i);if(s.success)return s.data}return null}function Jq(e){const t=mj.safeParse($c(e.data)?.message);return t.success?t.data:null}function Xq(e){const t=$c($c(e.metadata?.workspaceHandoff)?.workspaceRetention);return t?.status!=="retained"?null:{status:"retained",reason:jm(t.reason),retainedAt:jm(t.retainedAt),expiresAt:jm(t.expiresAt),retentionDays:Qq(t.retentionDays),trigger:jm(t.trigger),cleanupAfterExpiry:t.cleanupAfterExpiry===!0}}function kc(e){return e.updatedAt??e.completedAt??e.startedAt??e.createdAt}function dA(e){return[...new Set(e.map(t=>t?.trim()).filter(t=>!!t))]}function mA(e){const t=new Map;for(const a of e)a&&t.set(`${a.kind}:${a.id}`,a);return[...t.values()]}function $c(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function jm(e){return typeof e=="string"&&e.trim()?e.trim():null}function Nm(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Qq(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function eB(e){return e.slice(0,1).toUpperCase()+e.slice(1).replace(/[-_]+/g," ")}const Sv=[];function _v(e,t){return fA(e,t,null)}function fA(e,t,a){const i=a&&iB(a.events,e)?nB(a.indexes,a.events.length,e):tB(e),s=oB(t);return{...i,...s}}function tB(e){const t=new Map;for(const a of e){if(!a.sessionId)continue;const i=t.get(a.sessionId);i?i.push(a):t.set(a.sessionId,[a])}return aB(t)}function nB(e,t,a){const i=new Map(e.eventsBySessionId),s=new Map(e.latestContextUsageBySessionId),u=new Map(e.latestGoalRuntimeBySessionId),d=new Map(e.latestSubagentRuntimeBySessionId),f=new Set(e.activeGoalSessionIds),b=new Set(e.activeSubagentSessionIds),p=new Set;for(let y=t;y<a.length;y+=1){const k=a[y];if(!k.sessionId)continue;if(p.has(k.sessionId)){i.get(k.sessionId).push(k);continue}const w=i.get(k.sessionId);i.set(k.sessionId,w?[...w,k]:[k]),p.add(k.sessionId)}for(const y of p){const k=i.get(y)??Sv,w=QI(k);w?s.set(y,w):s.delete(y);const T=hA(k);T?(u.set(y,T),T.tone==="active"?f.add(y):f.delete(y)):(u.delete(y),f.delete(y));const A=uA(k,y);A?(d.set(y,A),pA({sessionEvents:k,sessionId:y,latestGoalRuntimeBySessionId:u,activeGoalSessionIds:f}),A.activeCount>0?b.add(y):b.delete(y)):(d.delete(y),b.delete(y))}return{eventsBySessionId:i,latestContextUsageBySessionId:s,latestGoalRuntimeBySessionId:u,latestSubagentRuntimeBySessionId:d,activeGoalSessionIds:f,activeSubagentSessionIds:b}}function aB(e){const t=new Map,a=new Map,i=new Map,s=new Set,u=new Set;for(const[d,f]of e){const b=QI(f);b&&t.set(d,b);const p=hA(f);p&&(a.set(d,p),p.tone==="active"&&s.add(d))}for(const[d,f]of e){const b=uA(f,d);b&&(i.set(d,b),pA({sessionEvents:f,sessionId:d,latestGoalRuntimeBySessionId:a,activeGoalSessionIds:s}),b.activeCount>0&&u.add(d))}return{eventsBySessionId:e,latestContextUsageBySessionId:t,latestGoalRuntimeBySessionId:a,latestSubagentRuntimeBySessionId:i,activeGoalSessionIds:s,activeSubagentSessionIds:u}}function pA(e){if(e.latestGoalRuntimeBySessionId.has(e.sessionId))return;const t=hf(e.sessionEvents);t&&(e.latestGoalRuntimeBySessionId.set(e.sessionId,t),t.tone==="active"&&e.activeGoalSessionIds.add(e.sessionId))}function hA(e){return yv(e)??Bb(e)??hf(e)}function oB(e){const t=new Map,a=new Map,i=new Map,s=new Map;for(const u of e){t.set(u.id,u);const d=a.get(u.status);if(d?d.push(u):a.set(u.status,[u]),u.status!=="pending")continue;const f=i.get(u.sessionId);f?f.push(u):i.set(u.sessionId,[u]);const b=s.get(u.sessionId);(!b||ox(u.createdAt)>ox(b.createdAt))&&s.set(u.sessionId,u)}return{approvalsById:t,approvalsByStatus:a,pendingApprovalsBySessionId:i,latestPendingApprovalBySessionId:s}}function iB(e,t){return e===t?!0:e.length>t.length||e.length===t.length?!1:e.length===0?!0:e[0]===t[0]&&e[e.length-1]===t[e.length-1]}function ki(e,t){return t?e.eventsBySessionId.get(t)??Sv:Sv}function gA(e,t){return t?e.latestContextUsageBySessionId.get(t)??null:null}function vA(e,t){return t?e.latestGoalRuntimeBySessionId.get(t)??null:null}function rB(e,t){return t?e.latestSubagentRuntimeBySessionId.get(t)??null:null}function bA(e,t){return t?e.latestPendingApprovalBySessionId.get(t)??null:null}function ox(e){const t=Date.parse(e);return Number.isFinite(t)?t:Number.NEGATIVE_INFINITY}function sB(e){const t=new Set;if(e.readmePath){const a=e.readmePath.replaceAll("\\","/").split("/").at(-1);a&&t.add(a)}for(const a of e.skills){t.add(a.relativePath);const i=a.relativePath.lastIndexOf("/"),s=i>=0?a.relativePath.slice(0,i):"";for(const u of a.resourceFiles)t.add(s?`${s}/${u}`:u)}return{name:`${e.owner}/${e.repo}`,description:`${e.skills.length} installed skill${e.skills.length===1?"":"s"} from GitHub.`,scope:"extension",packagePath:e.sourcePath,files:[...t]}}function lB(e){return JSON.stringify([e.source,e.repositoryId,e.profileId])}function oZ(e,t){return e.profiles.find(a=>lB(a.ref)===t)?.ref??null}function cB(e,t){return!!(e&&t&&e.source===t.source&&e.repositoryId===t.repositoryId&&e.profileId===t.profileId)}function iZ(e,t){return e.profiles.find(a=>cB(a.ref,t))?.state??null}function uB(e,t){const a=new Map(rD.map(i=>[i.name,{...i,validationMessages:[...i.validationMessages],resourceFiles:[...i.resourceFiles]}]));for(const i of e?.skills??[])a.has(i.name)||a.set(i.name,i);for(const i of t?.extensions??[])if(i.validationStatus==="valid")for(const s of i.skills)s.validationStatus!=="valid"||a.has(s.name)||a.set(s.name,{name:s.name,description:s.description,path:s.relativePath,scope:"profile",enabled:!0,sourcePath:i.sourcePath,charCount:s.charCount,sourceHash:s.sourceHash,validationStatus:"valid",validationMessages:[],resourceFiles:s.resourceFiles});return[...a.values()].sort((i,s)=>i.name.localeCompare(s.name))}function dB(e){return{sourceTaskId:e.sourceTaskId,sourceExperience:e.sourceExperience,targetExperience:e.targetExperience,sourceMessageIds:[...e.sourceMessageIds??[]],sourceContext:e.sourceContext?.trim()||null,outputId:e.output?.id??null,outputRevision:e.output?.revision??null,createdAt:e.createdAt??new Date().toISOString(),checkoutMutation:"none"}}function rZ(e,t){const a=`Continue from the attached Work output "${e.title}" (revision ${e.revision}).`;return t==="work"?`${a} Choose a Project or repository before making source changes; do not mutate a checkout until I choose it.`:a}const yA="openpond:last-chat-task-mode";function mB(e,t){return e==="labs"?"models":"chat"}function fB(e){try{return e.getItem(yA)==="work"?"work":"chat"}catch{return"chat"}}function SA(){if(typeof window>"u")return"chat";try{return fB(window.localStorage)}catch{return"chat"}}function pB(e,t){try{e.setItem(yA,t==="chat"?"chat":"work")}catch{}}function hB(e){if(!(typeof window>"u"))try{pB(window.localStorage,e)}catch{}}const gB="uploaded to a different account";function _A(e,t){const a=e?.linkedSandboxProject??null;if(!a?.projectId||!a.teamId)return{state:"none",linked:null,cloudProject:null};const i=t?.find(s=>s.id===a.projectId&&s.teamId===a.teamId)??null;return i?{state:"confirmed",linked:a,cloudProject:i}:{state:"different_account",linked:a,cloudProject:null}}function oi(e,t){const a=_A(e,t);return a.state==="confirmed"?a.cloudProject:null}function vB(e,t){return _A(e,t).state==="different_account"?gB:null}function Ki(e){return e==="sandbox"||e==="sandbox_template"||e==="sandbox_app"}function xA(e={}){return{...e,workspaceTarget:"hybrid"}}function bB(e={}){return{...e,workspaceTarget:"local"}}function Gi(e){return e?.metadata?.workspaceTarget==="hybrid"}function yB(e){return!!(e&&e.provider==="openpond"&&e.workspaceKind==="local_project"&&e.cloudProjectId&&e.title.trim().endsWith(" Cloud"))}function kA({cloudProjects:e,selectedCloudProject:t,selectedProject:a}){const i=a?.linkedSandboxProject??null,s=e?oi(a,e):null,u=t?.id??s?.id??(e?null:i?.projectId??null),d=t?.teamId??s?.teamId??(e?null:i?.teamId??null);return!u||!d?{kind:"missing_cloud_project",message:"Upload/sync this Project to Cloud before using Hybrid."}:{kind:"ready",cloudProjectId:u,cloudTeamId:d,cwd:a?.workspacePath??null,localProjectId:a?.id??null,workspaceName:t?.name??s?.name??i?.projectName??a?.name??"Hybrid workspace"}}function wA({modelRef:e,provider:t,target:a,title:i}){return{provider:t,...e?{modelRef:e}:{},appId:null,appName:null,workspaceKind:"sandbox",workspaceId:null,workspaceName:a.workspaceName,localProjectId:a.localProjectId,cloudProjectId:a.cloudProjectId,cloudTeamId:a.cloudTeamId,metadata:xA(),cwd:a.cwd,title:i}}function SB(e){return _.useEffect(()=>{const t=LI(e.selectedSession);!t||e.composerDraftStore.getSnapshot()||e.composerDraftStore.set(t)},[e.composerDraftStore,e.selectedSession?.id]),_.useCallback(async t=>{const a=t.trim();if(!e.connection||!a||e.activeExperience==="chat")return!1;const i=ZH(a);try{let s;const u=e.selectedSession;if(u&&qf(u))s=await de.patchSession(e.connection,u.id,{title:i,metadata:xg(u.metadata,a)}),e.setSessions(d=>d.map(f=>f.id===s.id?s:f));else{const d=u?.metadata?.workspaceTarget==="hybrid"?"hybrid":u?.metadata?.workspaceTarget==="local"?"local":null,f=u?.provider??(e.selectedCloudProject?"openpond":e.activeProvider),b=u?.modelRef??(f==="openpond"?{providerId:"openpond",modelId:md}:{providerId:f,modelId:e.activeModel}),p=d?{workspaceTarget:d}:!u&&e.workspaceTarget==="local"?{workspaceTarget:"local"}:{};let y;if(!u&&e.workspaceTarget==="hybrid"){const k=kA({cloudProjects:e.cloudProjects,selectedCloudProject:e.selectedCloudProject,selectedProject:e.selectedProject});if(k.kind!=="ready")throw new Error(k.message);const w=wA({modelRef:b,provider:f,target:k,title:i});y={...w,experience:"work",metadata:xg(w.metadata,a)}}else y={experience:"work",provider:f,modelRef:b,openPondCommandAccessMode:u?.openPondCommandAccessMode??e.activeOpenPondCommandAccessMode,appId:u?.appId??null,appName:u?.appName??null,workspaceKind:u?.workspaceKind??(e.selectedCloudProject?"sandbox":e.selectedProject?"local_project":void 0),workspaceId:u?.workspaceId??e.selectedCloudProject?.id??e.selectedProject?.id??null,workspaceName:u?.workspaceName??e.selectedCloudProject?.name??e.selectedProject?.name??null,localProjectId:u?.localProjectId??e.selectedProject?.id??null,cloudProjectId:u?.cloudProjectId??e.selectedCloudProject?.id??null,cloudTeamId:u?.cloudTeamId??e.selectedCloudProject?.teamId??null,cwd:u?.cwd??e.selectedProject?.workspacePath??null,metadata:xg(p,a),title:i};s=await de.createSession(e.connection,y),e.setSessions(k=>[s,...k])}return e.composerDraftStore.set(""),e.setMentionedAppId(null),e.setSelectedSessionId(null),e.setView("chat"),e.requestComposerFocus(),e.showToast("Task draft saved.","success"),!0}catch(s){return e.showToast(s instanceof Error?s.message:"Could not save task draft.","error"),!1}},[e.activeExperience,e.activeModel,e.activeOpenPondCommandAccessMode,e.activeProvider,e.cloudProjects,e.composerDraftStore,e.connection,e.requestComposerFocus,e.selectedCloudProject,e.selectedProject,e.selectedSession,e.setMentionedAppId,e.setSelectedSessionId,e.setSessions,e.setView,e.showToast,e.workspaceTarget])}const _B=[];function xB({primary:e,secondary:t}){const[a,i]=_.useState(!1),{composerDraftStore:s,appDispatch:u,pendingTerminalCommand:d,setPendingTerminalCommand:f,terminalTabs:b,setTerminalTabs:p,trainingDetailTasksetId:y,setTrainingDetailTasksetId:k,mentionedAppId:w,setMentionedAppId:T,cloudSetupDialog:A,setCloudSetupDialog:H,rightPanelTabRequest:W,workspaceDiffPanelViewState:B,mainComposerFocusRequestId:M,requestMainComposerFocus:j,projectConfirmDialog:L,resolveProjectConfirmDialog:D,query:q,searchOpen:$,archivedChatsOpen:X,sectionMenuOpen:ae,cloudProjectsExpanded:ie,sidebarOpen:ue,view:ge,selectedAppId:Te,selectedProjectId:Be,selectedSessionId:Pe,codexPermissionMode:U,codexReasoningEffort:le,busy:he,diffPanelOpen:Me,diffPanelExpanded:Ue,rightPanelMode:O,activeExperience:Z,changeNewExperience:be,terminalOpen:ve,settingsSection:fe,newProjectDialogOpen:ee,newProjectMode:Ce,newProjectName:je,newProjectPath:et,newProjectBusy:We,commitDialogOpen:Ve,commitMessage:lt,commitIncludeUnstaged:st,commitNextStep:Je,commitDraft:Y,branchDialogOpen:oe,branchDialogName:K,toast:te,labDetailNavigation:xe,setQuery:Oe,setSearchOpen:Ye,setArchivedChatsOpen:bt,setSectionMenuOpen:dt,setCloudProjectsExpanded:wt,setChatRowsVisibleCount:_t,setSidebarOpen:Ge,setView:at,setSelectedAppId:g,setSelectedProjectId:F,setSelectedSessionId:re,setPrompt:Ie,setDraftProvider:G,setDraftModel:se,setDraftExperience:R,setDiffPanelOpen:V,setDiffPanelExpanded:pe,setRightPanelMode:me,setTerminalOpen:ke,setSettingsSection:Ee,setNewProjectDialogOpen:Re,setNewProjectName:Xe,setNewProjectPath:tt,setCommitDialogOpen:qe,setCommitMessage:ye,setCommitIncludeUnstaged:Qe,setCommitNextStep:ot,setCommitDraft:Ft,setBranchDialogOpen:Jn,setBranchDialogName:Mn,setError:Hn,showToast:zt,applyBootstrapPayload:Pn,bootstrap:xn,connection:an,startup:Qa,training:An,pinnedCollapsed:Xn,cloudProjectsCollapsed:kn,chatsCollapsed:on,savedForLaterCollapsed:fn,sidebarWidth:Aa,sidebarResizing:Rn,diffPanelWidth:fa,diffPanelResizing:Ct,togglePinnedCollapsed:ra,toggleCloudProjectsCollapsed:eo,toggleChatsCollapsed:Lo,toggleSavedForLaterCollapsed:Sa,startSidebarResize:La,startDiffPanelResize:Qn,selectedApp:to,selectedCloudProject:wn,selectedProject:no,selectedProjectLinkedApp:jt,selectedSession:Jt,sidebarSessions:At,runtimeIndexes:$t,chatMentionApps:sn,connectedAppMentions:Un,pendingApproval:pa,account:pt,activeModel:Cn,activeProvider:xt,appDefaults:Zt,startMessage:Ho,teamChatOrganization:Ha,teamChatTeamId:ao,teamChat:Tt,publishTeamProfileAgent:$o,communitySidebar:oo,communityView:sa,teamAiThreadId:Ra,toggleTeamAiSidebar:si,activeOpenPondCommandAccessMode:$a,viewWorkspaceAppId:io,viewWorkspaceId:Zi,viewWorkspaceKind:wi,viewWorkspaceName:Co,selectedActionCatalog:$s,expandedProjectIds:Nr,expandProject:li,toggleProjectExpanded:Wi,changeCodexPermissionMode:zr,changeCodexReasoningEffort:Dr,changeOpenPondCommandAccessMode:ci,resolveApproval:qa,beginNewChat:ro,beginNewChatWithTrainingModel:Yi,dismissTrainingChatHandoff:qo,trainingChatHandoff:Bo,selectTrainingChatTaskForComposer:Ur,chatHistoryLoadStates:Ji,loadMoreSelectedChatHistory:Lr,selectedPagedSessionEvents:Vo,activeSessions:ha,archivedSessions:Xi,pinnedSessions:ui,savedForLaterSessions:Ta,savedForLaterFiles:Io,sidebarFileBookmarks:la,setSidebarFileStatus:Qi,setSessions:Fo,projectRows:On,localProjectRows:Hr,cloudProjectRows:bn,projectSessionRowsByProjectId:_a,childSessionRowsByParentId:so,sidebarProjectIdBySessionId:lo,chatRows:qs,visibleChatRows:er,chatRowsVisibleCount:Ci,sessionEvents:Ao,goalRuntime:di,subagentRuntime:Ii,visibleChatMessages:tr,activeTerminalScope:$r,terminalSummaries:qr,runningSessionIds:ga,selectedSessionRunning:Br,selectedSteerAutoDispatchBlocked:nr,selectedSteerAutoDispatchReady:mi,sidebarGoalRuntimeBySessionId:ar,sidebarSubagentRuntimeBySessionId:Ko,taskDragSessionId:Vr,taskPreviewSessionIds:Fr,startTaskDrag:or,clearTaskDrag:Bs,previewTaskDrop:Kr,commitTaskDrop:Ai,commitTaskPreviewDrop:Vs,dragItem:Gr,startPinnedDrag:ir,clearSidebarDrag:Ri,previewPinnedDrop:Go,commitPinnedDrop:Fs,commitPinnedPreviewDrop:Ks,commandProjectRows:Gs,contextWindowStatus:Zr,pinnedRows:Zo,workspaceBusy:Ti,diffBusy:Zs,visibleWorkspaceState:fi,visibleWorkspaceDiff:pi,refreshVisibleWorkspaceDiff:ca,managedWorkspace:Ws,canSyncActiveWorkspace:Wr,canPublishOpenPondProject:Yr,projectTarget:Et,workspaceTarget:pn}=e,{title:co,browserConversationId:ln,handleWorkspaceDiffPanelViewStateChange:Ba,openSessionInChat:va,changeProjectTarget:Jc,submitNewProjectDialog:Rl,changeWorkspaceBranch:Tl,openCommitDialog:rr,openCreateWorkspaceBranchDialog:hi,openDefaultsSettingsFromBranchDialog:El,runWorkspaceTool:Jr,submitCommitDialog:Ml,submitCreateWorkspaceBranch:Pl,syncWorkspaceLocally:Ys,answerCreateImproveQuestion:Js,applyCreateImproveCandidate:Ol,approveCreateImproveRun:jl,cancelCreateImproveRun:Nl,changeDraftProvider:zl,openCreateImprovePullRequest:Xc,reconcileCreateImprovePullRequest:Qc,rejectCreateImproveCandidate:Dl,pauseCreateImproveRun:eu,resumeCreateImproveRun:xa,reviseCreateImproveRun:sr,stopTurn:Xr,archiveSession:Xs,restoreSession:Ul,renameSession:Ll,toggleSessionPinned:Qr,toggleSessionSavedForLater:Hl,startCloudSetupUpload:Ei,changeWorkspaceTarget:lr,sendPromptFromMainComposer:cr,openSandboxWorkspace:es,openUrlInBrowserPanel:$l,showBrowserPanel:Ro,showChangesPanel:Mi,showGoalSidebarTab:ts,rightChatTrainingLaunchRequest:Qs,setRightChatTrainingLaunchRequest:Wo,closeRightChatPanel:ql,openRightChatPanel:ns,rightChatPanelViews:el,showRightChatPanel:tu,showRightPanelDiffTab:nu,submitRightChatPrompt:au,activateRightChatPanel:Bl,updateRightChatModel:Vl,updateRightChatPrompt:Yo,updateRightChatProvider:Ea,updateRightChatScrollState:as,openProfileSettings:Ma,diagnosticEvents:Pi,toggleRightSidebar:os}=t,[Oi,ji]=_.useState(null),[ur,To]=_.useState(null),Fl=uB(xn?.profile,xn?.extensionCatalog),[Ni,Jo]=_.useState(null),[tl,ua]=_.useState(null),[dr,Eo]=_.useState(null),Kl=_.useCallback(()=>{g(null),F(null),re(null),dt(null),at("team")},[dt,g,F,re,at]),is=_.useCallback(()=>{g(null),F(null),re(null),dt(null),oo.discoverCommunities()},[oo.discoverCommunities,dt,g,F,re]),gi=SB({activeExperience:Z,activeModel:Cn,activeOpenPondCommandAccessMode:$a,activeProvider:xt,cloudProjects:xn?.cloudProjects??_B,composerDraftStore:s,connection:an,requestComposerFocus:j,selectedCloudProject:wn,selectedProject:no,selectedSession:Jt,setMentionedAppId:T,setSelectedSessionId:re,setSessions:Fo,setView:at,showToast:zt,workspaceTarget:pn.value}),nl=_.useCallback(async nt=>{if(!an)throw new Error("OpenPond is not connected.");let Gt=xt,yn=Cn;Gt==="codex"&&(Gt=vv(xn?.providers,{enabledOnly:!0}).find(bi=>bi.value!=="codex")?.value??xl,yn=df(Gt,xn?.providers)??Xu);const Ui=At.find(bi=>bi.id===nt.sourceSessionId),Va=await de.createSession(an,{experience:nt.target,provider:Gt,modelRef:{providerId:Gt,modelId:yn},openPondCommandAccessMode:$a,appId:null,appName:null,workspaceId:null,workspaceName:null,localProjectId:null,cloudProjectId:null,cloudTeamId:null,cwd:null,title:`Continue ${Ui?.title??"task"}`.slice(0,120),metadata:{experienceHandoff:dB({sourceTaskId:nt.sourceSessionId,sourceExperience:Ui?.experience??null,targetExperience:nt.target,sourceMessageIds:nt.sourceMessageIds??[],sourceContext:nt.sourceContext,output:nt.output})}});return Fo(bi=>[Va,...bi]),R(nt.target),G(Gt),se(yn),s.set(nt.prompt),u({type:"selectSession",sessionId:Va.id,appId:null,projectId:null}),g(null),F(null),ke(!1),at("chat"),me("home"),V(nt.target==="work"),pe(!1),Va},[Cn,$a,xt,u,xn?.providers,s,an,pe,V,R,se,G,me,g,F,Fo,ke,at,At]),Gl=_.useCallback(nt=>{Jo(nt),ua(null),ro(null),Ge(!0)},[ro,Ge]),al=_.useCallback(nt=>{ua(sB(nt)),Jo(null),ro(null),Ge(!0)},[ro,Ge]);_.useEffect(()=>{!Ni&&!tl||ge!=="chat"||Pe||Be||Te||(ji(Ni),To(tl),Jo(null),ua(null),me("home"),pe(!1),V(!0))},[Ni,tl,Te,Be,Pe,pe,V,me,ge]),_.useEffect(()=>{!Oi&&!ur||ge==="chat"&&Me&&O==="home"||(ji(null),To(null))},[Me,ur,Oi,O,ge]);const Zl=_.useCallback(()=>{ji(null),To(null),pe(!1),V(!1)},[pe,V]),Pa=_.useCallback(nt=>{if(nt.workspaceKind==="local"){const Gt=Dt("local",nt.workspaceId);g(null),F(Gt),re(null),li(Gt),at("chat")}else{const Gt=At.find(yn=>yn.id===nt.sourceSessionId||yn.workspaceId===nt.workspaceId);if(!Gt){zt("This saved file's cloud chat is no longer available.","error");return}va(Gt.id)}me("changes"),V(!0),Eo({id:Date.now(),file:nt}),nt.available||zt(`File unavailable: ${nt.path}`,"error")},[li,va,V,me,g,F,re,at,zt,At]);_.useEffect(()=>{if(!dr)return;const nt=window.setTimeout(()=>{me("changes"),V(!0)},0);return()=>window.clearTimeout(nt)},[Be,Pe,V,me,dr]);const zi=mB(ge),Di=_.useCallback(nt=>{if(dt(null),g(null),F(null),re(null),nt==="models"){at("labs");return}be(SA())},[be,dt,g,F,re,at]),rs=_.useCallback(async(nt,Gt)=>{const yn=await An.actions.acceptHarnessReview(nt,Gt,{providerId:xt,modelId:Cn},le);return yn?(k(yn.materializedTasksetId??null),at("labs"),!0):(zt("Taskset review could not be opened.","error"),!1)},[Cn,xt,le,k,at,zt,An.actions]);if(!Qa.ready)return E.jsx(Cq,{startup:Qa});if(ge==="settings")return E.jsx(Z_,{showToast:zt,children:E.jsx(_q,{settings:{payload:xn,connection:an,diagnostics:Pi,initialSection:fe,onPayload:Pn,onError:Hn,onToast:zt,onOpenSourceSession:va,onAcceptEvaluationReview:rs,onOpenSkill:Gl,onOpenExtension:al,teamChatCurrentUserId:Tt.currentUserId,teamChatEnabled:ao!==null,teamChatNotificationMode:Tt.notificationMode,teamChatThreads:Tt.threads,onTeamChatNotificationModeChange:Tt.setNotificationMode,onTeamChatThreadMuteChange:Tt.setThreadMuted,diffPanelWidth:fa,diffPanelResizing:Ct,diffPanelExpanded:Ue,onDiffPanelResizeStart:Qn,onDiffPanelExpandedChange:pe,onBack:()=>{at("chat"),Ge(!0)}},toast:{toast:te,onDismiss:()=>u({type:"field",key:"toast",value:null})}})});const ss=$f(),$n=an?.platform??navigator.platform,ka=ss&&zb($n),uo=$r,mo=fi?.initialized?fi.repoPath:Jt?.cwd??null,Oa={"--sidebar-width":`${Aa}px`,"--diff-panel-width":`${fa}px`},Mo=ge==="chat"&&Z!=="chat"||ge==="labs"||ge==="scheduled"&&a||ge==="team"&&!!Ra,ol=["app-shell",ka?"platform-macos":"",ue?"sidebar-open":"sidebar-closed",Rn?"sidebar-resizing":"",Ct?"diff-panel-resizing":""].filter(Boolean).join(" "),mr=Pe?Ji[Pe]:null,vi=Pe?mr?.cursorSequence??Rq(_l(Vo,ki($t,Pe))):null,Fn=!!Pe&&!!an&&(_n(Pe)?!0:!!xn?.eventWindow?.hasMoreBefore&&!!vi)&&(mr?.hasMore??!0),cn=!!mr?.loading;return E.jsx(Z_,{showToast:zt,children:E.jsx(Sq,{className:ol,style:Oa,sidebar:{productArea:zi,onProductAreaChange:Di,experience:Z,view:ge,selectedAppId:Te,selectedProjectId:Be,selectedSessionId:Pe,selectedTeamThreadId:Tt.selectedThreadId,teamChatEnabled:ao!==null,teamChatOrganization:Ha,teamChatLoading:Tt.loading,currentUserId:Tt.currentUserId,teamMembers:Tt.members,teamThreads:Tt.threads,...oo,account:pt,connection:an,profile:xn?.profile,pinnedCollapsed:Xn,cloudProjectsCollapsed:kn,chatsCollapsed:on,savedForLaterCollapsed:fn,archivedChatsOpen:X,cloudProjectsExpanded:ie,sectionMenuOpen:ae,dragItem:Gr,taskDragSessionId:Vr,taskPreviewSessionIds:Fr,activeSessions:ha,archivedSessions:Xi,pinnedRows:Zo,pinnedSessions:ui,savedForLaterSessions:Ta,savedForLaterFiles:Io,projectRows:On,localProjectRows:Hr,cloudProjectRows:bn,projectSessionRowsByProjectId:_a,childSessionRowsByParentId:so,sidebarProjectIdBySessionId:lo,terminalSummaries:qr,runningSessionIds:ga,goalRuntimeBySessionId:ar,subagentRuntimeBySessionId:Ko,visibleChatRows:er,chatRows:qs,chatRowsVisibleCount:Ci,expandedProjectIds:Nr,currentVersion:xn?.server.version??null,platform:$n,arch:an?.arch??null,onSidebarResizeStart:La,setSidebarOpen:Ge,setView:at,setSelectedAppId:g,setSelectedProjectId:F,setSelectedSessionId:re,setSearchOpen:Ye,setSectionMenuOpen:dt,setSettingsSection:Ee,onTogglePinnedCollapsed:ra,onToggleCloudProjectsCollapsed:eo,onToggleChatsCollapsed:Lo,onToggleSavedForLaterCollapsed:Sa,setArchivedChatsOpen:bt,setCloudProjectsExpanded:wt,setChatRowsVisibleCount:_t,beginNewChat:ro,dockSessionRight:ns,selectTeamThread:nt=>{at("team"),Tt.selectThread(nt)},openTeamDm:nt=>{at("team"),Tt.openDm(nt)},toggleSessionPinned:Qr,toggleSessionSavedForLater:Hl,openSidebarFile:Pa,setSidebarFileStatus:(nt,Gt)=>{Qi(nt,Gt)},archiveSession:Xs,restoreSession:Ul,renameSession:Ll,expandProject:li,toggleProjectExpanded:Wi,startPinnedDrag:ir,clearSidebarDrag:Ri,previewPinnedDrop:Go,commitPinnedDrop:Fs,commitPinnedPreviewDrop:Ks,startTaskDrag:or,clearTaskDrag:Bs,previewTaskDrop:Kr,commitTaskDrop:Ai,commitTaskPreviewDrop:Vs},topBar:{sidebarOpen:ue,title:co,backAction:xe.backAction,breadcrumbs:xe.breadcrumbs,conversationId:ge==="chat"?Pe:null,workspaceName:Co,workspaceId:Zi,busy:he,workspaceState:fi,workspaceKind:wi,selectedApp:jt??to,selectedProject:no,workspaceDiff:pi,managedWorkspace:Ws,workspaceBusy:Ti,defaultTeamId:Zt.defaultTeamId,showDiffControls:ge==="chat"&&Z==="development",diffPanelOpen:Me,terminalOpen:ve,rightSidebarAvailable:Mo,rightSidebarOpen:ge==="scheduled"?a:Me,onToggleDiffPanel:os,onToggleRightSidebar:ge==="scheduled"?()=>i(nt=>!nt):ge==="team"&&Ra?si:os,onOpenSearch:()=>{dt(null),Ye(!0)},onToggleTerminal:()=>ke(nt=>!nt),onRunTerminalCommand:nt=>{f({id:Date.now(),scope:uo,command:nt}),ke(!0)},onWorkspaceToolAction:Jr,onOpenCommitDialog:rr,onWorkspaceBranchChange:Tl,onWorkspaceBranchCreate:hi,connection:an,onBootstrap:Pn,onOpenSandboxWorkspace:es,onShowSidebar:()=>Ge(!0),onOpenTeamChat:Kl,onDiscoverCommunities:is,collaborationView:ge==="team"||ge==="community"?ge:null,platform:$n,showWorkspaceControls:ge!=="team"&&ge!=="community"&&ge!=="labs"&&ge!=="scheduled"&&ge!=="outputs"&&(Z==="development"||Z==="work"&&!!(no||Jt?.localProjectId||Jt?.cloudProjectId||Jt?.workspaceKind==="local_project"))},mainPane:{experience:Z,onNewExperienceChange:be,view:ge,teamChat:{currentUserId:Tt.currentUserId,members:Tt.members,agents:Tt.agents,profile:xn?.profile??null,teamId:ao,teamName:Ha?.displayName??null,detail:Tt.detail,aiThread:Tt.aiThread,agentConversation:Tt.agentConversation,loading:Tt.loading,busy:Tt.busy,error:Tt.error,connection:an,providerSettings:xn?.providers??null,provider:xt,model:Cn,codexPermissionMode:U,codexReasoningEffort:le,openPondCommandAccessMode:$a,contextWindowStatus:Zr,showToast:zt,onProviderChange:zl,onModelChange:se,onCodexPermissionModeChange:zr,onCodexReasoningEffortChange:Dr,onOpenPondCommandAccessModeChange:ci,onOpenProviderSettings:()=>{Ee("providers"),at("settings")},onSendMessage:Tt.sendMessage,onPublishProfileAgent:$o,onOpenAiThread:async nt=>{await Tt.openAiThread(nt),me("chat"),V(!0)},onOpenAgentConversation:async nt=>{await Tt.openAgentConversation(nt),me("chat"),V(!0)},onCloseAiThread:()=>V(!1),onCloseAgentConversation:()=>{Tt.closeAgentConversation(),V(!1)},onSendAgentTurn:Tt.sendAgentTurn,onSendAiTurn:Tt.sendAiTurn,onStopAiTurn:Tt.stopAiTurn,onEditMessage:Tt.editMessage,onDeleteMessage:Tt.deleteMessage,onRetryMessage:Tt.retryMessage,onDismissFailedMessage:Tt.dismissFailedMessage,onLoadMoreMessages:Tt.loadMoreMessages,onRetryLoad:Tt.refresh},community:sa,bootstrap:xn,runtimeEvents:Ao,chatMessages:tr,contextWindowStatus:Zr,goalRuntime:di,subagentRuntime:Ii,selectedSessionId:Pe,composerDraftStore:s,mainComposerFocusRequestId:M,labCloseDetailRequestId:xe.closeDetailRequestId,labCloseDetailKind:xe.closeDetailKind,sideChatTrainingLaunchRequest:Qs,onSideChatTrainingLaunchHandled:nt=>Wo(Gt=>Gt?.id===nt?null:Gt),steerAutoDispatchBlocked:nr,steerAutoDispatchReady:mi,mentionApps:sn,connectedAppMentions:Un,profileSkills:Fl,selectedMentionAppId:w,busy:he,turnRunning:Br,activeProvider:xt,activeModel:Cn,codexPermissionMode:U,codexReasoningEffort:le,openPondCommandAccessMode:$a,pendingApproval:pa,activeWorkspaceAppId:io,activeWorkspaceId:Zi,activeWorkspaceKind:wi,projectTarget:Et,actionCatalog:$s,workspaceTarget:pn,connection:an,workspaceName:Co,workspaceState:fi,workspaceDiff:pi,workspaceBusy:Ti,diffBusy:Zs,forceChatThread:_n(Pe),diffPanelOpen:Me,diffPanelExpanded:Ue,rightPanelMode:O,rightPanelTabRequest:W,rightChatPanels:el,nativeSkillSidebar:Oi,extensionSkillSidebar:ur,workspaceDiffPanelViewState:B,sidebarFileOpenRequest:dr,sidebarFileBookmarks:la,onSetSidebarFileStatus:(nt,Gt)=>{Qi(nt,Gt)},browserConversationId:ln,terminalScope:uo,terminalTabs:b,terminalCwd:mo,pendingTerminalCommand:d,terminalOpen:ve,onToggleTerminal:()=>ke(nt=>!nt),onWorkspaceDiffPanelViewStateChange:Ba,training:An,trainingSessions:At,trainingChatHandoff:Bo,trainingDetailTasksetId:y,onTrainingDetailTasksetIdChange:k,onTrainingChatTaskSelect:Ur,onTrainingChatHandoffDismiss:qo,onOpenSession:va,onExperienceHandoff:nl,cloudProjects:xn?.cloudProjects??[],chatHistoryHasMore:Fn,chatHistoryLoading:cn,onDiffPanelResizeStart:Qn,onToggleDiffPanelExpanded:()=>pe(nt=>!nt),onShowDiffPanel:Mi,onShowBrowserPanel:Ro,onShowFilesPanel:()=>nu("files"),onShowGoalSidebarTab:ts,onShowTrainingDraftPanel:()=>{me("training"),V(!0)},onShowRightChatPanel:tu,onAddRightChat:()=>ns(null),onOpenRightChatForSession:(nt,Gt)=>{const yn=Gt??At.find(Ui=>Ui.id===nt)??null;yn&&ns(yn,{preserveView:!0})},onLabDetailOpenChange:xe.onDetailOpenChange,scheduledDetailOpen:a,onScheduledDetailOpenChange:i,onTerminalTabsChange:p,onCloseRightChatPanel:ql,onCloseNativeSkillSidebar:Zl,onActivateRightChatPanel:Bl,onRightChatModelChange:Vl,onRightChatPromptChange:Yo,onRightChatScrollStateChange:as,onRightChatProviderChange:Ea,onSubmitRightChat:au,onStopRightChat:nt=>Xr(nt),onCloseTerminal:()=>ke(!1),onLoadMoreChatHistory:Lr,canSyncWorkspace:Wr,startMessage:Ho,onPayload:Pn,onError:Hn,setView:at,onOpenProfileSettings:Ma,onOpenProviderSettings:()=>{Ee("providers"),at("settings")},onOpenTrainingSettings:()=>{Ee("training"),at("settings")},onOpenDatasetStorageSettings:()=>{Ee("dataset-storage"),at("settings")},changeDraftProvider:zl,changeProjectTarget:Jc,changeWorkspaceTarget:lr,setDraftProvider:G,setDraftModel:se,onBeginNewChatWithModel:Yi,changeCodexPermissionMode:zr,changeCodexReasoningEffort:Dr,changeOpenPondCommandAccessMode:ci,resolveApproval:qa,answerCreateImproveQuestion:Js,applyCreateImproveCandidate:Ol,approveCreateImproveRun:jl,cancelCreateImproveRun:Nl,openCreateImprovePullRequest:Xc,reconcileCreateImprovePullRequest:Qc,rejectCreateImproveCandidate:Dl,pauseCreateImproveRun:eu,resumeCreateImproveRun:xa,reviseCreateImproveRun:sr,setMentionedAppId:T,showToast:zt,onSaveTaskDraft:gi,sendPrompt:cr,stopTurn:Xr,syncWorkspaceLocally:Ys,refreshWorkspaceDiff:ca},cloudSetup:{state:A,onClose:()=>H(null),onOpenBrowserUrl:$l,onStart:()=>{Ei()}},projectConfirm:{state:L,onResolve:D},lazyPanels:{activeSessions:ha,branchDialogName:K,branchDialogOpen:oe,commitDialogOpen:Ve,commitDraft:Y,commitIncludeUnstaged:st,commitMessage:lt,commitNextStep:Je,canPublishOpenPondProject:Yr,connection:an,expandProject:li,newProjectBusy:We,newProjectDialogOpen:ee,newProjectDirectory:Zt.defaultNewProjectDirectory,newProjectMode:Ce,newProjectName:je,newProjectPath:et,projectRows:Gs,query:q,searchOpen:$,visibleWorkspaceDiff:pi,visibleWorkspaceState:fi,workspaceBusy:Ti,appDispatch:u,beginNewChat:()=>ro(null),openDefaultsSettingsFromBranchDialog:El,setBranchDialogName:Mn,setBranchDialogOpen:Jn,setCommitDialogOpen:qe,setCommitDraft:Ft,setCommitIncludeUnstaged:Qe,setCommitMessage:ye,setCommitNextStep:ot,setNewProjectDialogOpen:Re,setNewProjectName:Xe,setNewProjectPath:tt,setPrompt:Ie,setQuery:Oe,setSearchOpen:Ye,submitCommitDialog:Ml,submitCreateWorkspaceBranch:Pl,submitNewProjectDialog:Rl},toast:{toast:te,onDismiss:()=>u({type:"field",key:"toast",value:null})}})})}const Ec=new Map,Ym=new Map;function xv(e){if(!e||e.state!=="signed_in")return null;const t=e.accounts.find(s=>s.isActive)??null,a=e.activeProfile?.handle?.trim()||t?.handle?.trim()||e.label.trim()||"signed_in",i=e.activeProfile?.baseUrl??t?.baseUrl??e.baseUrl??"";return[a,i,e.apiBaseUrl??"",e.chatApiBaseUrl??""].join("|")}function kB(e){const t=e?.trim();if(!t)return null;const a=Ec.get(t);return a?.updatedAt?a.organizations:null}function wB(e,t){const a=e?.trim();if(a){Ec.set(a,{organizations:t,promise:null,updatedAt:Date.now()});for(const i of Ym.get(a)??[])i()}}function CB(e,t){const a=e?.trim();if(!a)return()=>{};const i=Ym.get(a)??new Set;return i.add(t),Ym.set(a,i),()=>{i.delete(t),i.size===0&&Ym.delete(a)}}function ix(e){const t=e.accountKey?.trim();if(!t)return Promise.resolve([]);const a=Ec.get(t);if(!e.force){if(a?.updatedAt)return Promise.resolve(a.organizations);if(a?.promise)return a.promise}const i=e.fetchOrganizations().then(s=>(wB(t,s),s)).catch(s=>{const u=Ec.get(t);throw u?.promise===i&&Ec.set(t,{organizations:u.organizations,promise:null,updatedAt:u.updatedAt}),s});return Ec.set(t,{organizations:a?.organizations??[],promise:i,updatedAt:a?.updatedAt??0}),i}const sZ="openpond.config.json";function lZ(e,t,a){return t<=0?-1:a==="Home"?0:a==="End"?t-1:a==="ArrowRight"?(e+1)%t:(e-1+t)%t}function CA(){return{activeTab:"files",openFilePaths:[],selectedPath:null}}function Ag(e){return{activeTab:e.activeTab,openFilePaths:[...e.openFilePaths],selectedPath:e.selectedPath}}function cZ(e,t=null){const a=AB(e.openFilePaths.map(s=>sx(s,t)).filter(Boolean)),i=e.selectedPath&&sx(e.selectedPath,t)||null;return{activeTab:e.activeTab==="file"&&!i?"files":e.activeTab,openFilePaths:a,selectedPath:i}}function rx(e,t){return e.activeTab===t.activeTab&&e.selectedPath===t.selectedPath&&e.openFilePaths.length===t.openFilePaths.length&&e.openFilePaths.every((a,i)=>a===t.openFilePaths[i])}function sx(e,t=null){let a=IB(e);const i=t?.trim().replace(/\\/g,"/").replace(/\/+$/,"");if(!i)return a;if(a===i)return"";a.startsWith(`${i}/`)&&(a=a.slice(i.length+1));const s=i.split("/").filter(Boolean).at(-1);return s&&a.startsWith(`${s}/`)&&(a=a.slice(s.length+1)),a}function uZ(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function dZ(e){return{path:e,status:"unchanged",additions:0,deletions:0,patch:"",content:null}}function mZ(e,t){const a=lx(e.path);return!a||e.path.endsWith("/")||e.content==null&&/Could not access .+\/null['"]?/.test(e.patch)?!0:t.some(i=>{const s=lx(i);return!!(s&&s.startsWith(`${a}/`))})}function fZ(e){return/\.(?:md|markdown|mdx)$/i.test(e)||/(?:^|\/)readme$/i.test(e)}function pZ(e){return/\.(?:doc|docx)$/i.test(e)}function IB(e){let t=e.trim().replace(/^['"`]+|['"`]+$/g,"");if(/^file:\/\//i.test(t))try{t=decodeURIComponent(new URL(t).pathname)}catch{t=t.replace(/^file:\/\//i,"")}return t.replace(/\\/g,"/").replace(/^\.\/+/,"")}function AB(e){return Array.from(new Set(e))}function lx(e){const a=e.replace(/\\/g,"/").replace(/^\.\/+/,"").split("/").filter(Boolean);return a.length===0?null:a.join("/")}function RB(e){if(!e||e.state!=="signed_in")return null;const t=e.accounts.find(f=>f.isActive)??null,a=e.profile?.id?.trim()??"",i=e.activeProfile?.handle?.trim()||t?.handle?.trim()||e.label.trim()||"signed_in",s=e.activeProfile?.baseUrl??t?.baseUrl??e.baseUrl??"",u=e.apiBaseUrl??t?.apiBaseUrl??"",d=e.chatApiBaseUrl??t?.chatApiBaseUrl??"";return[a?`profile:${a}`:"profile:unknown",i,s,u,d].join("|")}function IA(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"cloud-project"}function TB(e){const t=new TextEncoder().encode(e);let a="";for(const i of t)a+=String.fromCharCode(i);return btoa(a)}function Vf(e){const t=e,a=t.teamId||t.id||"";if(!a)return null;const i=t.displayName||t.name||a,s=t.workspaceKind==="personal"||t.isPersonalDefault===!0||t.kind==="personal_default"||t.name?.trim().toLowerCase()==="personal";return{teamId:a,slug:t.slug||IA(i),name:t.name||i,displayName:i,role:t.role==="owner"||t.role==="admin"||t.role==="member"?t.role:"member",workspaceKind:t.workspaceKind==="personal"||t.workspaceKind==="shared"?t.workspaceKind:s?"personal":"shared",status:t.status==="disabled"||t.status==="archived"?t.status:"active",kind:t.kind==="personal_default"||t.kind==="managed_client"||t.kind==="team"?t.kind:void 0,isPersonalDefault:s,isManagedClient:t.isManagedClient===!0||t.kind==="managed_client",primaryContactEmail:t.primaryContactEmail??null,customDomain:t.customDomain??null,planKey:typeof t.planKey=="string"?t.planKey:null,effectiveAccessState:t.effectiveAccessState==="checkout_pending"||t.effectiveAccessState==="active"||t.effectiveAccessState==="grace"||t.effectiveAccessState==="suspended"||t.effectiveAccessState==="cancelling"||t.effectiveAccessState==="cancelled"?t.effectiveAccessState:null,canManageBilling:t.canManageBilling===!0||t.role==="owner",createdAt:t.createdAt??"",updatedAt:t.updatedAt??""}}function EB(e){return e.find(t=>t.workspaceKind==="personal"||t.isPersonalDefault===!0||t.kind==="personal_default")??e.find(t=>t.name.trim().toLowerCase()==="default")??e.find(t=>t.isManagedClient!==!0&&t.kind!=="managed_client")??e[0]??null}function MB(e,t){const a=e.filter(s=>s.status==="active"&&s.workspaceKind==="shared"),i=t?.trim()??"";if(i){const s=a.find(u=>u.teamId===i);if(s)return s}return a.find(s=>s.role==="owner")??a.find(s=>s.role==="admin")??a[0]??null}function PB(...e){for(const t of e){const a=t?.trim();if(a)return a}return""}function OB({draftProvider:e,hasSelectedCloudProject:t,selectedSessionHybridWorkspace:a}){return t&&!a?"openpond":e}const jB=[{value:"action:new-local-project",label:"New local project",detail:"Create a new project folder on this machine",kind:"action"},{value:"action:add-local-project",label:"Use existing folder",detail:"Choose a folder on this machine",kind:"action"},{value:"action:add-local-project-path",label:"Use existing folder path",detail:"Enter a local folder path manually",kind:"action"},{value:"action:new-cloud-project",label:"New cloud project",detail:"Create a project in OpenPond Cloud",kind:"action"},{value:"action:create-cloud-environment",label:"Create cloud environment",detail:"Set up compute for a cloud project",kind:"action"}];function NB(...e){return PB(...e.map(t=>{const a=t?.trim();return a&&!a.includes("@")?a:null}))}function zB(e){if(e?.state!=="signed_in")return"";const t=e.accounts.find(a=>a.isActive)??null;return NB(e.profile?.name,e.label,t?.displayLabel,e.profile?.handle,t?.handle,e.activeProfile?.handle)}function DB({bootstrap:e,draftModel:t,draftProvider:a,selectedApp:i,selectedAppId:s,selectedCloudProject:u,selectedProject:d,selectedSession:f,selectedSessionId:b,selectedSessionLinkedProject:p}){const y=f?.workspaceKind==="local_project"?f.workspaceId??null:p?.id??null,k=_n(b)&&!f,w=f?Ki(f.workspaceKind):!1,T=Gi(f),A=f?yB(f):!1,H=f?.cwd&&(!w||T)?fw(f.cwd):null,W=e?.providers??null,B=oi(d,e?.cloudProjects??[]),M=OB({draftProvider:a,hasSelectedCloudProject:!!u,selectedSessionHybridWorkspace:T}),j=Ls(M,t,W),L=Uo(e?.preferences),D=k?null:f?w?f.workspaceKind??"sandbox":A?"sandbox":y?"local_project":f.workspaceKind??(f.appId?"sandbox_app":H?"local_project":null):u?"sandbox":d?"local_project":s?"sandbox_app":null,q=k?null:f?w&&!T||A?null:y||(f.workspaceId??f.appId??H):u?null:d?.id??s,$=k?null:f?w?f.workspaceId??null:A?null:y??f.workspaceId??f.appId??H:u?null:d?.id??s,X=e?.account??null,ae=!e||X?.state==="loading"||X?.state==="switching",ie=!ae&&X?.state==="signed_out",ue=ae?null:ie?"Sign in":X?.label??X?.activeProfile?.handle??"Account",ge=zB(X),Te=ge?`Welcome, ${ge}`:"Welcome",Be=f?.workspaceName??f?.appName??u?.name??d?.name??i?.name??null,Pe=Ki(D)?"cloud":"local",U=d?.name??p?.name??(f?.workspaceKind==="local_project"?f.workspaceName:null)??"Local workspace",le=(Pe==="cloud"?Be:null)??u?.name??B?.name??d?.name??"Cloud workspace",he=!!(u?.id||B?.id||f?.cloudProjectId||Pe==="cloud");return{account:X,accountLabel:ue,accountPending:ae,accountSignedOut:ie,activeModel:j,activeProvider:M,activeWorkspaceAppId:q,activeWorkspaceId:$,activeWorkspaceKind:D,activeWorkspaceLocation:Pe,appDefaults:L,cloudLinked:he,cloudTargetName:le,localTargetName:U,selectedCodexHistoryPending:k,selectedSessionCloudWorkspace:w,selectedSessionLocalPathWorkspaceId:H,selectedSessionPendingCloudStart:A,selectedSessionProjectId:y,startMessage:Te,workspaceName:Be}}function UB({accountPending:e,accountSignedOut:t,activeWorkspaceLocation:a,bootstrap:i,busy:s,cloudLinked:u,selectedCloudProject:d,selectedProject:f,selectedSession:b,pendingWorkspaceTarget:p,workspaceStates:y,workspaceBusy:k}){const w=oi(f,i?.cloudProjects??[]),A=!!!f?.linkedSandboxProject?.projectId||!!w,H=_.useMemo(()=>{const $=(i?.localProjects??[]).map(ue=>({value:`local:${ue.id}`,label:ue.name,detail:ue.workspacePath,kind:"local"})),X=(i?.cloudProjects??[]).map(ue=>({value:`cloud:${ue.id}`,label:ue.name,detail:ue.organizationName??ue.sourceLabel??"OpenPond Cloud",kind:"cloud"})),ae=f?`local:${f.id}`:d?`cloud:${d.id}`:"none",ie=[...$,...X].find(ue=>ue.value===ae)??null;return{value:ae,label:ie?.label??"Select Project",detail:ie?.detail??"Choose a project for local or cloud work",busy:k||s,options:[...$,...X,...jB,{value:"none",label:"Don't work in a project",detail:"General chat without project files",kind:"none"}]}},[i?.cloudProjects,i?.localProjects,s,d,f,k]),W=!!(u||f),B=!!(d?.id||w?.id||b?.cloudProjectId||Gi(b)),M=f?y[f.id]??null:null,j=l$(M,{branch:f?.linkedSandboxProject?.defaultBranch??null,path:f?.workspacePath??b?.cwd??null,linkedCloudSourceKnown:f?.linkedSandboxProject?.projectId&&A?!!f.linkedSandboxProject.lastUploadedCommit||!M?.headCommit:!0}),L=c$(f,d??w,M,{cloudLinkTrusted:A}),D=u$(f,M,{cloudLinkTrusted:A}),q=_.useMemo(()=>{const $={value:"local",label:f?"Local checkout":"Local",detail:f?"Use the selected checkout on this machine.":"Use an app-managed task workspace on this machine.",stateNote:f?j:"App-managed local task workspace",disabled:!1,disabledReason:null},X={value:"hybrid",label:"Hybrid",detail:"Use your selected model with hosted sandbox edits.",stateNote:B?L:"upload required",disabled:e||t||!B,disabledReason:t?"Add an OpenPond account before using Hybrid.":"Upload/sync this Project to Cloud before using Hybrid."},ae={value:"cloud",label:"Hosted",detail:"Run with hosted compute, with or without a Project.",stateNote:f||d?L:"Projectless hosted task",disabled:e||t,disabledReason:t?"Add an OpenPond account before using Cloud.":e?"Checking OpenPond account.":null},ie={value:"upload_cloud",label:"Upload/sync to cloud",detail:"Push local source to OpenPond Git before cloud work.",stateNote:D,disabled:e||t||!f,disabledReason:t?"Add an OpenPond account before uploading source.":"Select a local Project before uploading source."},ue=a==="cloud"?"local":"cloud",ge=ue==="local"?$:ae;let Te=a==="cloud"?ae:$;return p==="cloud"?Te=ae:p==="local"?Te=$:(Gi(b)||p==="hybrid")&&(Te=X),{value:Te.value,label:Te.label,detail:Te.stateNote||Te.detail,busy:k,action:{...ge,label:ue==="cloud"?"Hosted":f?"Local checkout":"Check out locally"},uploadAction:f?ie:null,options:[$,X,ae]}},[a,e,t,u,W,L,B,j,p,f,b,D,k]);return{projectTarget:H,workspaceTarget:q}}function Da(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}function AA(e){return Da(e.name||e.gitRepo||e.id)}function hZ(e){return`@${AA(e)}`}function RA(e){return Array.from(e.matchAll(/(?:^|\s)@([A-Za-z0-9_-]+)/g)).map(t=>Da(t[1]??"")).filter(Boolean)}function LB(e,t){const a=RA(e);if(a.length===0)return!1;const i=new Set([Da(t.id),AA(t),t.gitRepo?Da(t.gitRepo):""].filter(Boolean));return a.some(s=>i.has(s))}function TA(e){return e.filter(t=>t.sandbox)}function HB(e,t){const a=RA(e);if(a.length===0)return null;const i=new Map;for(const s of a){const u=t.find(d=>{const f=Da(d.id),b=Da(d.name),p=d.gitRepo?Da(d.gitRepo):"";return s===f||s===b||s===p});u&&i.set(u.id,u)}return i.size===1?Array.from(i.values())[0]??null:null}function gZ(e,t){const a=e.slice(0,t),i=a.match(/(?:^|\s)@([A-Za-z0-9_-]*)$/);if(!i||typeof i.index!="number")return null;const s=a.slice(i.index).indexOf("@");return s<0?null:{query:Da(i[1]??""),start:i.index+s}}function $B(e){return new Set(e.map(t=>t.id))}function cx(e,t){const a=e?.linkedOpenPondApp??null;return a?.appId&&t.has(a.appId)?a:null}function qB({bootstrap:e,codexHistorySessions:t,selectedProjectId:a,selectedSessionId:i,selectedAppId:s,sessions:u}){const d=_.useMemo(()=>e?.apps.find(ie=>ie.id===s)??null,[e?.apps,s]),f=_.useMemo(()=>new Map((e?.localProjects??[]).map(ie=>[ie.id,ie])),[e?.localProjects]),b=_.useMemo(()=>new Map((e?.cloudProjects??[]).map(ie=>[ie.id,ie])),[e?.cloudProjects]),p=_.useMemo(()=>jI(a),[a]),y=_.useMemo(()=>p?.kind==="local"?f.get(p.id)??null:null,[f,p]),k=_.useMemo(()=>p?.kind==="cloud"?b.get(p.id)??null:null,[b,p]),w=_.useMemo(()=>$B(e?.apps??[]),[e?.apps]),T=_.useMemo(()=>TA(e?.apps??[]),[e?.apps]),A=_.useMemo(()=>{const ie=[];for(const ue of e?.localProjects??[]){const ge=cx(ue,w);ge&&ie.push([ge.appId,ue.id])}return new Map(ie)},[e?.localProjects,w]),H=_.useMemo(()=>new Set((e?.localProjects??[]).map(ie=>ie.id)),[e?.localProjects]),W=_.useMemo(()=>YI(e?.localProjects??[]),[e?.localProjects]),B=_.useRef([]),M=_.useMemo(()=>BB(u,t,B.current),[t,u]),j=_.useMemo(()=>M.find(ie=>ie.id===i)??null,[M,i]),L=_.useMemo(()=>{if(!j)return null;if(j.localProjectId)return f.get(j.localProjectId)??null;if(j.workspaceKind==="local_project")return j.workspaceId?f.get(j.workspaceId)??null:null;const ie=Mq(j,H,W);if(ie)return f.get(ie)??null;if(!j.appId)return null;const ue=A.get(j.appId);return ue?f.get(ue)??null:null},[A,f,H,W,j]),D=_.useMemo(()=>j?.cloudProjectId?b.get(j.cloudProjectId)??null:null,[b,j]),q=y??L,$=k??D,X=_.useMemo(()=>cx(q,w),[w,q]),ae=_.useMemo(()=>X?e?.apps.find(ie=>ie.id===X.appId)??null:null,[e?.apps,X]);return{cloudProjectById:b,currentAppIds:w,linkedProjectByAppId:A,localProjectById:f,mentionableSandboxApps:T,selectedApp:d,selectedCloudProject:$,selectedProject:q,selectedProjectLinkedApp:ae,selectedProjectLinkedOpenPondApp:X,selectedSession:j,selectedSessionLinkedProject:L,sidebarSessions:M}}function BB(e,t,a){const i=new Map;for(const p of e){const y=ux(p);i.set(y,p)}for(const p of t){const y=ux(p),k=i.get(y);i.set(y,k?VB(k,p):p)}const s=Array.from(i.entries());if(!a)return s.sort((p,y)=>dx(p[1],y[1])).map(p=>p[1]);const u=[],d=new Set;for(const p of a){const y=i.get(p);y&&(u.push([p,y]),d.add(p))}const b=[...s.filter(([p])=>!d.has(p)).sort((p,y)=>dx(p[1],y[1])),...u];return a.splice(0,a.length,...b.map(([p])=>p)),b.map(p=>p[1])}function VB(e,t){return{...e,metadata:FB(e.metadata,t.metadata),status:e.status==="active"||t.status==="active"?"active":e.status,updatedAt:KB(e.updatedAt,t.updatedAt)}}function ux(e){return e.codexThreadId?`codex:${e.codexThreadId}`:`session:${e.id}`}function dx(e,t){const a=mx(t)-mx(e);return a!==0?a:e.title.localeCompare(t.title)}function FB(e,t){const a={...e??{},...t??{}};return Object.keys(a).length>0?a:void 0}function KB(e,t){const a=Date.parse(e);if(!Number.isFinite(a))return t;const i=Date.parse(t);return Number.isFinite(i)&&i>a?t:e}function mx(e){const t=Date.parse(e.updatedAt);if(Number.isFinite(t))return t;const a=Date.parse(e.createdAt);return Number.isFinite(a)?a:0}function GB(e){return!!(e&&Ki(e.workspaceKind)&&!Gi(e)&&e.provider!=="openpond")}function ZB(e,t){const a=DI(e,t);return`${e.id}\0${a.provider}\0${a.model}`}function WB({activeWorkspaceId:e,activeWorkspaceKind:t,appDispatch:a,connection:i,expandProject:s,linkedProjectByAppId:u,providerSettings:d,selectedAppId:f,selectedSession:b,selectedSessionId:p,selectedSessionProjectId:y,setDiffPanelExpanded:k,setDraftModel:w,setDraftProvider:T,setError:A,setSelectedAppId:H,setSelectedProjectId:W,setSessions:B,setTerminalOpen:M,toast:j}){const L=_.useRef(null);_.useEffect(()=>{if(!f)return;const D=y??(p?null:u.get(f)??null);if(!D)return;const q=Dt("local",D);H(null),W(q),s(q)},[s,u,f,p,y,H,W]),_.useEffect(()=>{if(!j||j.persistent)return;const D=window.setTimeout(()=>{a({type:"clearToast",toastId:j.id})},j.durationMs??(j.tone==="error"?7e3:3500));return()=>window.clearTimeout(D)},[a,j]),_.useEffect(()=>{function D(q){(q.metaKey||q.ctrlKey)&&q.key==="`"&&(q.preventDefault(),M($=>!$))}return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[M]),_.useEffect(()=>{k(!1)},[e,t,k]),_.useEffect(()=>{if(!p){L.current=null;return}if(!b||b.id!==p)return;const D=ZB(b,d);if(L.current===D)return;L.current=D;const q=DI(b,d);T(q.provider),w(q.model)},[d,b,p,w,T]),_.useEffect(()=>{!i||!b||!GB(b)||de.patchSession(i,b.id,{provider:"openpond"}).then(D=>{B(q=>q.map($=>$.id===D.id?D:$)),T("openpond"),w(q=>Ls("openpond",q))}).catch(D=>{A(D instanceof Error?D.message:String(D))})},[i,b,w,T,A,B])}function YB({connection:e,setError:t}){return _.useCallback(async(a,i)=>{if(!e){const s=new Error("OpenPond App server is not connected.");throw t(s.message),s}t(null);try{await de.resolveApproval(e,a,{decision:i})}catch(s){const u=s instanceof Error?s.message:String(s);throw t(u),s}},[e,t])}function JB({activeProvider:e,contextCompaction:t,contextUsage:a,pinnedItems:i,pinnedPreviewKeys:s,pinnedProjects:u,projectRows:d,visibleProjectRows:f}){const b=_.useMemo(()=>$H(i,s),[i,s]),p=_.useMemo(()=>eA({provider:e,snapshot:a,preferences:t}),[e,t,a]),y=_.useMemo(()=>Array.from(new Set([...u,...f].filter(Db).map(w=>w.project.id))),[u,f]);return{commandProjectRows:_.useMemo(()=>d,[d]),contextWindowStatus:p,pinnedRows:b,sidebarWorkspaceAppIds:y}}function XB({appDispatch:e,expandProject:t,linkedProjectByAppId:a,requestComposerFocus:i,onBeginNewChat:s,setMentionedAppId:u}){return _.useCallback((d=null)=>{s?.();const f=d?.id?a.get(d.id)??null:null;if(f){const b=Dt("local",f);u(null),e({type:"selectProject",projectId:b}),t(b),i();return}u(null),e({type:"beginNewChat",appId:d?.id??null}),i()},[e,t,a,s,i,u])}const EA={slack:["slack"],microsoft_teams:["teams","microsoft-teams","microsoft_teams"],github:["github","gh"],google:["google","drive","google-drive","docs"],x:["x","twitter"],mcp:["mcp","openpond-mcp"]};function vZ(e){return`@${e.token}`}function QB(e){return`@${o8(e)}`}function e8(e){const t=new Map;for(const a of e){if(!a.connected||a.statusSource!=="integration_connection")continue;const i=t.get(a.providerFamily)??[];i.push(a),t.set(a.providerFamily,i)}return Array.from(t.entries()).map(([a,i])=>{const s=i[0],u=wc(i.flatMap(k=>k.capabilities.map(w=>w.id))),d=wc(i.flatMap(k=>k.capabilityLabels)),f=wc(i.flatMap(k=>k.connections.map(w=>w.id).filter(r8))),b=wc(i.map(k=>k.id)),p=wc(i.map(k=>k.setupSurface)),y=a8(a);return{provider:a,label:s.providerLabel,detail:d.length>0?d.slice(0,4).join(", "):s.description,token:y,tokens:n8(i),ref:{kind:"integration",provider:a,appIds:b,setupSurfaces:p,...f.length>0?{connectionIds:f}:{},...u.length>0?{capabilities:u}:{}}}})}function bZ(e,t){const a=Da(t);return e.filter(i=>a?i.tokens.some(s=>s.includes(a)):!0).slice(0,8)}function t8(e,t){const a=i8(e);if(a.length===0)return[];const i=new Map;for(const s of a){const u=t.find(d=>d.tokens.includes(s));u&&i.set(u.provider,u)}return Array.from(i.values())}function yZ(e,t){if(t.length===0)return[];const a=[];for(const i of e.matchAll(/(?:^|\s)@([A-Za-z0-9_-]+)/g)){const s=i[1]??"",u=Da(s);if(!u)continue;const d=t.find(k=>k.tokens.includes(u));if(!d)continue;const b=(i[0]??"").indexOf("@");if(b<0||typeof i.index!="number")continue;const p=i.index+b,y=`@${s}`;a.push({detail:d.detail,displayText:QB(d),end:p+y.length,label:d.label,provider:d.provider,start:p,text:y})}return a}function n8(e){return wc(e.flatMap(t=>[...EA[t.providerFamily],t.providerFamily,t.id,t.label,t.shortLabel]).map(Da).filter(Boolean))}function a8(e){return Da(EA[e][0]??e)}function o8(e){return e.provider==="github"?"GitHub":e.provider==="x"?"X":e.provider==="mcp"?"MCP":e.label}function i8(e){return Array.from(e.matchAll(/(?:^|\s)@([A-Za-z0-9_-]+)/g)).map(t=>Da(t[1]??"")).filter(Boolean)}function wc(e){return Array.from(new Set(e))}function r8(e){return typeof e=="string"&&e.length>0}function s8({bootstrap:e,connectedAppRows:t,mentionableSandboxApps:a,runtimeIndexes:i,selectedApp:s,selectedCloudProject:u,selectedProject:d,selectedSession:f,selectedSessionId:b}){const p=_.useMemo(()=>{const A=new Map;for(const H of e?.cloudProjects??[]){const W=A.get(H.teamId)??[];W.push(H.id),A.set(H.teamId,W)}return A},[e?.cloudProjects]),k=!!(f||s||d||u)?[]:a,w=_.useMemo(()=>e8(t),[t]),T=_.useMemo(()=>bA(i,b),[i,b]);return{chatMentionApps:k,cloudProjectIdsByTeam:p,connectedAppMentions:w,pendingApproval:T}}const MA="openpond.codexPermissionMode",PA="openpond.codexReasoningEffort";function Ad(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function l8(e){return e==="default"||e==="auto-review"||e==="full-access"?e:null}function c8(e){return e==="low"||e==="medium"||e==="high"||e==="xhigh"?e:null}function OA(e=Ad()){if(!e)return{};const t=l8(e.getItem(MA)),a=c8(e.getItem(PA));return{...t?{codexPermissionMode:t}:{},...a?{codexReasoningEffort:a}:{}}}function u8(e,t=Ad()){try{t?.setItem(MA,e)}catch{}}function d8(e,t=Ad()){try{t?.setItem(PA,e)}catch{}}function fx(e,t=Ad()){const a=Uo(e),i=OA(t);return{codexPermissionMode:i.codexPermissionMode??a.codexPermissionMode??If,codexReasoningEffort:i.codexReasoningEffort??a.codexReasoningEffort??Af}}function m8(e,t=Ad()){const a=Uo(e),i=OA(t),s={};return i.codexPermissionMode&&i.codexPermissionMode!==a.codexPermissionMode&&(s.codexPermissionMode=i.codexPermissionMode),i.codexReasoningEffort&&i.codexReasoningEffort!==a.codexReasoningEffort&&(s.codexReasoningEffort=i.codexReasoningEffort),s}function f8({connection:e,setBootstrap:t,setCodexPermissionMode:a,setCodexReasoningEffort:i,setError:s}){const u=_.useCallback(f=>{a(f),u8(f),e&&de.savePreferences(e,{codexPermissionMode:f}).then(()=>{t(b=>b&&{...b,preferences:{...b.preferences,codexPermissionMode:f}})}).catch(b=>{s(b instanceof Error?b.message:String(b))})},[e,t,a,s]),d=_.useCallback(f=>{i(f),d8(f),e&&de.savePreferences(e,{codexReasoningEffort:f}).then(()=>{t(b=>b&&{...b,preferences:{...b.preferences,codexReasoningEffort:f}})}).catch(b=>{s(b instanceof Error?b.message:String(b))})},[e,t,i,s]);return{changeCodexPermissionMode:u,changeCodexReasoningEffort:d}}const p8=6e4;function Fb(e,t){if(!e)return t;const a=g8(e.updatedAt,t.updatedAt)?{...t,pinned:e.pinned,savedForLater:e.savedForLater,archived:e.archived,order:e.order,status:e.status,updatedAt:e.updatedAt}:t;return NA(e,a)?e:a}function h8(e,t){const a=Fb(e,t),i=e?{...a,pinned:e.pinned,savedForLater:e.savedForLater,archived:e.archived,order:e.order,updatedAt:e.updatedAt}:a;return e&&NA(e,i)?e:i}function Fu(e,t){let a=!1,i=!1;const s=e.map(u=>{if(u.id!==t.id)return u;a=!0;const d=Fb(u,t);return d!==u&&(i=!0),d});return a?i?s:e:[t,...e]}function Ff(e,t){let a=!1,i=!1;const s=e.map(u=>{if(u.id!==t.id)return u;a=!0;const d=h8(u,t);return d!==u&&(i=!0),d});return a?i?s:e:[t,...e]}function kv(e,t,a,i=Date.now()){const s=new Map(e.map(u=>[u.id,u]));return t.map(u=>{const d=s.get(u.id);if(d&&a){const f=b8(d,u,a,i);if(f)return f}return Fb(d,u)})}function px(e,t,a,i=Date.now()){const s=new Map(e.map(p=>[p.id,p])),u=new Map(kv(e,t,a,i).map(p=>[p.id,p])),d=new Set(s.keys()),f=t.filter(p=>!d.has(p.id)).map(p=>u.get(p.id)??p),b=e.map(p=>{const y=u.get(p.id);return y||(jA(p,t)?p:null)}).filter(p=>!!p);return[...f,...b]}function jA(e,t){const a=Date.parse(e.updatedAt);if(!Number.isFinite(a))return!1;const i=v8(t);return i===null||a>=i}function hx(e,t,a,i=Date.now()){const s=new Map(t.map(u=>[u.id,u]));for(const u of a){const d=s.get(u.id);d&&(zA(d,u)||(e[u.id]=i))}}function g8(e,t){const a=Date.parse(e),i=Date.parse(t);return Number.isFinite(a)&&Number.isFinite(i)&&a>i}function NA(e,t){return JSON.stringify(e)===JSON.stringify(t)}function v8(e){let t=null;for(const a of e){const i=Date.parse(a.updatedAt);Number.isFinite(i)&&(t=t===null?i:Math.max(t,i))}return t}function b8(e,t,a,i){const s=a[t.id];return s===void 0?null:i-s>p8||zA(e,t)?(delete a[t.id],null):{...t,pinned:e.pinned,savedForLater:e.savedForLater,archived:e.archived,order:e.order}}function zA(e,t){return e.pinned===t.pinned&&e.savedForLater===t.savedForLater&&e.archived===t.archived&&e.order===t.order}const DA=800,y8=5e3,gx=5e4,S8=16,_8=3e4,yo=new Map;function x8(e,t){return yo.get(LA(e,t))?.payload??null}async function UA(e,t,a={}){const i=LA(e,t),s=yo.get(i),u=a.limit??DA,d=a.tail??!0;if(s?.promise)return s.promise;if(!a.force&&d&&s?.payload&&Date.now()-s.fetchedAt<=_8)return vx(i,s),s.payload;const f=!!(a.force&&d&&s?.payload),b=f?s?.payload?.events.at(-1)?.id:void 0,p=de.codexHistoryThreadIncremental(e,t,{afterEventId:b,limit:u,revision:f?s?.revision:void 0,tail:d}).then(y=>{const k=yo.get(i)?.payload??s?.payload;if(y.unchanged){if(!k)throw new Error("Codex history revision matched without a cached thread.");return yo.set(i,{fetchedAt:Date.now(),payload:k,revision:y.revision}),vx(i,yo.get(i)),k}const w={session:y.session,events:y.events},T=d&&k&&!y.reset?{...w,events:k8(k.events,w.events)}:w;return yo.set(i,{fetchedAt:Date.now(),payload:T,revision:y.revision}),bx(),T}).catch(y=>{throw yo.get(i)?.promise===p&&yo.delete(i),y});return yo.set(i,{fetchedAt:s?.fetchedAt??0,payload:s?.payload,promise:p,revision:s?.revision}),bx(),p}function LA(e,t){return`${e.serverUrl}
|
|
139
139
|
${e.token}
|
|
140
140
|
${t}`}function vx(e,t){yo.delete(e),yo.set(e,t)}function bx(){for(;yo.size>S8;){const e=yo.keys().next().value;if(!e)return;yo.delete(e)}}function k8(e,t){const a=new Map;for(const i of e)a.set(i.id,i);for(const i of t)a.set(i.id,i);return Array.from(a.values())}const w8=500,C8=2500,I8=15e3;function A8(e){return e.active?w8:e.surface==="thread"?C8:I8}function Kb(e,t){return!t||e.session.status==="active"?e:{...e,session:{...e.session,status:"active"}}}function R8(e={}){const t={cachedPayload:e.cachedPayload??x8,clearTimer:e.clearTimer??(p=>globalThis.clearTimeout(p)),loadPayload:e.loadPayload??UA,now:e.now??Date.now,setTimer:e.setTimer??((p,y)=>globalThis.setTimeout(p,y))},a=new Map;let i=1;function s(p){const y=E8(p.connection,p.sessionId);let k=a.get(y);k||(k={connection:p.connection,disposed:!1,inFlight:null,latestPayload:t.cachedPayload(p.connection,p.sessionId),nextRefreshAt:null,sessionId:p.sessionId,subscribers:new Map,timer:null},a.set(y,k));const w=i++;return k.subscribers.set(w,p),k.latestPayload&&p.onPayload(k.latestPayload),u(k,0),()=>{const T=a.get(y);if(T){if(T.subscribers.delete(w),T.subscribers.size>0){u(T,f(T));return}T.disposed=!0,b(T),a.delete(y)}}}function u(p,y){if(p.disposed||p.subscribers.size===0||p.inFlight)return;const k=t.now()+Math.max(0,y);p.timer&&p.nextRefreshAt!==null&&p.nextRefreshAt<=k||(b(p),p.nextRefreshAt=k,p.timer=t.setTimer(()=>{p.timer=null,p.nextRefreshAt=null,d(p)},Math.max(0,y)))}async function d(p){if(p.disposed||p.subscribers.size===0||p.inFlight)return;const y=t.loadPayload(p.connection,p.sessionId,{force:!!p.latestPayload});p.inFlight=y;try{const k=await y;if(p.disposed||k===p.latestPayload)return;p.latestPayload=k;for(const w of p.subscribers.values())w.onPayload(k)}catch(k){if(p.disposed)return;for(const w of p.subscribers.values())w.onError?.(k)}finally{p.inFlight===y&&(p.inFlight=null),p.disposed||u(p,f(p))}}function f(p){const y=[...p.subscribers.values()],k=y.some(T=>T.locallyActive||T.reportedActive)||p.latestPayload?.session.status==="active"||Bb(p.latestPayload?.events??[])?.tone==="active",w=y.some(T=>T.surface==="thread")?"thread":"sidebar";return A8({active:k,surface:w})}function b(p){p.timer&&t.clearTimer(p.timer),p.timer=null,p.nextRefreshAt=null}return{subscribe:s}}const T8=R8();function Gb(e){return T8.subscribe(e)}function E8(e,t){return`${e.serverUrl}
|
|
141
141
|
${e.token}
|