openpond 0.2.15 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-server.d.ts +2 -0
- package/dist/app-server.js +1 -1
- package/dist/chunks/{app-layer-SSLVAUNI.js → app-layer-CFIW5CWC.js} +1 -1
- package/dist/chunks/{app-server-runtime-QUC4HPQU.js → app-server-runtime-Q7NJ6PXF.js} +1 -1
- package/dist/chunks/{apps-JEKTEGSW.js → apps-67PSSK6Q.js} +1 -1
- package/dist/chunks/{chunk-YNXFXNQM.js → chunk-BE35DIOI.js} +1 -1
- package/dist/chunks/{chunk-4E5ETWKU.js → chunk-CULWDNK3.js} +334 -332
- package/dist/chunks/{chunk-ZYG2PXY2.js → chunk-G54T4IWQ.js} +1 -1
- package/dist/chunks/{chunk-7I73OREC.js → chunk-GHKJKXDF.js} +1 -1
- package/dist/chunks/{chunk-K4ZKAHLG.js → chunk-MACBJI6D.js} +1 -1
- package/dist/chunks/{chunk-UOQHYTCK.js → chunk-N3KS3AJK.js} +1 -1
- package/dist/chunks/{chunk-FHBQ6OWG.js → chunk-PRA6LX2G.js} +1 -1
- package/dist/chunks/{chunk-VRXXKDF2.js → chunk-Q7QAKAGF.js} +1 -1
- package/dist/chunks/chunk-RB7BWSFJ.js +5 -0
- package/dist/chunks/{chunk-JTQDNX2J.js → chunk-SKKAWYCQ.js} +1 -1
- package/dist/chunks/{chunk-QLZ67Y6C.js → chunk-VL3RGI55.js} +2 -2
- package/dist/chunks/{cli-7YSRAC4Y.js → cli-BCBRWI2M.js} +1 -1
- package/dist/chunks/{configuration-command-DH4ZZUKL.js → configuration-command-D66B4TXT.js} +1 -1
- package/dist/chunks/{core-commands-TUUSA6WB.js → core-commands-D6OHIVUG.js} +1 -1
- package/dist/chunks/{desktop-test-S3RME4QT.js → desktop-test-RBRWSLEM.js} +1 -1
- package/dist/chunks/{extension-D64BYPFY.js → extension-MP3XCX56.js} +1 -1
- package/dist/chunks/{help-AOVE3SSY.js → help-XVBIPQHN.js} +1 -1
- package/dist/chunks/{opchat-KC2FL5TT.js → opchat-NYSALH7B.js} +1 -1
- package/dist/chunks/{organizations-AAES2P7W.js → organizations-ZCQX3SY3.js} +1 -1
- package/dist/chunks/{profile-FRYWK2IE.js → profile-PFR6PWNE.js} +1 -1
- package/dist/chunks/{project-agent-WPW6DWK7.js → project-agent-KSMTTZYC.js} +1 -1
- package/dist/chunks/{sandbox-command-ZHKJZ3FJ.js → sandbox-command-MVBSIKB6.js} +1 -1
- package/dist/chunks/{sandbox-template-SPVQIMG5.js → sandbox-template-2OWCTKBP.js} +1 -1
- package/dist/chunks/{src-LYFCDA5G.js → src-7TTHR4DL.js} +1 -1
- package/dist/chunks/{src-AADCZ2JW.js → src-ITECV3AD.js} +105 -105
- package/dist/chunks/{teams-bot-LD3QORJI.js → teams-bot-IUE3CWSW.js} +1 -1
- package/dist/chunks/{workspaces-P2WNCMXC.js → workspaces-WI56RXUN.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/web/assets/{App-kwt-UxX_.js → App-DQfdLgyV.js} +3 -3
- package/dist/web/assets/{AppDialog-LXQo_7oW.js → AppDialog-BnldMLvF.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-CUqrUrkA.js → AppTerminalPanel-DR5SeX9y.js} +2 -2
- package/dist/web/assets/{AppsView-5J2RX301.js → AppsView-Bu_XEgkd.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-mZ8RjUOr.js → BrowserSidebar-BdKPWbN8.js} +1 -1
- package/dist/web/assets/{CartesianChart-7x3SO8Hj.js → CartesianChart-CSkLcF_5.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-ByC9WJqu.js → CollaborationTabs-C9cRq5ob.js} +1 -1
- package/dist/web/assets/{CommandMenu-CqDb2Kb2.js → CommandMenu-Deqzk3u9.js} +1 -1
- package/dist/web/assets/{CommunityView-BmxYkWqC.js → CommunityView-B5dKYacH.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-2Tyj9KOQ.js → ComposerCreateImproveStrip-5LPlQFN4.js} +1 -1
- package/dist/web/assets/{GetStartedView-1WYkmevY.js → GetStartedView-DmuGykfx.js} +1 -1
- package/dist/web/assets/HostedModelLearningReview-BRPSFNza.js +1 -0
- package/dist/web/assets/{HostedModelLearningSettings-Brza5hSD.js → HostedModelLearningSettings-BsdX-CkH.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-C4WtQKER.js → LabModelVersionDetailPage-BUO5cpDh.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-D3g6E0Ap.js → LabSkillSidebar-mTpdM-G8.js} +1 -1
- package/dist/web/assets/{LabsRoute-BO0yEsCR.js → LabsRoute-BhfxBg5_.js} +4 -4
- package/dist/web/assets/{MainChatThread-CKPR_rY0.js → MainChatThread-BAxA18lN.js} +2 -2
- package/dist/web/assets/{MainPane-B8mDzSqi.js → MainPane-Dv5USGqR.js} +4 -4
- package/dist/web/assets/{MarkdownText-D6_UI4Ly.js → MarkdownText-DWGLUbdE.js} +1 -1
- package/dist/web/assets/{Messages-DptbENmQ.js → Messages-CuhCtaya.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-CF1NTAR6.js → NativeSkillSidebar-B8OMVpPT.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-CwlpLsXW.js → NewExperienceSwitcher-kIKV8_Wd.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-Ls4K9a5S.js → NewProjectDialog-B-7dHoT6.js} +1 -1
- package/dist/web/assets/{OutputsPage-ClNuidPW.js → OutputsPage-C4DRT8pF.js} +1 -1
- package/dist/web/assets/{ProjectsPage-Sj83NsdP.js → ProjectsPage-CLjW6Kc3.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-m5-cI0NL.js → RightChatPanelStack-C4-4VLb-.js} +1 -1
- package/dist/web/assets/{RightSidebarHomePanel-B--t--OJ.js → RightSidebarHomePanel-CVbfOg2p.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-JVfMtGMs.js → ScheduledWorkPage-CWzwbOOZ.js} +1 -1
- package/dist/web/assets/SettingsView-BIwO8elm.js +9 -0
- package/dist/web/assets/{SettingsView-B9Tn0_zX.css → SettingsView-BaWWvIJW.css} +1 -1
- package/dist/web/assets/{TeamChatView-D8ilbncz.js → TeamChatView-miR9w_53.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-A6nSxm5C.js → TerminalOverlay-BOmx_hJX.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-CwpnBbuN.js → TrainingCreationPanel-DSRejaYV.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-B_Gh_0yq.js → TrainingDraftPanel-XBH6Uh0_.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-qTX3k9-f.js → UsageSettingsSection-DROtDdak.js} +1 -1
- package/dist/web/assets/{WorkSidebarPanel-B-fDRRRs.js → WorkSidebarPanel-CHwObGs6.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-CfvvifJg.js → WorkspaceDiffPanel-BoB_1R8w.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-BL6WHWLO.js → WorkspaceEnvironmentMenu-Dvqy2NJP.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-pyZQJL_2.js → WorkspaceGitDialogs-BC45mifk.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-C2cNf0UO.js → WorkspaceMonacoEditor-cDO3Elh0.js} +3 -3
- package/dist/web/assets/{arrow-up-right-BQv8RCGD.js → arrow-up-right-Dv3nebbh.js} +1 -1
- package/dist/web/assets/{chat-file-links-C3erG0P2.js → chat-file-links-DQYtkwit.js} +1 -1
- package/dist/web/assets/chevron-up-BUOpWd2a.js +1 -0
- package/dist/web/assets/{clipboard-BSPYX7yq.js → clipboard-CnNPmg50.js} +1 -1
- package/dist/web/assets/{cloud-upload-CJVhhG6P.js → cloud-upload-DisZOwXE.js} +1 -1
- package/dist/web/assets/{cssMode-RCJXPUO-.js → cssMode-Bd8sFlb5.js} +1 -1
- package/dist/web/assets/{folder-open-2a5riVSG.js → folder-open-D0PIN0Cj.js} +1 -1
- package/dist/web/assets/{folder-plus-DuVvIFve.js → folder-plus-DTNZNwa9.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-BifoV1dR.js → git-commit-horizontal-C0QdA7uv.js} +1 -1
- package/dist/web/assets/{htmlMode-DnEOXzjT.js → htmlMode-Cu-nKV7Z.js} +1 -1
- package/dist/web/assets/{index-B5RqBp_p.js → index-De4k_YMo.js} +2 -2
- package/dist/web/assets/{info-BWvLCbJ2.js → info-B-n_omgE.js} +1 -1
- package/dist/web/assets/{jsonMode-DQfml7E4.js → jsonMode-B377iBCv.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-WKs-7xHz.js → lspLanguageFeatures-BBHfVtV0.js} +1 -1
- package/dist/web/assets/{minimize-2-C-_iqAbt.js → minimize-2-C6JQGKgk.js} +1 -1
- package/dist/web/assets/{monaco.contribution-B5y78DUP.js → monaco.contribution-B0l6Oe3a.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DCekL-SI.js → monaco.contribution-BDLeUQLG.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Qc1u700n.js → monaco.contribution-CCSCAu65.js} +2 -2
- package/dist/web/assets/{monaco.contribution-B29c98Aa.js → monaco.contribution-CIq6sYw4.js} +2 -2
- package/dist/web/assets/{play-DsP3gpGK.js → play-B5O4Hz_W.js} +1 -1
- package/dist/web/assets/{python-CJ1QdM8L.js → python-BQkq0gZA.js} +1 -1
- package/dist/web/assets/{refresh-cw-DaASy_i0.js → refresh-cw-D2E-pp4H.js} +1 -1
- package/dist/web/assets/{save-BBQ7L8VS.js → save-CPNNuWwp.js} +1 -1
- package/dist/web/assets/{square-DTl9YrMp.js → square-DUgXVoF0.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-D-DNRZ-D.js → toggleHighContrast-BbQBtO9I.js} +1 -1
- package/dist/web/assets/{tsMode-CmWbxnjM.js → tsMode-CsVhouTE.js} +1 -1
- package/dist/web/assets/{upload-juEp2zRQ.js → upload-t7xHt3GY.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-DF_bIseW.js → useLocalAgentSchedules-D4lJelHt.js} +1 -1
- package/dist/web/assets/{wifi-off-DrkIaS1O.js → wifi-off-B_QPKtA-.js} +1 -1
- package/dist/web/assets/{workers-LygfviY3.js → workers-p7TrE4Qa.js} +1 -1
- package/dist/web/assets/{yaml-BIpimtDQ.js → yaml-C8adeAyH.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-6C2EXO4H.js +0 -5
- package/dist/web/assets/HostedModelLearningReview-DHahsQJH.js +0 -1
- package/dist/web/assets/SettingsView-B7FnZ-b0.js +0 -9
- package/dist/web/assets/chevron-up-D9MMQKU3.js +0 -1
package/dist/web/assets/{UsageSettingsSection-qTX3k9-f.js → UsageSettingsSection-DROtDdak.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as f,j as l}from"./index-
|
|
1
|
+
import{r as f,j as l}from"./index-De4k_YMo.js";import{b4 as ia,aX as kt,bi as la,aB as oa,v as Te}from"./App-DQfdLgyV.js";import{A as sa}from"./arrow-up-right-Dv3nebbh.js";import{w as ca,c as me,s as ua,i as le,a as _e,u as jt,r as Fe,b as ze,S as da,d as oe,e as ma,p as At,f as fa,g as va,h as ha,j as pa,k as ga,l as ue,m as ya,n as nt,o as ba,q as xa,t as ka,v as ja,x as Aa,y as je,z as $e,A as Le,B as Pa,C as Pt,R as Sa,D as Ia,E as z,F as Ta,G as wa,H as ne,I as Oa,J,K as Q,L as St,M as It,N as Tt,O as Ca,P as Na,Q as rt,T as Ma,U as it,V as Ea,W as pe,X as Ue,Y as Da,Z as wt,_ as $a,$ as La,a0 as Ba,a1 as We,a2 as $,a3 as Ot,a4 as Ra,a5 as qa,a6 as Ka,a7 as _a,a8 as Fa,a9 as za,aa as Ct,ab as Ua,ac as Wa,ad as Ha,ae as lt,af as Nt,ag as Ga,ah as Va,ai as Ya,aj as Xa,ak as Za,al as Ja,am as Qa,an as en,ao as ot,ap as tn,aq as an,ar as nn,as as rn,at as ln,au as on,av as sn}from"./CartesianChart-CSkLcF_5.js";const Mt=Math.cos,ge=Math.sin,R=Math.sqrt,ye=Math.PI,Ae=2*ye,He={draw(e,t){const a=R(t/ye);e.moveTo(a,0),e.arc(0,0,a,0,Ae)}},cn={draw(e,t){const a=R(t/5)/2;e.moveTo(-3*a,-a),e.lineTo(-a,-a),e.lineTo(-a,-3*a),e.lineTo(a,-3*a),e.lineTo(a,-a),e.lineTo(3*a,-a),e.lineTo(3*a,a),e.lineTo(a,a),e.lineTo(a,3*a),e.lineTo(-a,3*a),e.lineTo(-a,a),e.lineTo(-3*a,a),e.closePath()}},Et=R(1/3),un=Et*2,dn={draw(e,t){const a=R(t/un),n=a*Et;e.moveTo(0,-a),e.lineTo(n,0),e.lineTo(0,a),e.lineTo(-n,0),e.closePath()}},mn={draw(e,t){const a=R(t),n=-a/2;e.rect(n,n,a,a)}},fn=.8908130915292852,Dt=ge(ye/10)/ge(7*ye/10),vn=ge(Ae/10)*Dt,hn=-Mt(Ae/10)*Dt,pn={draw(e,t){const a=R(t*fn),n=vn*a,r=hn*a;e.moveTo(0,-a),e.lineTo(n,r);for(let i=1;i<5;++i){const o=Ae*i/5,u=Mt(o),d=ge(o);e.lineTo(d*a,-u*a),e.lineTo(u*n-d*r,d*n+u*r)}e.closePath()}},we=R(3),gn={draw(e,t){const a=-R(t/(we*3));e.moveTo(0,a*2),e.lineTo(-we*a,-a),e.lineTo(we*a,-a),e.closePath()}},N=-.5,M=R(3)/2,Be=1/R(12),yn=(Be/2+1)*3,bn={draw(e,t){const a=R(t/yn),n=a/2,r=a*Be,i=n,o=a*Be+a,u=-i,d=o;e.moveTo(n,r),e.lineTo(i,o),e.lineTo(u,d),e.lineTo(N*n-M*r,M*n+N*r),e.lineTo(N*i-M*o,M*i+N*o),e.lineTo(N*u-M*d,M*u+N*d),e.lineTo(N*n+M*r,N*r-M*n),e.lineTo(N*i+M*o,N*o-M*i),e.lineTo(N*u+M*d,N*d-M*u),e.closePath()}};function xn(e,t){let a=null,n=ca(r);e=typeof e=="function"?e:me(e||He),t=typeof t=="function"?t:me(t===void 0?64:+t);function r(){let i;if(a||(a=i=n()),e.apply(this,arguments).draw(a,+t.apply(this,arguments)),i)return a=null,i+""||null}return r.type=function(i){return arguments.length?(e=typeof i=="function"?i:me(i),r):e},r.size=function(i){return arguments.length?(t=typeof i=="function"?i:me(+i),r):t},r.context=function(i){return arguments.length?(a=i??null,r):a},r}var kn=["type","size","sizeType"];function Re(){return Re=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Re.apply(null,arguments)}function st(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),a.push.apply(a,n)}return a}function ct(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?st(Object(a),!0).forEach(function(n){jn(e,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):st(Object(a)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))})}return e}function jn(e,t,a){return(t=An(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function An(e){var t=Pn(e,"string");return typeof t=="symbol"?t:t+""}function Pn(e,t){if(typeof e!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var n=a.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sn(e,t){if(e==null)return{};var a,n,r=In(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)===-1&&{}.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function In(e,t){if(e==null)return{};var a={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;a[n]=e[n]}return a}var $t={symbolCircle:He,symbolCross:cn,symbolDiamond:dn,symbolSquare:mn,symbolStar:pn,symbolTriangle:gn,symbolWye:bn},Tn=Math.PI/180,wn=e=>{var t="symbol".concat(jt(e));return $t[t]||He},On=(e,t,a)=>{if(t==="area")return e;switch(a){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*Tn;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Cn=(e,t)=>{$t["symbol".concat(jt(e))]=t},Lt=e=>{var t=e.type,a=t===void 0?"circle":t,n=e.size,r=n===void 0?64:n,i=e.sizeType,o=i===void 0?"area":i,u=Sn(e,kn),d=ct(ct({},u),{},{type:a,size:r,sizeType:o}),s="circle";typeof a=="string"&&(s=a);var c=()=>{var b=wn(s),p=xn().type(b).size(On(r,o,s)),x=p();if(x!==null)return x},m=d.className,v=d.cx,y=d.cy,h=ua(d);return le(v)&&le(y)&&le(r)?f.createElement("path",Re({},h,{className:_e("recharts-symbols",m),transform:"translate(".concat(v,", ").concat(y,")"),d:c()})):null};Lt.registerSymbol=Cn;function be(){return be=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},be.apply(null,arguments)}function ut(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),a.push.apply(a,n)}return a}function Bt(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?ut(Object(a),!0).forEach(function(n){Nn(e,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ut(Object(a)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))})}return e}function Nn(e,t,a){return(t=Mn(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function Mn(e){var t=En(e,"string");return typeof t=="symbol"?t:t+""}function En(e,t){if(typeof e!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var n=a.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var E=32,Dn={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle",labelStyle:{}};function $n(e){if(typeof e=="object"&&e!==null&&"strokeDasharray"in e)return String(e.strokeDasharray)}function Ln(e){var t=e.data,a=e.iconType,n=e.inactiveColor,r=E/2,i=E/6,o=E/3,u=t.inactive?n:t.color,d=a??t.type;if(d==="none")return null;if(d==="plainline")return f.createElement("line",{strokeWidth:4,fill:"none",stroke:u,strokeDasharray:$n(t.payload),x1:0,y1:r,x2:E,y2:r,className:"recharts-legend-icon"});if(d==="line")return f.createElement("path",{strokeWidth:4,fill:"none",stroke:u,d:"M0,".concat(r,"h").concat(o,`
|
|
2
2
|
A`).concat(i,",").concat(i,",0,1,1,").concat(2*o,",").concat(r,`
|
|
3
3
|
H`).concat(E,"M").concat(2*o,",").concat(r,`
|
|
4
4
|
A`).concat(i,",").concat(i,",0,1,1,").concat(o,",").concat(r),className:"recharts-legend-icon"});if(d==="rect")return f.createElement("path",{stroke:"none",fill:u,d:"M0,".concat(E/8,"h").concat(E,"v").concat(E*3/4,"h").concat(-E,"z"),className:"recharts-legend-icon"});if(f.isValidElement(t.legendIcon)){var s=Bt({},t);return delete s.legendIcon,f.cloneElement(t.legendIcon,s)}return f.createElement(Lt,{fill:u,cx:r,cy:r,size:E,sizeType:"diameter",type:d})}function Bn(e){var t=e.payload,a=e.iconSize,n=e.layout,r=e.formatter,i=e.inactiveColor,o=e.iconType,u=e.labelStyle,d={x:0,y:0,width:E,height:E},s={display:n==="horizontal"?"inline-block":"block",marginRight:10},c={display:"inline-block",verticalAlign:"middle",marginRight:4};return t.map((m,v)=>{var y=m.formatter||r,h=_e({"recharts-legend-item":!0,["legend-item-".concat(v)]:!0,inactive:m.inactive});if(m.type==="none")return null;var b=typeof u=="object"?Bt({},u):{};b.color=m.inactive?i:b.color||m.color;var p=y?y(m.value,m,v):m.value;return f.createElement("li",be({className:h,style:s,key:"legend-item-".concat(v)},ze(e,m,v)),f.createElement(da,{width:a,height:a,viewBox:d,style:c,"aria-label":m.value==null?"legend icon":"".concat(m.value," legend icon")},f.createElement(Ln,{data:m,iconType:o,inactiveColor:i})),f.createElement("span",{className:"recharts-legend-item-text",style:b},p))})}var Rn=e=>{var t=Fe(e,Dn),a=t.payload,n=t.layout,r=t.align;if(!a||!a.length)return null;var i={padding:0,margin:0,textAlign:n==="horizontal"?r:"left"};return f.createElement("ul",{className:"recharts-default-legend",style:i},f.createElement(Bn,be({},t,{payload:a})))};function qn(){return oe(ma)}var Kn=["contextPayload"];function qe(){return qe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},qe.apply(null,arguments)}function _n(e,t){return Wn(e)||Un(e,t)||zn(e,t)||Fn()}function Fn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as f,j as e}from"./index-B5RqBp_p.js";import{bl as X,m as y,a$ as Y,bi as _,v as w,bH as Z}from"./App-kwt-UxX_.js";import{r as B,s as ee}from"./desktop-files-BQj1J-ob.js";import{F as W}from"./folder-open-2a5riVSG.js";import{M as te}from"./minimize-2-C-_iqAbt.js";import{P as E}from"./MainPane-B8mDzSqi.js";import{T as ie}from"./chat-file-links-C3erG0P2.js";import{M as ne}from"./MarkdownText-D6_UI4Ly.js";import"./cloud-upload-CJVhhG6P.js";import"./arrow-up-right-BQv8RCGD.js";import"./square-DTl9YrMp.js";function Ne({chatMessages:i,connection:r,contextWindowStatus:l,expanded:s,runtimeEvents:c,sessionId:d,showToast:u,onResizeStart:S,onToggleExpanded:L,onUseOutput:P,onHandoffOutput:T,onReviseOutput:D,onAgentPackageInstalled:I}){const[k,H]=f.useState("outputs"),[j,x]=f.useState(null),[o,m]=f.useState(null),[v,N]=f.useState(""),[K,V]=f.useState({}),A=f.useMemo(()=>oe(c),[c]),U=f.useMemo(()=>ae(A),[A]),R=f.useMemo(()=>se(i),[i]),$=f.useMemo(()=>re(i),[i]),O=f.useMemo(()=>le(i),[i]);f.useEffect(()=>()=>{o?.objectUrl&&URL.revokeObjectURL(o.objectUrl)},[o?.objectUrl]);async function b(t){if(!r||!d||t.kind!=="file")return null;x(p(t));try{const n=await w.workspaceTool(r,d,{action:"work_output_read",source:"ui_button",args:{outputId:t.id,revision:t.revision}});if(!n.ok)throw new Error(n.output);const a=pe(n.data),h=typeof a.contentsBase64=="string"?a.contentsBase64:"";if(!h)throw new Error("The output did not include file data.");return new File([de(h)],t.title,{type:t.contentType})}catch(n){return u(n instanceof Error?n.message:"Could not load the output.","error"),null}finally{x(null)}}async function q(t){const n=await b(t);if(!n)return;o?.objectUrl&&URL.revokeObjectURL(o.objectUrl);const a=t.kind==="file"&&(t.contentType.startsWith("text/")||t.contentType==="application/json");N(""),m({output:t,file:n,text:a?await n.text():null,objectUrl:a?null:URL.createObjectURL(n)})}async function G(t){const n=await b(t);n&&(P(n),u("Added the output to the task as input.","success"))}async function z(t,n){const a=n.kind==="file"?await b(n):null;n.kind==="file"&&!a||await T(t,n,a)}async function J(t){if(!(!r||!d)&&window.confirm(`Delete ${t.title} revision ${t.revision} from this device?`)){x(p(t));try{const n=await w.workspaceTool(r,d,{action:"work_output_delete",source:"ui_button",args:{outputId:t.id,revision:t.revision}});if(!n.ok)throw new Error(n.output);o?.output.id===t.id&&m(null),u("Work output deleted.","success")}catch(n){u(n instanceof Error?n.message:"Could not delete the output.","error")}finally{x(null)}}}async function Q(t){if(!r||!d||!window.confirm(`Add ${t.title} version ${t.versionId} to your active Agents profile?`))return;const n=async a=>w.workspaceTool(r,d,{action:"work_agent_package_install",source:"ui_button",args:{outputId:t.id,revision:t.revision,overwrite:a}});x(p(t));try{let a;try{a=await n(!1)}catch(h){if(!(h instanceof Error?h.message:"Agent installation failed.").includes("already exists")||!window.confirm(`${t.agentId} already exists. Replace its active checkout with this immutable version?`))throw h;a=await n(!0)}if(!a.ok)throw new Error(a.output);await I?.(),u(`${t.title} was added to Agents. Its package remains available in this Work task.`,"success")}catch(a){u(a instanceof Error?a.message:"Could not add the Agent package.","error")}finally{x(null)}}return e.jsxs("aside",{className:`workspace-diff-panel work-sidebar-panel ${s?"expanded":""}`,"aria-label":"Work details",children:[s?null:e.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize Work details",onPointerDown:S}),e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Work details",children:[["outputs","Outputs"],["activity","Activity"],["context","Context"]].map(([t,n])=>e.jsx("button",{type:"button",className:`workspace-diff-tab ${k===t?"active":""}`,role:"tab","aria-selected":k===t,onClick:()=>H(t),children:n},t))}),e.jsx("div",{className:"workspace-diff-toolbar-actions",children:e.jsx("button",{type:"button",className:"diff-icon-button",title:s?"Dock sidebar":"Expand sidebar","aria-label":s?"Dock sidebar":"Expand sidebar",onClick:L,children:s?e.jsx(te,{size:14}):e.jsx(X,{size:14})})})]}),e.jsxs("div",{className:"work-sidebar-body",children:[k==="outputs"?o?e.jsxs("div",{className:"work-output-preview",children:[e.jsxs("header",{children:[e.jsx("button",{type:"button",onClick:()=>{o.objectUrl&&URL.revokeObjectURL(o.objectUrl),m(null)},children:"Outputs"}),e.jsxs("strong",{children:[o.output.title," · revision ",o.output.revision]})]}),o.text!==null?e.jsx(ne,{content:o.text}):o.output.kind==="file"&&o.output.contentType.startsWith("image/")&&o.objectUrl?e.jsx("img",{src:o.objectUrl,alt:o.output.title}):o.output.kind==="file"&&o.output.contentType==="application/pdf"&&o.objectUrl?e.jsx("iframe",{src:o.objectUrl,title:o.output.title}):o.output.kind==="file"&&o.output.contentType.startsWith("audio/")&&o.objectUrl?e.jsx("audio",{controls:!0,src:o.objectUrl}):o.output.kind==="file"&&o.output.contentType.startsWith("video/")&&o.objectUrl?e.jsx("video",{controls:!0,src:o.objectUrl}):e.jsx("p",{children:"This file type uses its native application for detailed review."}),e.jsxs("section",{className:"work-output-annotation",children:[e.jsx("label",{htmlFor:"work-output-revision-note",children:"Revision note"}),e.jsx("textarea",{id:"work-output-revision-note",value:v,onChange:t=>N(t.target.value),placeholder:"Describe the exact change to make in the next revision."}),e.jsx("button",{type:"button",disabled:!v.trim(),onClick:()=>{D(o.output,o.file,v.trim()),u(`Prepared revision ${o.output.revision+1}.`,"success")},children:"Revise this version"})]})]}):U.length>0?e.jsx("div",{className:"work-output-list",children:U.map(t=>{const n=t.revisions.find(a=>a.revision===K[t.id])??t.revisions[0];return e.jsxs("article",{className:"work-output-card",children:[e.jsxs("header",{children:[e.jsx(y,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:n.title}),t.revisions.length>1?e.jsxs("label",{className:"work-output-version",children:[e.jsx("span",{children:"Version"}),e.jsx("select",{value:n.revision,onChange:a=>V(h=>({...h,[t.id]:Number(a.target.value)})),children:t.revisions.map(a=>e.jsxs("option",{value:a.revision,children:["Revision ",a.revision]},p(a)))})]}):e.jsxs("small",{children:["Revision ",n.revision]}),e.jsx("small",{children:ce(n)})]})]}),n.validation.length>0?e.jsxs("div",{className:"work-output-validation",children:[e.jsx(Y,{size:13}),e.jsxs("span",{children:[n.validation.filter(a=>a.status==="passed").length," ","checks passed"]})]}):null,e.jsxs("div",{className:"work-output-actions",children:[n.kind==="file"&&n.location.kind==="local"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>{B(M(n))},children:[e.jsx(W,{size:13}),"Reveal"]}),e.jsx("button",{type:"button",onClick:async()=>{const a=await ee(M(n),n.title);a.ok?u("Saved a copy of the Work output.","success"):a.canceled||u("Could not save a copy of the Work output.","error")},children:"Save as"})]}):null,n.kind==="file"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{q(n)},children:"Preview"}),e.jsxs("button",{type:"button",disabled:j===p(n),onClick:()=>{G(n)},children:[e.jsx(E,{size:13}),"Use as input"]})]}):n.kind==="agent_package"?e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{Q(n)},children:"Add to Agents"}):"url"in n&&n.url?e.jsx("button",{type:"button",onClick:()=>window.open(n.url,"_blank","noopener,noreferrer"),children:"Open"}):null,n.kind==="file"&&n.location.kind==="local"?e.jsxs("button",{type:"button",className:"danger",disabled:j===p(n),onClick:()=>{J(n)},children:[e.jsx(ie,{size:13}),"Delete"]}):null,e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{z("chat",n)},children:"Continue in Chat"}),e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{z("work",n)},children:"Continue in repository Work"})]})]},t.id)})}):$.length>0?e.jsx("div",{className:"work-output-list",children:$.map(t=>e.jsxs("article",{className:"work-output-card",children:[e.jsxs("header",{children:[e.jsx(y,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:t.title}),e.jsx("small",{children:C(t.sizeBytes)})]})]}),e.jsx("div",{className:"work-output-actions",children:e.jsxs("button",{type:"button",onClick:()=>{B(t.path)},children:[e.jsx(W,{size:13}),"Reveal"]})})]},t.path))}):e.jsx(F,{icon:y,title:"No saved outputs yet",detail:"Finished files and connected results will appear here."}):null,k==="activity"?R.length>0?e.jsx("div",{className:"work-activity-list",children:R.map(t=>e.jsxs("details",{className:`work-activity-row ${t.state??""}`,children:[e.jsxs("summary",{children:[e.jsx(_,{size:14}),e.jsx("span",{children:t.label}),e.jsx("small",{children:t.state??"completed"})]}),e.jsx("p",{children:t.content}),t.detail?e.jsx("pre",{children:t.detail}):null]},t.id))}):e.jsx(F,{icon:_,title:"No activity yet",detail:"Commands, tool receipts, and checks appear while Work runs."}):null,k==="context"?e.jsxs("div",{className:"work-context",children:[e.jsxs("section",{children:[e.jsx("h3",{children:"Model context"}),e.jsx("p",{children:l.summary}),e.jsx("small",{children:l.tokensLabel})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Task inputs and sources"}),O.length>0?e.jsx("ul",{children:O.map(t=>e.jsxs("li",{children:[e.jsx(E,{size:13}),e.jsxs("span",{children:[e.jsx("strong",{children:t.title}),e.jsx("small",{children:t.detail})]})]},t.key))}):e.jsx("p",{children:"No attached files or cited sources yet."})]})]}):null]})]})}function se(i){return i.flatMap(r=>r.activities??[]).filter(r=>r.kind!=="reasoning").reverse()}function re(i){const r=new Map;for(const l of i)for(const s of l.activities??[])for(const c of s.artifacts??[])!c.path||c.sizeBytes===null||r.set(c.path,{path:c.path,title:c.title,sizeBytes:c.sizeBytes});return[...r.values()].sort((l,s)=>s.path.localeCompare(l.path))}function oe(i){const r=new Map,l=new Set;for(const s of i){const c=g(s.data);if(s.action==="work_output_delete"&&s.status==="completed"){for(const d of c){const u=p(d);l.add(u),r.delete(u)}continue}if(s.action!=="work_output_read")for(const d of c){const u=p(d);l.has(u)||r.set(u,d)}}return[...r.values()].sort((s,c)=>c.createdAt.localeCompare(s.createdAt)||c.revision-s.revision)}function p(i){return`${i.id}:${i.revision}`}function ae(i){const r=new Map;for(const l of i){const s=r.get(l.id)??[];s.push(l),r.set(l.id,s)}return[...r.entries()].map(([l,s])=>({id:l,revisions:s.sort((c,d)=>d.revision-c.revision||d.createdAt.localeCompare(c.createdAt))})).sort((l,s)=>s.revisions[0].createdAt.localeCompare(l.revisions[0].createdAt))}function g(i,r=[],l=new Set,s=0){if(s>8||i==null)return r;const c=Z.safeParse(i);if(c.success){const d=`${c.data.id}:${c.data.revision}`;return l.has(d)||(l.add(d),r.push(c.data)),r}if(Array.isArray(i)){for(const d of i)g(d,r,l,s+1);return r}if(typeof i=="object")for(const d of Object.values(i))g(d,r,l,s+1);return r}function le(i){const r=new Map;for(const l of i){for(const s of l.attachments??[])r.set(`attachment:${s.id}`,{key:`attachment:${s.id}`,title:s.name,detail:`${s.mediaType} · ${C(s.sizeBytes)}`});for(const s of l.sources??[])r.set(`source:${s.id}`,{key:`source:${s.id}`,title:s.title,detail:s.sourceName??ue(s.url)})}return[...r.values()]}function F({icon:i,title:r,detail:l}){return e.jsxs("div",{className:"work-sidebar-empty",children:[e.jsx(i,{size:22}),e.jsx("strong",{children:r}),e.jsx("p",{children:l})]})}function ce(i){return i.kind==="deployment"?"Deployment":i.kind==="source_change"?"Source change":i.kind==="external_resource"?i.provider:i.kind==="agent_package"?`${i.actions.length} action${i.actions.length===1?"":"s"}`:i.location.kind==="local"?C(i.sizeBytes):i.location.kind==="managed"?"Managed file":i.location.provider}function C(i){return i<1024?`${i} B`:i<1024*1024?`${Math.round(i/1024)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}function de(i){const r=window.atob(i),l=new ArrayBuffer(r.length),s=new Uint8Array(l);for(let c=0;c<r.length;c+=1)s[c]=r.charCodeAt(c);return l}function M(i){return i.kind==="file"&&i.location.kind==="local"?i.location.path:""}function ue(i){try{return new URL(i).hostname||i}catch{return i}}function pe(i){return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}export{Ne as WorkSidebarPanel,re as visibleChatFileArtifacts,se as visibleWorkActivities,oe as workOutputsFromEvents};
|
|
1
|
+
import{r as f,j as e}from"./index-De4k_YMo.js";import{bl as X,m as y,a$ as Y,bi as _,v as w,bH as Z}from"./App-DQfdLgyV.js";import{r as B,s as ee}from"./desktop-files-BQj1J-ob.js";import{F as W}from"./folder-open-D0PIN0Cj.js";import{M as te}from"./minimize-2-C6JQGKgk.js";import{P as E}from"./MainPane-Dv5USGqR.js";import{T as ie}from"./chat-file-links-DQYtkwit.js";import{M as ne}from"./MarkdownText-DWGLUbdE.js";import"./cloud-upload-DisZOwXE.js";import"./arrow-up-right-Dv3nebbh.js";import"./square-DUgXVoF0.js";function Ne({chatMessages:i,connection:r,contextWindowStatus:l,expanded:s,runtimeEvents:c,sessionId:d,showToast:u,onResizeStart:S,onToggleExpanded:L,onUseOutput:P,onHandoffOutput:T,onReviseOutput:D,onAgentPackageInstalled:I}){const[k,H]=f.useState("outputs"),[j,x]=f.useState(null),[o,m]=f.useState(null),[v,N]=f.useState(""),[K,V]=f.useState({}),A=f.useMemo(()=>oe(c),[c]),U=f.useMemo(()=>ae(A),[A]),R=f.useMemo(()=>se(i),[i]),$=f.useMemo(()=>re(i),[i]),O=f.useMemo(()=>le(i),[i]);f.useEffect(()=>()=>{o?.objectUrl&&URL.revokeObjectURL(o.objectUrl)},[o?.objectUrl]);async function b(t){if(!r||!d||t.kind!=="file")return null;x(p(t));try{const n=await w.workspaceTool(r,d,{action:"work_output_read",source:"ui_button",args:{outputId:t.id,revision:t.revision}});if(!n.ok)throw new Error(n.output);const a=pe(n.data),h=typeof a.contentsBase64=="string"?a.contentsBase64:"";if(!h)throw new Error("The output did not include file data.");return new File([de(h)],t.title,{type:t.contentType})}catch(n){return u(n instanceof Error?n.message:"Could not load the output.","error"),null}finally{x(null)}}async function q(t){const n=await b(t);if(!n)return;o?.objectUrl&&URL.revokeObjectURL(o.objectUrl);const a=t.kind==="file"&&(t.contentType.startsWith("text/")||t.contentType==="application/json");N(""),m({output:t,file:n,text:a?await n.text():null,objectUrl:a?null:URL.createObjectURL(n)})}async function G(t){const n=await b(t);n&&(P(n),u("Added the output to the task as input.","success"))}async function z(t,n){const a=n.kind==="file"?await b(n):null;n.kind==="file"&&!a||await T(t,n,a)}async function J(t){if(!(!r||!d)&&window.confirm(`Delete ${t.title} revision ${t.revision} from this device?`)){x(p(t));try{const n=await w.workspaceTool(r,d,{action:"work_output_delete",source:"ui_button",args:{outputId:t.id,revision:t.revision}});if(!n.ok)throw new Error(n.output);o?.output.id===t.id&&m(null),u("Work output deleted.","success")}catch(n){u(n instanceof Error?n.message:"Could not delete the output.","error")}finally{x(null)}}}async function Q(t){if(!r||!d||!window.confirm(`Add ${t.title} version ${t.versionId} to your active Agents profile?`))return;const n=async a=>w.workspaceTool(r,d,{action:"work_agent_package_install",source:"ui_button",args:{outputId:t.id,revision:t.revision,overwrite:a}});x(p(t));try{let a;try{a=await n(!1)}catch(h){if(!(h instanceof Error?h.message:"Agent installation failed.").includes("already exists")||!window.confirm(`${t.agentId} already exists. Replace its active checkout with this immutable version?`))throw h;a=await n(!0)}if(!a.ok)throw new Error(a.output);await I?.(),u(`${t.title} was added to Agents. Its package remains available in this Work task.`,"success")}catch(a){u(a instanceof Error?a.message:"Could not add the Agent package.","error")}finally{x(null)}}return e.jsxs("aside",{className:`workspace-diff-panel work-sidebar-panel ${s?"expanded":""}`,"aria-label":"Work details",children:[s?null:e.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize Work details",onPointerDown:S}),e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Work details",children:[["outputs","Outputs"],["activity","Activity"],["context","Context"]].map(([t,n])=>e.jsx("button",{type:"button",className:`workspace-diff-tab ${k===t?"active":""}`,role:"tab","aria-selected":k===t,onClick:()=>H(t),children:n},t))}),e.jsx("div",{className:"workspace-diff-toolbar-actions",children:e.jsx("button",{type:"button",className:"diff-icon-button",title:s?"Dock sidebar":"Expand sidebar","aria-label":s?"Dock sidebar":"Expand sidebar",onClick:L,children:s?e.jsx(te,{size:14}):e.jsx(X,{size:14})})})]}),e.jsxs("div",{className:"work-sidebar-body",children:[k==="outputs"?o?e.jsxs("div",{className:"work-output-preview",children:[e.jsxs("header",{children:[e.jsx("button",{type:"button",onClick:()=>{o.objectUrl&&URL.revokeObjectURL(o.objectUrl),m(null)},children:"Outputs"}),e.jsxs("strong",{children:[o.output.title," · revision ",o.output.revision]})]}),o.text!==null?e.jsx(ne,{content:o.text}):o.output.kind==="file"&&o.output.contentType.startsWith("image/")&&o.objectUrl?e.jsx("img",{src:o.objectUrl,alt:o.output.title}):o.output.kind==="file"&&o.output.contentType==="application/pdf"&&o.objectUrl?e.jsx("iframe",{src:o.objectUrl,title:o.output.title}):o.output.kind==="file"&&o.output.contentType.startsWith("audio/")&&o.objectUrl?e.jsx("audio",{controls:!0,src:o.objectUrl}):o.output.kind==="file"&&o.output.contentType.startsWith("video/")&&o.objectUrl?e.jsx("video",{controls:!0,src:o.objectUrl}):e.jsx("p",{children:"This file type uses its native application for detailed review."}),e.jsxs("section",{className:"work-output-annotation",children:[e.jsx("label",{htmlFor:"work-output-revision-note",children:"Revision note"}),e.jsx("textarea",{id:"work-output-revision-note",value:v,onChange:t=>N(t.target.value),placeholder:"Describe the exact change to make in the next revision."}),e.jsx("button",{type:"button",disabled:!v.trim(),onClick:()=>{D(o.output,o.file,v.trim()),u(`Prepared revision ${o.output.revision+1}.`,"success")},children:"Revise this version"})]})]}):U.length>0?e.jsx("div",{className:"work-output-list",children:U.map(t=>{const n=t.revisions.find(a=>a.revision===K[t.id])??t.revisions[0];return e.jsxs("article",{className:"work-output-card",children:[e.jsxs("header",{children:[e.jsx(y,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:n.title}),t.revisions.length>1?e.jsxs("label",{className:"work-output-version",children:[e.jsx("span",{children:"Version"}),e.jsx("select",{value:n.revision,onChange:a=>V(h=>({...h,[t.id]:Number(a.target.value)})),children:t.revisions.map(a=>e.jsxs("option",{value:a.revision,children:["Revision ",a.revision]},p(a)))})]}):e.jsxs("small",{children:["Revision ",n.revision]}),e.jsx("small",{children:ce(n)})]})]}),n.validation.length>0?e.jsxs("div",{className:"work-output-validation",children:[e.jsx(Y,{size:13}),e.jsxs("span",{children:[n.validation.filter(a=>a.status==="passed").length," ","checks passed"]})]}):null,e.jsxs("div",{className:"work-output-actions",children:[n.kind==="file"&&n.location.kind==="local"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>{B(M(n))},children:[e.jsx(W,{size:13}),"Reveal"]}),e.jsx("button",{type:"button",onClick:async()=>{const a=await ee(M(n),n.title);a.ok?u("Saved a copy of the Work output.","success"):a.canceled||u("Could not save a copy of the Work output.","error")},children:"Save as"})]}):null,n.kind==="file"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{q(n)},children:"Preview"}),e.jsxs("button",{type:"button",disabled:j===p(n),onClick:()=>{G(n)},children:[e.jsx(E,{size:13}),"Use as input"]})]}):n.kind==="agent_package"?e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{Q(n)},children:"Add to Agents"}):"url"in n&&n.url?e.jsx("button",{type:"button",onClick:()=>window.open(n.url,"_blank","noopener,noreferrer"),children:"Open"}):null,n.kind==="file"&&n.location.kind==="local"?e.jsxs("button",{type:"button",className:"danger",disabled:j===p(n),onClick:()=>{J(n)},children:[e.jsx(ie,{size:13}),"Delete"]}):null,e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{z("chat",n)},children:"Continue in Chat"}),e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{z("work",n)},children:"Continue in repository Work"})]})]},t.id)})}):$.length>0?e.jsx("div",{className:"work-output-list",children:$.map(t=>e.jsxs("article",{className:"work-output-card",children:[e.jsxs("header",{children:[e.jsx(y,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:t.title}),e.jsx("small",{children:C(t.sizeBytes)})]})]}),e.jsx("div",{className:"work-output-actions",children:e.jsxs("button",{type:"button",onClick:()=>{B(t.path)},children:[e.jsx(W,{size:13}),"Reveal"]})})]},t.path))}):e.jsx(F,{icon:y,title:"No saved outputs yet",detail:"Finished files and connected results will appear here."}):null,k==="activity"?R.length>0?e.jsx("div",{className:"work-activity-list",children:R.map(t=>e.jsxs("details",{className:`work-activity-row ${t.state??""}`,children:[e.jsxs("summary",{children:[e.jsx(_,{size:14}),e.jsx("span",{children:t.label}),e.jsx("small",{children:t.state??"completed"})]}),e.jsx("p",{children:t.content}),t.detail?e.jsx("pre",{children:t.detail}):null]},t.id))}):e.jsx(F,{icon:_,title:"No activity yet",detail:"Commands, tool receipts, and checks appear while Work runs."}):null,k==="context"?e.jsxs("div",{className:"work-context",children:[e.jsxs("section",{children:[e.jsx("h3",{children:"Model context"}),e.jsx("p",{children:l.summary}),e.jsx("small",{children:l.tokensLabel})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Task inputs and sources"}),O.length>0?e.jsx("ul",{children:O.map(t=>e.jsxs("li",{children:[e.jsx(E,{size:13}),e.jsxs("span",{children:[e.jsx("strong",{children:t.title}),e.jsx("small",{children:t.detail})]})]},t.key))}):e.jsx("p",{children:"No attached files or cited sources yet."})]})]}):null]})]})}function se(i){return i.flatMap(r=>r.activities??[]).filter(r=>r.kind!=="reasoning").reverse()}function re(i){const r=new Map;for(const l of i)for(const s of l.activities??[])for(const c of s.artifacts??[])!c.path||c.sizeBytes===null||r.set(c.path,{path:c.path,title:c.title,sizeBytes:c.sizeBytes});return[...r.values()].sort((l,s)=>s.path.localeCompare(l.path))}function oe(i){const r=new Map,l=new Set;for(const s of i){const c=g(s.data);if(s.action==="work_output_delete"&&s.status==="completed"){for(const d of c){const u=p(d);l.add(u),r.delete(u)}continue}if(s.action!=="work_output_read")for(const d of c){const u=p(d);l.has(u)||r.set(u,d)}}return[...r.values()].sort((s,c)=>c.createdAt.localeCompare(s.createdAt)||c.revision-s.revision)}function p(i){return`${i.id}:${i.revision}`}function ae(i){const r=new Map;for(const l of i){const s=r.get(l.id)??[];s.push(l),r.set(l.id,s)}return[...r.entries()].map(([l,s])=>({id:l,revisions:s.sort((c,d)=>d.revision-c.revision||d.createdAt.localeCompare(c.createdAt))})).sort((l,s)=>s.revisions[0].createdAt.localeCompare(l.revisions[0].createdAt))}function g(i,r=[],l=new Set,s=0){if(s>8||i==null)return r;const c=Z.safeParse(i);if(c.success){const d=`${c.data.id}:${c.data.revision}`;return l.has(d)||(l.add(d),r.push(c.data)),r}if(Array.isArray(i)){for(const d of i)g(d,r,l,s+1);return r}if(typeof i=="object")for(const d of Object.values(i))g(d,r,l,s+1);return r}function le(i){const r=new Map;for(const l of i){for(const s of l.attachments??[])r.set(`attachment:${s.id}`,{key:`attachment:${s.id}`,title:s.name,detail:`${s.mediaType} · ${C(s.sizeBytes)}`});for(const s of l.sources??[])r.set(`source:${s.id}`,{key:`source:${s.id}`,title:s.title,detail:s.sourceName??ue(s.url)})}return[...r.values()]}function F({icon:i,title:r,detail:l}){return e.jsxs("div",{className:"work-sidebar-empty",children:[e.jsx(i,{size:22}),e.jsx("strong",{children:r}),e.jsx("p",{children:l})]})}function ce(i){return i.kind==="deployment"?"Deployment":i.kind==="source_change"?"Source change":i.kind==="external_resource"?i.provider:i.kind==="agent_package"?`${i.actions.length} action${i.actions.length===1?"":"s"}`:i.location.kind==="local"?C(i.sizeBytes):i.location.kind==="managed"?"Managed file":i.location.provider}function C(i){return i<1024?`${i} B`:i<1024*1024?`${Math.round(i/1024)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}function de(i){const r=window.atob(i),l=new ArrayBuffer(r.length),s=new Uint8Array(l);for(let c=0;c<r.length;c+=1)s[c]=r.charCodeAt(c);return l}function M(i){return i.kind==="file"&&i.location.kind==="local"?i.location.path:""}function ue(i){try{return new URL(i).hostname||i}catch{return i}}function pe(i){return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}export{Ne as WorkSidebarPanel,re as visibleChatFileArtifacts,se as visibleWorkActivities,oe as workOutputsFromEvents};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WorkspaceMonacoEditor-
|
|
2
|
-
import{j as e,r as l,_ as fa}from"./index-B5RqBp_p.js";import{c as be,m as lt,bm as Ws,aO as nn,aB as Ee,v as W,bn as $t,b3 as Ft,aX as Oe,bo as pa,at as ha,bp as ma,au as xa,F as ba,B as an,h as ga,X as Is,P as ja,av as va,aq as ka,aW as wa,bl as ya,bq as Sa,a$ as Bs,br as Na,bs as ts,bt as Ca,bu as ss,bv as Ra,f as $a,w as rn,t as Fa,bw as Qt,bx as Ea,by as ns,bz as Ce,bA as Aa,bB as Os,bC as Pa,bD as La,bE as Us,bF as Da,bG as Ta}from"./App-kwt-UxX_.js";import{M as _a,u as Hs,I as Ma}from"./MarkdownText-D6_UI4Ly.js";import{R as as}from"./refresh-cw-DaASy_i0.js";import{T as za,F as Wa,a as Ia}from"./chat-file-links-C3erG0P2.js";import{t as Ba,a as Oa,b as Ua,m as Ha,s as Va,d as Ga,f as Ka,c as qa}from"./training-model-data-CKOkpBBL.js";import{F as yt}from"./folder-open-2a5riVSG.js";import{I as Vs}from"./info-BWvLCbJ2.js";import{M as Xa}from"./minimize-2-C-_iqAbt.js";import{S as Za}from"./save-BBQ7L8VS.js";import{C as Qa}from"./clipboard-BSPYX7yq.js";import{C as Ya}from"./chevron-up-D9MMQKU3.js";const Ja=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],ei=be("text-align-start",Ja);const ti=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],si=be("chevrons-up",ti);const ni=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ai=be("columns-2",ni);const ii=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ri=be("eye-off",ii);const li=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],oi=be("panel-top",li);const ci=[["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"}]],di=be("plug",ci);const ui=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],fi=be("redo-2",ui);const pi=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],hi=be("undo-2",pi);function mi({createRuntime:t,goalRuntime:s,subagentRuntime:n=null,onRunSubagentLifecycleAction:a}){const i=t?"Create/Improve Details":"Goal Details",u=t?Z(t.run.state):n?.activeCount?n.label:s?.actionLabel??"No active goal";return e.jsxs("div",{className:"goal-details-view","aria-label":i,children:[e.jsxs("div",{className:"goal-details-header",children:[e.jsxs("div",{className:"goal-details-title",children:[e.jsx(lt,{size:15,"aria-hidden":"true"}),e.jsx("span",{children:i})]}),e.jsx("span",{className:`goal-details-state ${Di(t?.run.state??null)}`,children:u})]}),e.jsx("div",{className:"goal-details-body",children:t?e.jsx(xi,{runtime:t}):s||n?e.jsx(gi,{goalRuntime:s,subagentRuntime:n,onRunSubagentLifecycleAction:a}):e.jsx(Li,{})})]})}function xi({runtime:t}){const s=t.run,n=s.plan,a=Ws(n?.metadata)??Ws(s.metadata),i=s.questions,u=i.filter(o=>o.status==="pending"),c=s.sourceRefs,f=s.checkRefs,h=s.state,m=s.target.kind==="agent"?s.target.defaultActionKey:null;return e.jsxs(e.Fragment,{children:[e.jsx(V,{title:"Current Work",children:e.jsx(it,{rows:[["State",Z(h)],["Operation",s.operation],["Target",Z(s.target.kind)],["Name",s.target.displayName??s.target.id??"Pending"],["Target ID",s.target.id??"Pending"],["Default action",m??n?.defaultChatAction.key??"Pending"],["Adapter",Z(s.adapter.kind)],["Run",s.id],["Revision",String(s.revision)]]})}),e.jsx(V,{title:"Plan",children:n?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"goal-details-summary",children:n.summary}),e.jsx(it,{rows:[["Objective",n.objective],["Context",n.capturedContextSummary],["Status",Z(n.status)],["Plan ID",n.id],["Run ID",n.runId],["Approval",n.approvalId??"Pending"],["Approved",n.approvedAt??"Not approved"]]})]}):u.length?e.jsx("p",{className:"goal-details-summary",children:"Waiting for answers before the model finalizes the Create plan."}):e.jsx("p",{className:"goal-details-summary",children:"The model is preparing the Create plan."})}),a?e.jsxs(V,{title:"Action Shape",children:[e.jsx(it,{rows:[["Mode",a.label],["Default action",a.defaultActionKey??"None"],["Direct action",a.directActionHint??"None planned"],["Artifacts",a.artifactPolicy]]}),e.jsx("p",{className:"goal-details-note",children:a.detail})]}):null,i.length?e.jsx(V,{title:"Questions",children:e.jsx("div",{className:"goal-details-list",children:i.map(o=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.title}),e.jsx("span",{className:`goal-details-inline-state ${o.status}`,children:Z(o.status)})]}),e.jsx("p",{children:o.prompt}),o.answer?e.jsxs("small",{children:["Answer: ",o.answer.label??o.answer.value]}):o.options.length?e.jsxs("small",{children:["Options: ",o.options.map(x=>x.label).join(", ")]}):null]},o.id))})}):null,n?.requirements.length?e.jsx(V,{title:"Setup Requirements",children:e.jsx("div",{className:"goal-details-list",children:n.requirements.map(o=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.name}),e.jsx("span",{className:`goal-details-inline-state ${o.status}`,children:Z(o.status)})]}),e.jsxs("small",{children:[Z(o.kind),o.detail?`: ${o.detail}`:""]})]},`${o.kind}:${o.name}`))})}):null,n?.sourcePlan.length?e.jsx(V,{title:"Source Plan",children:e.jsx(wt,{refs:n.sourcePlan.map(o=>({id:`${o.operation}:${o.path}`,primary:o.path,secondary:`${Z(o.operation)}: ${o.reason}`}))})}):null,n?.checks.length?e.jsx(V,{title:"Checks",children:e.jsx(wt,{refs:n.checks.map(o=>({id:o.name,primary:o.name,secondary:`${o.required?"Required":"Optional"}: ${o.command}`}))})}):null,c.length||f.length?e.jsx(V,{title:"Run Refs",children:e.jsx(wt,{refs:[...c.map(o=>({id:`source:${o}`,primary:o,secondary:"Source ref"})),...f.map(o=>({id:`check:${o}`,primary:o,secondary:"Check ref"}))]})}):null,e.jsx(bi,{run:s}),s.blockedReason?e.jsx(V,{title:"Blocked",children:e.jsxs("div",{className:"goal-details-alert",children:[e.jsx(nn,{size:15}),e.jsx("span",{children:s.blockedReason})]})}):null,e.jsx(V,{title:"Raw State",children:e.jsxs("details",{className:"goal-details-raw",children:[e.jsx("summary",{children:"Show structured payload"}),e.jsx("pre",{children:JSON.stringify(s,null,2)})]})})]})}function bi({run:t}){const s=[...t.context.attachments.map(i=>({id:`attachment:${i.id??i.name}`,primary:i.name,secondary:i.ref??i.mediaType??"Attachment"})),...t.context.apps.map(i=>({id:`app:${i.id}`,primary:i.name,secondary:i.required?"Required app context":"Optional app context"})),...t.context.tools.map(i=>({id:`tool:${i.name}`,primary:i.name,secondary:i.outputSummary??i.inputSummary??"Tool context"})),...t.context.targetRepoAssumptions.map(i=>({id:`target:${i}`,primary:i,secondary:"Target assumption"}))],n=t.workflowCapture,a=n?[...n.files.map(i=>({id:`workflow-file:${i}`,primary:i,secondary:"Captured file"})),...n.outputArtifacts.map(i=>({id:`workflow-artifact:${i}`,primary:i,secondary:"Output artifact"})),...n.traceRefs.map(i=>({id:`workflow-trace:${i}`,primary:i,secondary:"Trace"}))]:[];return!s.length&&!a.length?null:e.jsx(V,{title:"Context",children:e.jsx(wt,{refs:[...s,...a]})})}function gi({goalRuntime:t,subagentRuntime:s,onRunSubagentLifecycleAction:n}){return e.jsxs(e.Fragment,{children:[t?e.jsxs(V,{title:"Goal",children:[e.jsx("p",{className:"goal-details-summary",children:t.objective}),e.jsx(it,{rows:[["Status",t.actionLabel],["Runtime",t.timeLabel],["Detail",t.detail]]})]}):null,s?e.jsx(ji,{runtime:s,onRunSubagentLifecycleAction:n}):null,e.jsx(V,{title:"Raw State",children:e.jsxs("details",{className:"goal-details-raw",children:[e.jsx("summary",{children:"Show structured payload"}),e.jsx("pre",{children:JSON.stringify({goalRuntime:t,subagentRuntime:s},null,2)})]})})]})}function ji({runtime:t,onRunSubagentLifecycleAction:s}){const[n,a]=l.useState(null),[i,u]=l.useState(null);Ee(i);const c=async(f,h)=>{if(!s)return;const m=`${f}:${h}`;a(m),u(null);try{await s({runId:f,action:h})}catch(o){u(o instanceof Error?o.message:String(o))}finally{a(o=>o===m?null:o)}};return e.jsxs(e.Fragment,{children:[e.jsxs(V,{title:"Subagents",children:[e.jsx(it,{rows:[["Latest update",Ci(t)],["Active",String(t.activeCount)],["Completed",String(t.completedCount)],["Failed",String(t.failedCount)],["Cancelled",String(t.cancelledCount)],["Paused",String(t.needsResumeCount)],["Terminal",String(t.terminalCount)],["Usage",Ri(t.usage.totalTokens,t.usage.requestCount)],["Evidence",String(t.evidenceRefs.length)],["Checks",String(t.testsRunCount)]]}),t.blockers.length>0?e.jsx("ul",{className:"goal-details-list compact",children:t.blockers.slice(0,4).map(f=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${f.status}`,children:f.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(f.roleId)}),e.jsx("p",{children:f.message})]})]},`${f.runId}:${f.message}`))}):null,e.jsx("ul",{className:"goal-details-list",children:t.runs.slice(0,8).map(f=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${f.status}`,children:f.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(f.roleId)}),e.jsx("p",{children:f.objective}),f.report?.summary?e.jsx("small",{children:f.report.summary}):null,s?e.jsx(ki,{pendingAction:n,run:f,onRun:c}):null]})]},f.id))})]}),t.finalResults.length>0?e.jsx(vi,{results:t.finalResults}):null]})}function vi({results:t}){return e.jsx(V,{title:"Child Results",children:e.jsx("ol",{className:"goal-details-task-graph",children:t.slice(0,6).map(s=>e.jsxs("li",{className:"goal-details-task-node",children:[e.jsxs("div",{className:"goal-details-task-node-header",children:[e.jsx("span",{className:`goal-details-inline-state ${s.status}`,children:s.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(s.roleId)}),e.jsx("small",{children:s.objective})]})]}),e.jsx("p",{children:s.summary}),e.jsxs("div",{className:"goal-details-task-node-meta",children:[e.jsxs("span",{children:[s.refs.length," refs"]}),e.jsxs("span",{children:[s.testsRun.length+s.validationAttempts.length," checks"]}),e.jsxs("span",{children:[s.blockers.length," blockers"]}),e.jsx("span",{children:s.confidence?`${Z(s.confidence)} confidence`:"Confidence unknown"})]}),s.findings.length>0?e.jsxs("small",{children:["Findings: ",Re(s.findings,3)]}):null,s.changedFiles.length>0?e.jsxs("small",{children:["Files: ",Re(s.changedFiles,4)]}):null,s.testsRun.length>0?e.jsxs("small",{children:["Tests: ",Re(s.testsRun,3)]}):null,s.validationAttempts.length>0?e.jsxs("small",{children:["Validation: ",Re(s.validationAttempts,2)]}):null,s.refs.length>0?e.jsxs("small",{children:["Refs: ",Re(s.refs.map($i),4)]}):null,s.blockers.length>0?e.jsxs("small",{children:["Blockers: ",Re(s.blockers,3)]}):null,s.workspaceRetention?e.jsxs("small",{children:["Workspace: ",Ei(s.workspaceRetention)]}):null,s.importantMessages.length>0?e.jsxs("small",{children:["Messages: ",Re(s.importantMessages.map(Fi),2)]}):null]},s.runId))})})}function ki({pendingAction:t,run:s,onRun:n}){const a=wi(s);return a.length===0?null:e.jsx("div",{className:"goal-details-actions",children:a.map(i=>{const u=`${s.id}:${i}`,c=t===u;return e.jsx("button",{type:"button",disabled:!!t,onClick:()=>{n(s.id,i)},children:c?"Working...":yi(i)},i)})})}function wi(t){const s=[],n=Si(t),a=Ni(t);return n&&s.push("cleanup"),a&&s.push("archive"),s}function yi(t){return t==="cleanup"?"Clean":t==="archive"?"Archive":"Clean + archive"}function Si(t){if(!ln(t))return!1;const s=rt(t.metadata);if(!s?.subagentWorkspace&&!s?.workspaceHandoff)return!1;const n=rt(s.lifecycleCleanup),a=rt(n?.workspaceCleanup),i=on(a?.status);return i!=="removed"&&i!=="deleted"&&i!=="retained"&&i!=="skipped"}function Ni(t){if(!t.childSessionId||!ln(t))return!1;const s=rt(rt(t.metadata)?.childSessionArchive),n=on(s?.status);return n!=="archived"&&n!=="already_archived"}function ln(t){return t.status==="completed"||t.status==="failed"||t.status==="cancelled"}function Ci(t){const s=t.latestMeaningfulUpdate;return s?`${St(s.roleId)} ${s.status}: ${s.message}`:"No structured update"}function Ri(t,s){if(t<=0&&s<=0)return"0 tokens";const n=`${s} ${s===1?"request":"requests"}`;return`${Ai(t)} tokens · ${n}`}function St(t){return t.slice(0,1).toUpperCase()+t.slice(1).replace(/[-_]+/g," ")}function $i(t){return`${t.kind}: ${t.label}`}function Fi(t){return`${Z(t.kind)}: ${t.body}`}function Ei(t){const s=t.expiresAt?`until ${Pi(t.expiresAt)}`:"for inspection",n=t.trigger?` · ${Z(t.trigger)}`:"";return`retained ${s}${n}`}function Re(t,s){const n=t.slice(0,s),a=t.length-n.length;return a>0?`${n.join(", ")} +${a}`:n.join(", ")}function Ai(t){if(t<1e3)return String(t);if(t>=1e6){const n=t/1e6;return`${Gs(n,n<10?2:1)}M`}const s=t/1e3;return`${Gs(s,s<10?1:0)}k`}function Pi(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Gs(t,s){return t.toFixed(s).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")}function Li(){return e.jsxs("div",{className:"goal-details-empty",children:[e.jsx(lt,{size:18}),e.jsx("span",{children:"No active Goal or Create workflow."})]})}function V({children:t,title:s}){return e.jsxs("section",{className:"goal-details-section",children:[e.jsx("h2",{children:s}),t]})}function it({rows:t}){return e.jsx("dl",{className:"goal-details-grid",children:t.map(([s,n])=>e.jsxs("div",{children:[e.jsx("dt",{children:s}),e.jsx("dd",{children:n})]},s))})}function wt({refs:t}){return e.jsx("ul",{className:"goal-details-ref-list",children:t.map(s=>e.jsxs("li",{children:[e.jsx("code",{title:s.primary,children:s.primary}),e.jsx("span",{children:s.secondary})]},s.id))})}function rt(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function on(t){return typeof t=="string"&&t.trim()?t.trim():null}function Z(t){return t.split(/[_-]/g).filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function Di(t){return t==="ready_local"||t==="published_hosted"?"success":t==="blocked"||t==="failed"||t==="cancelled"?"danger":t==="awaiting_questions"||t==="awaiting_plan_approval"?"warning":"active"}function Ti({sandboxId:t,connection:s}){const[n,a]=l.useState(null),[i,u]=l.useState([]),[c,f]=l.useState(null),[h,m]=l.useState(null),[o,x]=l.useState(null),[S,k]=l.useState(null);Ee(o,{prefix:"Sandbox"}),Ee(S,{prefix:"Sandbox integrations"});const N=n?.integrationLeases??[],E=l.useMemo(()=>i.filter(j=>j.status==="active"),[i]),_=l.useMemo(()=>Mi(n),[n]),I=l.useCallback(async()=>{if(!s){x("OpenPond App server is not connected.");return}if(!t){a(null),u([]),x(null);return}f("summary"),x(null);try{const j=await W.sandbox(s,t),R=await W.integrationConnections(s,Ks(j.sandbox));a(j.sandbox),u(R.connections),k(null)}catch(j){x(j instanceof Error?j.message:String(j))}finally{f(null)}},[s,t]),G=l.useCallback(async()=>{if(!(!s||!n)){m("load"),k(null);try{const[j,R]=await Promise.all([W.integrationConnections(s,Ks(n)),W.sandboxIntegrationLeases(s,n.id)]);u(j.connections),a(R.sandbox)}catch(j){k(j instanceof Error?j.message:String(j))}finally{m(null)}}},[s,n]),U=l.useCallback(async j=>{if(!s||!n)return;const R=$t(j.provider),T=R?Ft(R):null,M=T?.leasePolicy.allowedCapabilityIds??[];if(!R||!T?.leasePolicy.leaseable||M.length===0){k(`${ae(j.provider)} cannot be attached to this sandbox.`);return}m(`attach:${j.id}`),k(null);try{const A=await W.attachSandboxIntegrationConnection(s,n.id,{connectionId:j.id,provider:j.provider,capabilities:M,...j.scopes.length>0?{scopes:j.scopes}:{},...T.leasePolicy.defaultTtlSeconds?{ttlSeconds:T.leasePolicy.defaultTtlSeconds}:{},required:!1});a(A.sandbox)}catch(A){k(A instanceof Error?A.message:String(A))}finally{m(null)}},[s,n]),B=l.useCallback(async j=>{if(!(!s||!n)){m(`remove:${j}`),k(null);try{const R=await W.removeSandboxIntegrationLease(s,n.id,j);a(R.sandbox)}catch(R){k(R instanceof Error?R.message:String(R))}finally{m(null)}}},[s,n]);return l.useEffect(()=>{I()},[I]),t?e.jsxs("div",{className:"sandbox-summary-tab",children:[e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Sandbox"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[n?e.jsx("span",{children:n.state}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh summary","aria-label":"Refresh summary",disabled:c!==null,onClick:()=>{I()},children:c==="summary"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(as,{size:14})})]})]}),n?e.jsxs("dl",{className:"sandbox-workspace-kv",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Sandbox"}),e.jsx("dd",{children:qs(n.id)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Spend"}),e.jsxs("dd",{children:[Yt(n.reservation.capturedUsd)," / ",Yt(n.budget.maxUsd)]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Reservation"}),e.jsx("dd",{children:n.reservation.status})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Idle cleanup"}),e.jsx("dd",{children:n.quotas?.idleTimeoutSeconds?`${Math.round(n.quotas.idleTimeoutSeconds/60)} min`:"-"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Updated"}),e.jsx("dd",{children:cn(n.updatedAt)})]}),_?e.jsxs("div",{children:[e.jsx("dt",{children:"Receipt"}),e.jsxs("dd",{children:[qs(_.id)," / ",Yt(_.totalUsd)]})]}):null]}):e.jsxs("div",{className:"sandbox-workspace-loading",children:[c==="summary"?e.jsx(Oe,{className:"spinning",size:16}):null,e.jsx("span",{children:c==="summary"?"Loading sandbox":"Sandbox unavailable"})]})]}),e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Integrations"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[e.jsx("span",{children:N.length}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh integrations","aria-label":"Refresh integrations",disabled:h!==null||!n,onClick:()=>{G()},children:h==="load"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(as,{size:14})})]})]}),N.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:N.map(j=>e.jsxs("div",{className:"sandbox-workspace-integration-row",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:ae(j.provider)}),e.jsxs("small",{children:[j.required?"required":"optional"," / ",Ii(j)," / ",_i(j)]})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:`Revoke ${ae(j.provider)} lease`,"aria-label":`Revoke ${ae(j.provider)} lease`,disabled:h!==null,onClick:()=>{B(j.leaseId)},children:h===`remove:${j.leaseId}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(za,{size:14})}),e.jsxs("div",{className:"sandbox-workspace-chip-row",children:[j.capabilities.slice(0,5).map(R=>e.jsx("span",{children:Wi(j.provider,R)},R)),j.capabilities.length>5?e.jsxs("span",{children:["+",j.capabilities.length-5]}):null]})]},j.leaseId))}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No active integration leases."}),E.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:E.map(j=>{const R=N.some(A=>A.provider===j.provider),M=zi(j)?.leasePolicy.allowedCapabilityIds.length??0;return e.jsxs("div",{className:"sandbox-workspace-integration-row compact",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:Bi(j)}),e.jsx("small",{children:Oi(j,M)})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:R?`${ae(j.provider)} already attached`:`Attach ${ae(j.provider)}`,"aria-label":R?`${ae(j.provider)} already attached`:`Attach ${ae(j.provider)}`,disabled:R||h!==null||M===0,onClick:()=>{U(j)},children:h===`attach:${j.id}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(di,{size:14})})]},j.id)})}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No connected accounts available."})]})]}):e.jsx("div",{className:"sandbox-summary-tab",children:e.jsx("p",{className:"sandbox-workspace-empty",children:"No sandbox is attached yet."})})}function Ks(t){return{status:"active"}}function _i(t){return t.proxyUrl?"runtime proxy available":"metadata only, no runtime proxy"}function Mi(t){return t?.receipts?.at(-1)??null}function zi(t){const s=$t(t.provider);return s?Ft(s):null}function ae(t){const s=$t(t),n=s?Ft(s):null;return n?n.label:t==="microsoft_teams"?"Microsoft Teams":t?t.replace(/_/g," "):"Integration"}function Wi(t,s){const n=$t(t);return(n?Ft(n):null)?.capabilities.find(i=>i.id===s)?.label??s}function Ii(t){return t.expiresAt?`expires ${cn(t.expiresAt)}`:"active"}function Bi(t){const s=t.providerAccountName?.trim();return s?`${ae(t.provider)} / ${s}`:ae(t.provider)}function Oi(t,s){const n=[];return t.providerWorkspaceName&&n.push(t.providerWorkspaceName),n.push(`${s} lease ${s===1?"capability":"capabilities"}`),t.scopes.length>0&&n.push(`${t.scopes.length} ${t.scopes.length===1?"scope":"scopes"}`),n.join(" / ")}function qs(t){return t.length>10?`${t.slice(0,8)}...`:t}function cn(t){if(!t)return"-";const s=new Date(t);return Number.isNaN(s.valueOf())?"-":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(s)}function Yt(t){const s=Number(t??0);return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:s>=10?2:4}).format(Number.isFinite(s)?s:0)}function Ui({summary:t}){const s=Ba(t.taskset),n=t.taskset.learningSignals.demonstrations.filter(f=>f.approved).length,a=t.taskset.tasks.filter(f=>f.split==="frozen_eval").length,i=t.plan?.recipe.method==="sft"||t.plan?.recipe.method==="grpo"?t.plan.recipe:null,u=Oa(t.taskset,t.plan),c=t.job?Ua(t.job.status,t.job.completedAt,t.job.updatedAt):null;return e.jsxs("div",{className:"training-sidebar-summary",children:[e.jsxs("header",{children:[e.jsx("h2",{children:Ha(t.taskset.name)}),e.jsx("span",{children:t.job?Va(t.job.status):t.taskset.readiness?.ready?"Ready to train":"Needs review"})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Run"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Primary recommendation",value:s.toUpperCase()}),e.jsx(O,{label:"Training stage",value:u}),e.jsx(O,{label:"Base model",value:i?.baseModel.id??"Not selected"}),e.jsx(O,{label:"Compute",value:t.plan?Ga(t.plan.destinationId):"Not selected"}),e.jsx(O,{label:"Started",value:Ka(t.job?.startedAt??null)}),e.jsx(O,{label:"Duration",value:qa(t.job?.startedAt??null,c)})]})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Data"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Training examples",value:String(n)}),e.jsx(O,{label:"Test examples",value:String(a)}),e.jsx(O,{label:"Dataset sources",value:String(t.taskset.sourceRefs.length)})]})]}),i?e.jsxs("section",{children:[e.jsx("h3",{children:"Recipe"}),e.jsxs("dl",{children:[i.method==="grpo"?e.jsx(O,{label:"RL loss",value:i.loss.method==="gspo-token"?"GSPO-token":i.loss.method.toUpperCase()}):null,e.jsx(O,{label:"LoRA rank",value:String(i.lora.rank)}),e.jsx(O,{label:"Learning rate",value:String(i.optimizer.learningRate)}),e.jsx(O,{label:"Optimizer steps",value:String(i.optimizer.maxSteps)}),e.jsx(O,{label:i.method==="grpo"?"Prompt length":"Sequence length",value:String(i.method==="grpo"?i.dataset.maxPromptTokens:i.dataset.maxSequenceLength)})]})]}):null,e.jsxs("section",{children:[e.jsx("h3",{children:"Result"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Adapter",value:t.lineage?`${u} ready`:"Not created"}),e.jsx(O,{label:"Evaluation",value:t.lineage?.frozenEvaluationArtifactId?"Completed":"Not completed"}),e.jsx(O,{label:"Artifacts",value:String(t.artifacts.length)})]})]})]})}function O({label:t,value:s}){return e.jsxs("div",{children:[e.jsx("dt",{children:t}),e.jsx("dd",{children:s})]})}function Hi(t){const s=Xs("","","folder");for(const n of t){const a=n.endsWith("/"),i=n.split("/").filter(Boolean);if(i.length===0)continue;let u=s,c="";for(let f=0;f<i.length;f+=1){const h=i[f];c=c?`${c}/${h}`:h;const m=!a&&f===i.length-1?"file":"folder",o=`${m}:${h}`;let x=u.childMap.get(o);x||(x=Xs(h,c,m),u.childMap.set(o,x),u.children.push(x)),u=x}}return dn(s.children)}function Xs(t,s,n){return{name:t,path:s,type:n,children:[],childMap:new Map}}function dn(t){return t.sort((s,n)=>s.type!==n.type?s.type==="folder"?-1:1:s.name.localeCompare(n.name)).map(s=>({name:s.name,path:s.path,type:s.type,children:dn(s.children)}))}function is({className:t,currentStatus:s,onSetStatus:n}){const a=s==="pinned",i=s==="saved_for_later";return e.jsxs("span",{className:`workspace-file-bookmark-actions ${t??"workspace-file-heading-actions"}`,children:[e.jsx("button",{type:"button",className:a?"active":void 0,"data-tooltip":a?"Unpin file":"Pin file","aria-label":a?"Unpin file":"Pin file","aria-pressed":a,onClick:()=>n(a?"none":"pinned"),children:a?e.jsx(pa,{size:14}):e.jsx(ha,{size:14})}),e.jsx("button",{type:"button",className:i?"active":void 0,"data-tooltip":i?"Remove from Save for later":"Save file for later","aria-label":i?"Remove from Save for later":"Save file for later","aria-pressed":i,onClick:()=>n(i?"none":"saved_for_later"),children:i?e.jsx(ma,{size:14}):e.jsx(xa,{size:14})})]})}function Vi({changedByPath:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=l.useMemo(()=>Hi(a),[a]);return e.jsxs("div",{className:"workspace-file-tree-view",children:[e.jsxs("div",{className:"workspace-file-tree-header",children:[e.jsx(yt,{size:14}),e.jsx("strong",{title:n??void 0,children:n?n.split("/").at(-1):"Files"}),e.jsx("span",{children:a.length})]}),e.jsx("div",{className:"workspace-file-tree",children:m.map(o=>e.jsx(un,{changedByPath:t,expandedFolderPaths:s,node:o,rootPath:n,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h},`${o.type}:${o.path}`))})]})}function un({changedByPath:t,depth:s=0,expandedFolderPaths:n,node:a,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:f,onSetFileBookmarkStatus:h,onToggleFolder:m}){const o=i?`${i}/${a.path}`:a.path,x=a.type==="folder"&&n.has(o),S=t.get(o),k=2+s*11;return a.type==="folder"?e.jsxs("div",{className:"workspace-file-tree-node",children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row folder","aria-expanded":x,style:{paddingLeft:k},onClick:()=>m(o),children:[x?e.jsx(yt,{size:14}):e.jsx(ba,{size:14}),e.jsx("span",{children:a.name})]}),x&&a.children.map(N=>e.jsx(un,{changedByPath:t,depth:s+1,expandedFolderPaths:n,node:N,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:f,onSetFileBookmarkStatus:h,onToggleFolder:m},`${N.type}:${N.path}`))]}):e.jsxs("div",{className:`workspace-file-tree-row file ${S?"changed":""} ${u===o?"selected":""}`,style:{paddingLeft:k},children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row-main",title:o,onClick:()=>f(o),children:[e.jsx(Wa,{size:13}),e.jsx("span",{children:a.name}),S&&e.jsxs("small",{children:[e.jsxs("span",{className:"diff-addition",children:["+",S.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",S.deletions]})]})]}),h?e.jsx(is,{className:"workspace-file-tree-bookmark-actions",currentStatus:c?.(o)??null,onSetStatus:N=>h(o,N)}):null]})}function Zs({diff:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=t?.files??[],o=l.useMemo(()=>new Map(m.map(k=>[k.path,k])),[m]),x=n?.replace(/^\/+|\/+$/g,"")||null,S=l.useMemo(()=>{if(!x)return a;const k=`${x}/`;return a.filter(N=>N.startsWith(k)).map(N=>N.slice(k.length)).filter(Boolean)},[x,a]);return e.jsx("div",{className:"workspace-diff-files-view",children:e.jsx(Vi,{changedByPath:o,expandedFolderPaths:s,rootPath:x,repoFiles:S,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h})})}function Gi({collapsed:t,editorControlsVisible:s,hideWhiteSpace:n,loadFullFiles:a,renderMarkdown:i,wordDiffs:u,wordWrap:c,onClose:f,onCopyGitApply:h,onRefresh:m,onToggleCollapsed:o,onToggleEditorControlsVisible:x,onToggleHideWhiteSpace:S,onToggleLoadFullFiles:k,onToggleRenderMarkdown:N,onToggleWordDiffs:E,onToggleWordWrap:_}){return e.jsxs("div",{className:"workspace-diff-options-menu",role:"menu",children:[e.jsx(ce,{icon:e.jsx(as,{size:14}),label:"Refresh",onClick:m,onClose:f}),e.jsx(ce,{checked:c,icon:e.jsx(Ia,{size:14}),label:"Enable word wrap",onClick:_,onClose:f}),e.jsx(ce,{checked:t,icon:e.jsx(si,{size:14}),label:"Collapse all diffs",onClick:o,onClose:f}),e.jsx("div",{className:"workspace-diff-menu-divider"}),e.jsx(ce,{checked:s,icon:e.jsx(oi,{size:14}),label:"Show editor controls",onClick:x,onClose:f}),e.jsx(ce,{checked:i,icon:e.jsx(an,{size:14}),label:"Render Markdown",onClick:N,onClose:f}),e.jsx(ce,{checked:!a,icon:e.jsx(lt,{size:14}),label:"Show diffs first",onClick:k,onClose:f}),e.jsx(ce,{checked:u,icon:e.jsx(ei,{size:14}),label:"Enable word diffs",onClick:E,onClose:f}),e.jsx(ce,{checked:n,icon:e.jsx(ri,{size:14}),label:"Hide white space",onClick:S,onClose:f}),e.jsx(ce,{icon:e.jsx(Qa,{size:14}),label:"Copy git apply command",onClick:h,onClose:f})]})}function ce({checked:t,icon:s,label:n,onClick:a,onClose:i}){return e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{a?.(),i()},children:[s,e.jsx("span",{children:n}),t&&e.jsx(ga,{size:14})]})}function Ki({addMenuOpen:t,expanded:s,filteredFiles:n,dirtyFilePaths:a,openFiles:i,goalDetailsAvailable:u,searchOpen:c,searchQuery:f,selectedPath:h,sideChatTabs:m=[],summaryAvailable:o,sourceStatus:x,sourceSwitcher:S,visibleTab:k,getFileBookmarkStatus:N,onCloseFileTab:E,onCloseSideChat:_,onCloseSearch:I,onOpenFile:G,onOpenBrowser:U,onOpenSearch:B,onOpenSideChat:j,onSearchQueryChange:R,onSetFileBookmarkStatus:T,onSelectFile:M,onSelectFiles:A,onSelectGoal:Q,onSelectSummary:q,onSelectSideChat:z,onToggleAddMenu:H,onToggleExpanded:re}){const le=l.useRef(null);l.useEffect(()=>{if(!t&&!c)return;function w(){t&&H(),c&&I()}function F(de){le.current?.contains(de.target)||w()}function D(de){de.key==="Escape"&&w()}return document.addEventListener("pointerdown",F),document.addEventListener("keydown",D),()=>{document.removeEventListener("pointerdown",F),document.removeEventListener("keydown",D)}},[t,I,H,c]);function Y(w){if(w.key==="Escape"){I();return}w.key==="Enter"&&n[0]&&G(n[0])}function J(w){if(!["ArrowRight","ArrowLeft","Home","End"].includes(w.key))return;const F=w.target;if(!(F instanceof HTMLButtonElement)||F.getAttribute("role")!=="tab")return;const D=Array.from(w.currentTarget.querySelectorAll('button[role="tab"]')),de=D.indexOf(F);if(de<0||D.length===0)return;w.preventDefault();const Et=Na(de,D.length,w.key),Ae=D[Et];if(!Ae)return;Ae.focus(),Ae.click();const X=Ae.id;X&&window.requestAnimationFrame(()=>document.getElementById(X)?.focus())}return e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsxs("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",onKeyDown:J,children:[u?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="goal"?"active":""}`,role:"tab","aria-selected":k==="goal",onClick:Q,children:[e.jsx(lt,{size:14}),e.jsx("span",{children:"Goal"})]}):null,o&&q?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="summary"?"active":""}`,role:"tab","aria-selected":k==="summary",onClick:q,children:[e.jsx(Vs,{size:14}),e.jsx("span",{children:"Summary"})]}):null,e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="files"?"active":""}`,role:"tab",id:"right-sidebar-files-tab","aria-controls":"right-sidebar-files-panel","aria-selected":k==="files",tabIndex:k==="files"?0:-1,onClick:A,children:[e.jsx(yt,{size:14}),e.jsx("span",{children:"Files"})]}),i.map(w=>e.jsxs("div",{className:`workspace-diff-tab file ${k==="file"&&h===w.path?"active":""}`,children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab","aria-selected":k==="file"&&h===w.path,title:w.path,onClick:()=>M(w.path),children:[e.jsx(lt,{className:"workspace-diff-tab-icon",size:13}),a.has(w.path)&&e.jsx("span",{className:"workspace-diff-tab-dirty","aria-hidden":"true"}),e.jsx("span",{children:w.path.split("/").pop()})]}),T?e.jsx(is,{className:"workspace-diff-tab-bookmark-actions",currentStatus:N?.(w.path)??null,onSetStatus:F=>T(w.path,F)}):null,e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${w.path}`,onClick:F=>E(w.path,F),children:e.jsx(Is,{size:12})})]},w.path)),m.map(w=>e.jsxs("div",{className:"workspace-diff-tab right-chat-tab",children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab",id:`right-chat-tab-${w.id}`,"aria-controls":`right-chat-panel-${w.id}`,"aria-selected":!1,tabIndex:-1,title:w.title,onClick:()=>z?.(w.id),children:[w.running?e.jsx("span",{className:"right-chat-status-dot","aria-label":"Running"}):null,e.jsx("span",{children:w.title})]}),_?e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${w.title}`,"aria-label":`Close ${w.title}`,onClick:F=>{F.stopPropagation(),_(w.id)},children:e.jsx(Is,{size:12})}):null]},w.id)),e.jsxs("div",{className:"workspace-diff-add-anchor",ref:le,children:[e.jsx("button",{type:"button",className:`workspace-diff-add-tab ${t||c?"active":""}`,title:"Add","aria-label":"Add to right sidebar",onClick:H,children:e.jsx(ja,{size:15})}),t&&e.jsxs("div",{className:"workspace-diff-add-menu",role:"menu",children:[j?e.jsxs("button",{type:"button",role:"menuitem",onClick:j,children:[e.jsx(va,{size:14}),e.jsx("span",{children:"New task"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:A,children:[e.jsx(yt,{size:14}),e.jsx("span",{children:"Files"}),e.jsx("kbd",{})]}),o&&q?e.jsxs("button",{type:"button",role:"menuitem",onClick:q,children:[e.jsx(Vs,{size:14}),e.jsx("span",{children:"Summary"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:B,children:[e.jsx(ka,{size:14}),e.jsx("span",{children:"Open file"}),e.jsx("kbd",{children:"Ctrl+P"})]}),U?e.jsxs("button",{type:"button",role:"menuitem",onClick:U,children:[e.jsx(wa,{size:14}),e.jsx("span",{children:"Browser"}),e.jsx("kbd",{children:"Ctrl+I"})]}):null]}),c&&e.jsxs("div",{className:"workspace-file-search-popover",children:[e.jsx("input",{autoFocus:!0,placeholder:"Search files",value:f,onChange:w=>R(w.target.value),onKeyDown:Y}),e.jsx("span",{children:"Files"}),e.jsx("div",{className:"workspace-file-search-results",children:n.length===0?e.jsx("small",{children:"Type to search for files"}):n.map(w=>e.jsx("button",{type:"button",onClick:()=>G(w),children:w},w))})]})]})]}),S||x?e.jsxs("div",{className:"workspace-diff-source-bar","aria-label":"Workspace source",children:[S?e.jsx("div",{className:"workspace-diff-source-toggle",role:"group","aria-label":"File source",children:S.options.map(w=>e.jsx("button",{type:"button",className:S.value===w.value?"active":"","aria-pressed":S.value===w.value,onClick:()=>S.onChange(w.value),children:w.label},w.value))}):null,x?e.jsx("span",{className:`workspace-diff-source-status ${x.tone}`,children:x.label}):null]}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:s?"Restore files panel":"Expand files panel","aria-label":s?"Restore files panel":"Expand files panel",onClick:re,children:s?e.jsx(Xa,{size:14}):e.jsx(ya,{size:14})})]})}function qi({canCheckActiveFile:t,canSaveActiveFile:s,collapsed:n,editorControlsVisible:a,editorDiagnosticStatus:i,editorDiagnosticsChecking:u,hideWhiteSpace:c,loadFullFiles:f,menuOpen:h,renderMarkdown:m,showEditorCommandBar:o,showRenderMarkdownToggle:x,splitView:S,wordDiffs:k,wordWrap:N,onCopyGitApply:E,onEditorCheck:_,onEditorRedo:I,onEditorSave:G,onEditorUndo:U,onRefresh:B,onToggleCollapsed:j,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:T,onToggleLoadFullFiles:M,onToggleMenu:A,onToggleRenderMarkdown:Q,onToggleSplitView:q,onToggleWordDiffs:z,onToggleWordWrap:H}){return e.jsx("div",{className:"workspace-diff-toolbar",children:e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsxs("div",{className:"workspace-diff-menu-anchor",children:[e.jsx("button",{type:"button",className:"diff-icon-button",title:"Diff options","aria-haspopup":"menu","aria-expanded":h,onClick:()=>A(),children:e.jsx(Sa,{size:15})}),h&&e.jsx(Gi,{collapsed:n,editorControlsVisible:a,hideWhiteSpace:c,loadFullFiles:f,renderMarkdown:m,wordDiffs:k,wordWrap:N,onClose:()=>A(!1),onCopyGitApply:E,onRefresh:B,onToggleCollapsed:j,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:T,onToggleLoadFullFiles:M,onToggleRenderMarkdown:Q,onToggleWordDiffs:z,onToggleWordWrap:H})]}),o&&e.jsxs("div",{className:"workspace-editor-command-bar","aria-label":"Editor controls",children:[e.jsx("button",{type:"button",className:"diff-icon-button",title:"Save file","aria-label":"Save file",disabled:!s,onClick:G,children:e.jsx(Za,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Undo","aria-label":"Undo",onClick:U,children:e.jsx(hi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Redo","aria-label":"Redo",onClick:I,children:e.jsx(fi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Check file","aria-label":"Check file",disabled:!t,onClick:_,children:u?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(Bs,{size:14})}),i&&e.jsxs("span",{className:`workspace-editor-diagnostic-chip ${i.severity}`,children:[i.severity==="error"||i.severity==="warning"||i.severity==="unavailable"?e.jsx(nn,{size:13}):e.jsx(Bs,{size:13}),e.jsx("span",{children:i.label})]})]}),x&&e.jsx("button",{type:"button",className:`diff-icon-button ${m?"active":""}`,title:m?"Show Markdown source":"Render Markdown","aria-label":m?"Show Markdown source":"Render Markdown","aria-pressed":m,onClick:Q,children:e.jsx(an,{size:14})}),e.jsx("button",{type:"button",className:`diff-icon-button ${S?"active":""}`,title:S?"Show unified diff":"Show split diff","aria-label":S?"Show unified diff":"Show split diff","aria-pressed":S,onClick:q,children:e.jsx(ai,{size:14})})]})})}const Xi={cjs:"typescript",css:"css",html:"html",js:"typescript",json:"json",jsx:"typescript",md:"markdown",mjs:"typescript",py:"python",sh:"shell",ts:"typescript",tsx:"typescript",yaml:"yaml",yml:"yaml"};function rs(t){const s=t.split("/").pop()?.toLowerCase()??"";if(s==="dockerfile")return"shell";if(s==="readme"||s==="readme.md")return"markdown";const n=s.includes(".")?s.split(".").pop()??"":"";return Xi[n]??"text"}function Zi(t,s){return t?s==="markdown"?Qi(t):s==="json"?Fe(t,/("(?:\\.|[^"\\])*"(?=\s*:)|"(?:\\.|[^"\\])*"|[-]?\b\d+(?:\.\d+)?\b|\btrue\b|\bfalse\b|\bnull\b|[{}[\]:,])/g):s==="css"?Fe(t,/(\/\*.*?\*\/|#[\da-fA-F]{3,8}\b|--[\w-]+|[.#]?[\w-]+(?=\s*:)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b\d+(?:\.\d+)?(?:px|rem|em|%|vh|vw)?\b|[{}():;,])/g):s==="html"?Fe(t,/(<!--.*?-->|<\/?[\w-]+|[\w:-]+(?==)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[<>/=])/g):s==="shell"?Fe(t,/(#.*$|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:cd|cp|export|git|npm|pnpm|bun|yarn|rm|mkdir|test|if|then|fi|for|do|done|echo)\b|\$[\w_]+|&&|\|\||[|&;=])/g):s==="python"?Fe(t,/(#.*$|"""[\s\S]*?"""|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:class|def|return|if|elif|else|for|while|try|except|finally|with|as|import|from|None|True|False|async|await|lambda|yield)\b|\b[A-Z][\w]*\b|\b\d+(?:\.\d+)?\b|[+\-*/%=<>!&|.:,()[\]{}]+)/g):Fe(t,/(\/\/.*$|\/\*.*?\*\/|`(?:\\.|[^`\\])*`|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:abstract|as|async|await|boolean|break|case|catch|class|const|continue|default|else|enum|export|extends|false|finally|for|from|function|if|import|in|interface|let|new|null|number|of|return|string|switch|throw|true|try|type|undefined|void|while)\b|\b[A-Z][\w]*\b|\b\d+(?:\.\d+)?\b|[+\-*/%=<>!&|?:.,()[\]{}]+)/g):[{text:" ",kind:"plain"}]}function Qi(t){return/^\s{0,3}#{1,6}\s/.test(t)?[{text:t,kind:"keyword"}]:/^\s*[-*+]\s/.test(t)?[{text:t,kind:"property"}]:Fe(t,/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)]+\)|https?:\/\/\S+)/g)}function Yi(t){return/^(\/\/|#|\/\*|<!--)/.test(t)?"comment":/^["'`]/.test(t)?"string":/^[-]?\d/.test(t)||/^#[\da-fA-F]{3,8}\b/.test(t)?"number":/^\b[A-Z]/.test(t)?"type":/^[.#]?[\w-]+$/.test(t)&&t.includes("-")?"property":/^(?:[{}()[\],.:;<>/=+\-*&|!?%]+)$/.test(t)?"operator":/^(?:--|\$)/.test(t)?"property":"keyword"}function Fe(t,s){const n=[];let a=0;for(const i of t.matchAll(s)){const u=i.index??0;u>a&&n.push({text:t.slice(a,u),kind:"plain"});const c=i[0];if(n.push({text:c,kind:Yi(c)}),a=u+c.length,/^(\/\/|#|<!--)/.test(c))break}return a<t.length&&n.push({text:t.slice(a),kind:"plain"}),n.length>0?n:[{text:t,kind:"plain"}]}function Nt({language:t,text:s}){return e.jsx(e.Fragment,{children:Zi(s,t).map((n,a)=>e.jsx("span",{className:`syntax-token ${n.kind}`,children:n.text},`${a}-${n.text}`))})}const Ji=`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WorkspaceMonacoEditor-cDO3Elh0.js","./index-De4k_YMo.js","./index-C5EoPZr0.css","./WorkspaceMonacoEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e,r as l,_ as fa}from"./index-De4k_YMo.js";import{c as be,m as lt,bm as Ws,aO as nn,aB as Ee,v as W,bn as $t,b3 as Ft,aX as Oe,bo as pa,at as ha,bp as ma,au as xa,F as ba,B as an,h as ga,X as Is,P as ja,av as va,aq as ka,aW as wa,bl as ya,bq as Sa,a$ as Bs,br as Na,bs as ts,bt as Ca,bu as ss,bv as Ra,f as $a,w as rn,t as Fa,bw as Qt,bx as Ea,by as ns,bz as Ce,bA as Aa,bB as Os,bC as Pa,bD as La,bE as Us,bF as Da,bG as Ta}from"./App-DQfdLgyV.js";import{M as _a,u as Hs,I as Ma}from"./MarkdownText-DWGLUbdE.js";import{R as as}from"./refresh-cw-D2E-pp4H.js";import{T as za,F as Wa,a as Ia}from"./chat-file-links-DQYtkwit.js";import{t as Ba,a as Oa,b as Ua,m as Ha,s as Va,d as Ga,f as Ka,c as qa}from"./training-model-data-CKOkpBBL.js";import{F as yt}from"./folder-open-D0PIN0Cj.js";import{I as Vs}from"./info-B-n_omgE.js";import{M as Xa}from"./minimize-2-C6JQGKgk.js";import{S as Za}from"./save-CPNNuWwp.js";import{C as Qa}from"./clipboard-CnNPmg50.js";import{C as Ya}from"./chevron-up-BUOpWd2a.js";const Ja=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],ei=be("text-align-start",Ja);const ti=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],si=be("chevrons-up",ti);const ni=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ai=be("columns-2",ni);const ii=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ri=be("eye-off",ii);const li=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],oi=be("panel-top",li);const ci=[["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"}]],di=be("plug",ci);const ui=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],fi=be("redo-2",ui);const pi=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],hi=be("undo-2",pi);function mi({createRuntime:t,goalRuntime:s,subagentRuntime:n=null,onRunSubagentLifecycleAction:a}){const i=t?"Create/Improve Details":"Goal Details",u=t?Z(t.run.state):n?.activeCount?n.label:s?.actionLabel??"No active goal";return e.jsxs("div",{className:"goal-details-view","aria-label":i,children:[e.jsxs("div",{className:"goal-details-header",children:[e.jsxs("div",{className:"goal-details-title",children:[e.jsx(lt,{size:15,"aria-hidden":"true"}),e.jsx("span",{children:i})]}),e.jsx("span",{className:`goal-details-state ${Di(t?.run.state??null)}`,children:u})]}),e.jsx("div",{className:"goal-details-body",children:t?e.jsx(xi,{runtime:t}):s||n?e.jsx(gi,{goalRuntime:s,subagentRuntime:n,onRunSubagentLifecycleAction:a}):e.jsx(Li,{})})]})}function xi({runtime:t}){const s=t.run,n=s.plan,a=Ws(n?.metadata)??Ws(s.metadata),i=s.questions,u=i.filter(o=>o.status==="pending"),c=s.sourceRefs,f=s.checkRefs,h=s.state,m=s.target.kind==="agent"?s.target.defaultActionKey:null;return e.jsxs(e.Fragment,{children:[e.jsx(V,{title:"Current Work",children:e.jsx(it,{rows:[["State",Z(h)],["Operation",s.operation],["Target",Z(s.target.kind)],["Name",s.target.displayName??s.target.id??"Pending"],["Target ID",s.target.id??"Pending"],["Default action",m??n?.defaultChatAction.key??"Pending"],["Adapter",Z(s.adapter.kind)],["Run",s.id],["Revision",String(s.revision)]]})}),e.jsx(V,{title:"Plan",children:n?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"goal-details-summary",children:n.summary}),e.jsx(it,{rows:[["Objective",n.objective],["Context",n.capturedContextSummary],["Status",Z(n.status)],["Plan ID",n.id],["Run ID",n.runId],["Approval",n.approvalId??"Pending"],["Approved",n.approvedAt??"Not approved"]]})]}):u.length?e.jsx("p",{className:"goal-details-summary",children:"Waiting for answers before the model finalizes the Create plan."}):e.jsx("p",{className:"goal-details-summary",children:"The model is preparing the Create plan."})}),a?e.jsxs(V,{title:"Action Shape",children:[e.jsx(it,{rows:[["Mode",a.label],["Default action",a.defaultActionKey??"None"],["Direct action",a.directActionHint??"None planned"],["Artifacts",a.artifactPolicy]]}),e.jsx("p",{className:"goal-details-note",children:a.detail})]}):null,i.length?e.jsx(V,{title:"Questions",children:e.jsx("div",{className:"goal-details-list",children:i.map(o=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.title}),e.jsx("span",{className:`goal-details-inline-state ${o.status}`,children:Z(o.status)})]}),e.jsx("p",{children:o.prompt}),o.answer?e.jsxs("small",{children:["Answer: ",o.answer.label??o.answer.value]}):o.options.length?e.jsxs("small",{children:["Options: ",o.options.map(x=>x.label).join(", ")]}):null]},o.id))})}):null,n?.requirements.length?e.jsx(V,{title:"Setup Requirements",children:e.jsx("div",{className:"goal-details-list",children:n.requirements.map(o=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.name}),e.jsx("span",{className:`goal-details-inline-state ${o.status}`,children:Z(o.status)})]}),e.jsxs("small",{children:[Z(o.kind),o.detail?`: ${o.detail}`:""]})]},`${o.kind}:${o.name}`))})}):null,n?.sourcePlan.length?e.jsx(V,{title:"Source Plan",children:e.jsx(wt,{refs:n.sourcePlan.map(o=>({id:`${o.operation}:${o.path}`,primary:o.path,secondary:`${Z(o.operation)}: ${o.reason}`}))})}):null,n?.checks.length?e.jsx(V,{title:"Checks",children:e.jsx(wt,{refs:n.checks.map(o=>({id:o.name,primary:o.name,secondary:`${o.required?"Required":"Optional"}: ${o.command}`}))})}):null,c.length||f.length?e.jsx(V,{title:"Run Refs",children:e.jsx(wt,{refs:[...c.map(o=>({id:`source:${o}`,primary:o,secondary:"Source ref"})),...f.map(o=>({id:`check:${o}`,primary:o,secondary:"Check ref"}))]})}):null,e.jsx(bi,{run:s}),s.blockedReason?e.jsx(V,{title:"Blocked",children:e.jsxs("div",{className:"goal-details-alert",children:[e.jsx(nn,{size:15}),e.jsx("span",{children:s.blockedReason})]})}):null,e.jsx(V,{title:"Raw State",children:e.jsxs("details",{className:"goal-details-raw",children:[e.jsx("summary",{children:"Show structured payload"}),e.jsx("pre",{children:JSON.stringify(s,null,2)})]})})]})}function bi({run:t}){const s=[...t.context.attachments.map(i=>({id:`attachment:${i.id??i.name}`,primary:i.name,secondary:i.ref??i.mediaType??"Attachment"})),...t.context.apps.map(i=>({id:`app:${i.id}`,primary:i.name,secondary:i.required?"Required app context":"Optional app context"})),...t.context.tools.map(i=>({id:`tool:${i.name}`,primary:i.name,secondary:i.outputSummary??i.inputSummary??"Tool context"})),...t.context.targetRepoAssumptions.map(i=>({id:`target:${i}`,primary:i,secondary:"Target assumption"}))],n=t.workflowCapture,a=n?[...n.files.map(i=>({id:`workflow-file:${i}`,primary:i,secondary:"Captured file"})),...n.outputArtifacts.map(i=>({id:`workflow-artifact:${i}`,primary:i,secondary:"Output artifact"})),...n.traceRefs.map(i=>({id:`workflow-trace:${i}`,primary:i,secondary:"Trace"}))]:[];return!s.length&&!a.length?null:e.jsx(V,{title:"Context",children:e.jsx(wt,{refs:[...s,...a]})})}function gi({goalRuntime:t,subagentRuntime:s,onRunSubagentLifecycleAction:n}){return e.jsxs(e.Fragment,{children:[t?e.jsxs(V,{title:"Goal",children:[e.jsx("p",{className:"goal-details-summary",children:t.objective}),e.jsx(it,{rows:[["Status",t.actionLabel],["Runtime",t.timeLabel],["Detail",t.detail]]})]}):null,s?e.jsx(ji,{runtime:s,onRunSubagentLifecycleAction:n}):null,e.jsx(V,{title:"Raw State",children:e.jsxs("details",{className:"goal-details-raw",children:[e.jsx("summary",{children:"Show structured payload"}),e.jsx("pre",{children:JSON.stringify({goalRuntime:t,subagentRuntime:s},null,2)})]})})]})}function ji({runtime:t,onRunSubagentLifecycleAction:s}){const[n,a]=l.useState(null),[i,u]=l.useState(null);Ee(i);const c=async(f,h)=>{if(!s)return;const m=`${f}:${h}`;a(m),u(null);try{await s({runId:f,action:h})}catch(o){u(o instanceof Error?o.message:String(o))}finally{a(o=>o===m?null:o)}};return e.jsxs(e.Fragment,{children:[e.jsxs(V,{title:"Subagents",children:[e.jsx(it,{rows:[["Latest update",Ci(t)],["Active",String(t.activeCount)],["Completed",String(t.completedCount)],["Failed",String(t.failedCount)],["Cancelled",String(t.cancelledCount)],["Paused",String(t.needsResumeCount)],["Terminal",String(t.terminalCount)],["Usage",Ri(t.usage.totalTokens,t.usage.requestCount)],["Evidence",String(t.evidenceRefs.length)],["Checks",String(t.testsRunCount)]]}),t.blockers.length>0?e.jsx("ul",{className:"goal-details-list compact",children:t.blockers.slice(0,4).map(f=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${f.status}`,children:f.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(f.roleId)}),e.jsx("p",{children:f.message})]})]},`${f.runId}:${f.message}`))}):null,e.jsx("ul",{className:"goal-details-list",children:t.runs.slice(0,8).map(f=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${f.status}`,children:f.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(f.roleId)}),e.jsx("p",{children:f.objective}),f.report?.summary?e.jsx("small",{children:f.report.summary}):null,s?e.jsx(ki,{pendingAction:n,run:f,onRun:c}):null]})]},f.id))})]}),t.finalResults.length>0?e.jsx(vi,{results:t.finalResults}):null]})}function vi({results:t}){return e.jsx(V,{title:"Child Results",children:e.jsx("ol",{className:"goal-details-task-graph",children:t.slice(0,6).map(s=>e.jsxs("li",{className:"goal-details-task-node",children:[e.jsxs("div",{className:"goal-details-task-node-header",children:[e.jsx("span",{className:`goal-details-inline-state ${s.status}`,children:s.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(s.roleId)}),e.jsx("small",{children:s.objective})]})]}),e.jsx("p",{children:s.summary}),e.jsxs("div",{className:"goal-details-task-node-meta",children:[e.jsxs("span",{children:[s.refs.length," refs"]}),e.jsxs("span",{children:[s.testsRun.length+s.validationAttempts.length," checks"]}),e.jsxs("span",{children:[s.blockers.length," blockers"]}),e.jsx("span",{children:s.confidence?`${Z(s.confidence)} confidence`:"Confidence unknown"})]}),s.findings.length>0?e.jsxs("small",{children:["Findings: ",Re(s.findings,3)]}):null,s.changedFiles.length>0?e.jsxs("small",{children:["Files: ",Re(s.changedFiles,4)]}):null,s.testsRun.length>0?e.jsxs("small",{children:["Tests: ",Re(s.testsRun,3)]}):null,s.validationAttempts.length>0?e.jsxs("small",{children:["Validation: ",Re(s.validationAttempts,2)]}):null,s.refs.length>0?e.jsxs("small",{children:["Refs: ",Re(s.refs.map($i),4)]}):null,s.blockers.length>0?e.jsxs("small",{children:["Blockers: ",Re(s.blockers,3)]}):null,s.workspaceRetention?e.jsxs("small",{children:["Workspace: ",Ei(s.workspaceRetention)]}):null,s.importantMessages.length>0?e.jsxs("small",{children:["Messages: ",Re(s.importantMessages.map(Fi),2)]}):null]},s.runId))})})}function ki({pendingAction:t,run:s,onRun:n}){const a=wi(s);return a.length===0?null:e.jsx("div",{className:"goal-details-actions",children:a.map(i=>{const u=`${s.id}:${i}`,c=t===u;return e.jsx("button",{type:"button",disabled:!!t,onClick:()=>{n(s.id,i)},children:c?"Working...":yi(i)},i)})})}function wi(t){const s=[],n=Si(t),a=Ni(t);return n&&s.push("cleanup"),a&&s.push("archive"),s}function yi(t){return t==="cleanup"?"Clean":t==="archive"?"Archive":"Clean + archive"}function Si(t){if(!ln(t))return!1;const s=rt(t.metadata);if(!s?.subagentWorkspace&&!s?.workspaceHandoff)return!1;const n=rt(s.lifecycleCleanup),a=rt(n?.workspaceCleanup),i=on(a?.status);return i!=="removed"&&i!=="deleted"&&i!=="retained"&&i!=="skipped"}function Ni(t){if(!t.childSessionId||!ln(t))return!1;const s=rt(rt(t.metadata)?.childSessionArchive),n=on(s?.status);return n!=="archived"&&n!=="already_archived"}function ln(t){return t.status==="completed"||t.status==="failed"||t.status==="cancelled"}function Ci(t){const s=t.latestMeaningfulUpdate;return s?`${St(s.roleId)} ${s.status}: ${s.message}`:"No structured update"}function Ri(t,s){if(t<=0&&s<=0)return"0 tokens";const n=`${s} ${s===1?"request":"requests"}`;return`${Ai(t)} tokens · ${n}`}function St(t){return t.slice(0,1).toUpperCase()+t.slice(1).replace(/[-_]+/g," ")}function $i(t){return`${t.kind}: ${t.label}`}function Fi(t){return`${Z(t.kind)}: ${t.body}`}function Ei(t){const s=t.expiresAt?`until ${Pi(t.expiresAt)}`:"for inspection",n=t.trigger?` · ${Z(t.trigger)}`:"";return`retained ${s}${n}`}function Re(t,s){const n=t.slice(0,s),a=t.length-n.length;return a>0?`${n.join(", ")} +${a}`:n.join(", ")}function Ai(t){if(t<1e3)return String(t);if(t>=1e6){const n=t/1e6;return`${Gs(n,n<10?2:1)}M`}const s=t/1e3;return`${Gs(s,s<10?1:0)}k`}function Pi(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Gs(t,s){return t.toFixed(s).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")}function Li(){return e.jsxs("div",{className:"goal-details-empty",children:[e.jsx(lt,{size:18}),e.jsx("span",{children:"No active Goal or Create workflow."})]})}function V({children:t,title:s}){return e.jsxs("section",{className:"goal-details-section",children:[e.jsx("h2",{children:s}),t]})}function it({rows:t}){return e.jsx("dl",{className:"goal-details-grid",children:t.map(([s,n])=>e.jsxs("div",{children:[e.jsx("dt",{children:s}),e.jsx("dd",{children:n})]},s))})}function wt({refs:t}){return e.jsx("ul",{className:"goal-details-ref-list",children:t.map(s=>e.jsxs("li",{children:[e.jsx("code",{title:s.primary,children:s.primary}),e.jsx("span",{children:s.secondary})]},s.id))})}function rt(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function on(t){return typeof t=="string"&&t.trim()?t.trim():null}function Z(t){return t.split(/[_-]/g).filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function Di(t){return t==="ready_local"||t==="published_hosted"?"success":t==="blocked"||t==="failed"||t==="cancelled"?"danger":t==="awaiting_questions"||t==="awaiting_plan_approval"?"warning":"active"}function Ti({sandboxId:t,connection:s}){const[n,a]=l.useState(null),[i,u]=l.useState([]),[c,f]=l.useState(null),[h,m]=l.useState(null),[o,x]=l.useState(null),[S,k]=l.useState(null);Ee(o,{prefix:"Sandbox"}),Ee(S,{prefix:"Sandbox integrations"});const N=n?.integrationLeases??[],E=l.useMemo(()=>i.filter(j=>j.status==="active"),[i]),_=l.useMemo(()=>Mi(n),[n]),I=l.useCallback(async()=>{if(!s){x("OpenPond App server is not connected.");return}if(!t){a(null),u([]),x(null);return}f("summary"),x(null);try{const j=await W.sandbox(s,t),R=await W.integrationConnections(s,Ks(j.sandbox));a(j.sandbox),u(R.connections),k(null)}catch(j){x(j instanceof Error?j.message:String(j))}finally{f(null)}},[s,t]),G=l.useCallback(async()=>{if(!(!s||!n)){m("load"),k(null);try{const[j,R]=await Promise.all([W.integrationConnections(s,Ks(n)),W.sandboxIntegrationLeases(s,n.id)]);u(j.connections),a(R.sandbox)}catch(j){k(j instanceof Error?j.message:String(j))}finally{m(null)}}},[s,n]),U=l.useCallback(async j=>{if(!s||!n)return;const R=$t(j.provider),T=R?Ft(R):null,M=T?.leasePolicy.allowedCapabilityIds??[];if(!R||!T?.leasePolicy.leaseable||M.length===0){k(`${ae(j.provider)} cannot be attached to this sandbox.`);return}m(`attach:${j.id}`),k(null);try{const A=await W.attachSandboxIntegrationConnection(s,n.id,{connectionId:j.id,provider:j.provider,capabilities:M,...j.scopes.length>0?{scopes:j.scopes}:{},...T.leasePolicy.defaultTtlSeconds?{ttlSeconds:T.leasePolicy.defaultTtlSeconds}:{},required:!1});a(A.sandbox)}catch(A){k(A instanceof Error?A.message:String(A))}finally{m(null)}},[s,n]),B=l.useCallback(async j=>{if(!(!s||!n)){m(`remove:${j}`),k(null);try{const R=await W.removeSandboxIntegrationLease(s,n.id,j);a(R.sandbox)}catch(R){k(R instanceof Error?R.message:String(R))}finally{m(null)}}},[s,n]);return l.useEffect(()=>{I()},[I]),t?e.jsxs("div",{className:"sandbox-summary-tab",children:[e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Sandbox"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[n?e.jsx("span",{children:n.state}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh summary","aria-label":"Refresh summary",disabled:c!==null,onClick:()=>{I()},children:c==="summary"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(as,{size:14})})]})]}),n?e.jsxs("dl",{className:"sandbox-workspace-kv",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Sandbox"}),e.jsx("dd",{children:qs(n.id)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Spend"}),e.jsxs("dd",{children:[Yt(n.reservation.capturedUsd)," / ",Yt(n.budget.maxUsd)]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Reservation"}),e.jsx("dd",{children:n.reservation.status})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Idle cleanup"}),e.jsx("dd",{children:n.quotas?.idleTimeoutSeconds?`${Math.round(n.quotas.idleTimeoutSeconds/60)} min`:"-"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Updated"}),e.jsx("dd",{children:cn(n.updatedAt)})]}),_?e.jsxs("div",{children:[e.jsx("dt",{children:"Receipt"}),e.jsxs("dd",{children:[qs(_.id)," / ",Yt(_.totalUsd)]})]}):null]}):e.jsxs("div",{className:"sandbox-workspace-loading",children:[c==="summary"?e.jsx(Oe,{className:"spinning",size:16}):null,e.jsx("span",{children:c==="summary"?"Loading sandbox":"Sandbox unavailable"})]})]}),e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Integrations"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[e.jsx("span",{children:N.length}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh integrations","aria-label":"Refresh integrations",disabled:h!==null||!n,onClick:()=>{G()},children:h==="load"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(as,{size:14})})]})]}),N.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:N.map(j=>e.jsxs("div",{className:"sandbox-workspace-integration-row",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:ae(j.provider)}),e.jsxs("small",{children:[j.required?"required":"optional"," / ",Ii(j)," / ",_i(j)]})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:`Revoke ${ae(j.provider)} lease`,"aria-label":`Revoke ${ae(j.provider)} lease`,disabled:h!==null,onClick:()=>{B(j.leaseId)},children:h===`remove:${j.leaseId}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(za,{size:14})}),e.jsxs("div",{className:"sandbox-workspace-chip-row",children:[j.capabilities.slice(0,5).map(R=>e.jsx("span",{children:Wi(j.provider,R)},R)),j.capabilities.length>5?e.jsxs("span",{children:["+",j.capabilities.length-5]}):null]})]},j.leaseId))}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No active integration leases."}),E.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:E.map(j=>{const R=N.some(A=>A.provider===j.provider),M=zi(j)?.leasePolicy.allowedCapabilityIds.length??0;return e.jsxs("div",{className:"sandbox-workspace-integration-row compact",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:Bi(j)}),e.jsx("small",{children:Oi(j,M)})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:R?`${ae(j.provider)} already attached`:`Attach ${ae(j.provider)}`,"aria-label":R?`${ae(j.provider)} already attached`:`Attach ${ae(j.provider)}`,disabled:R||h!==null||M===0,onClick:()=>{U(j)},children:h===`attach:${j.id}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(di,{size:14})})]},j.id)})}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No connected accounts available."})]})]}):e.jsx("div",{className:"sandbox-summary-tab",children:e.jsx("p",{className:"sandbox-workspace-empty",children:"No sandbox is attached yet."})})}function Ks(t){return{status:"active"}}function _i(t){return t.proxyUrl?"runtime proxy available":"metadata only, no runtime proxy"}function Mi(t){return t?.receipts?.at(-1)??null}function zi(t){const s=$t(t.provider);return s?Ft(s):null}function ae(t){const s=$t(t),n=s?Ft(s):null;return n?n.label:t==="microsoft_teams"?"Microsoft Teams":t?t.replace(/_/g," "):"Integration"}function Wi(t,s){const n=$t(t);return(n?Ft(n):null)?.capabilities.find(i=>i.id===s)?.label??s}function Ii(t){return t.expiresAt?`expires ${cn(t.expiresAt)}`:"active"}function Bi(t){const s=t.providerAccountName?.trim();return s?`${ae(t.provider)} / ${s}`:ae(t.provider)}function Oi(t,s){const n=[];return t.providerWorkspaceName&&n.push(t.providerWorkspaceName),n.push(`${s} lease ${s===1?"capability":"capabilities"}`),t.scopes.length>0&&n.push(`${t.scopes.length} ${t.scopes.length===1?"scope":"scopes"}`),n.join(" / ")}function qs(t){return t.length>10?`${t.slice(0,8)}...`:t}function cn(t){if(!t)return"-";const s=new Date(t);return Number.isNaN(s.valueOf())?"-":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(s)}function Yt(t){const s=Number(t??0);return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:s>=10?2:4}).format(Number.isFinite(s)?s:0)}function Ui({summary:t}){const s=Ba(t.taskset),n=t.taskset.learningSignals.demonstrations.filter(f=>f.approved).length,a=t.taskset.tasks.filter(f=>f.split==="frozen_eval").length,i=t.plan?.recipe.method==="sft"||t.plan?.recipe.method==="grpo"?t.plan.recipe:null,u=Oa(t.taskset,t.plan),c=t.job?Ua(t.job.status,t.job.completedAt,t.job.updatedAt):null;return e.jsxs("div",{className:"training-sidebar-summary",children:[e.jsxs("header",{children:[e.jsx("h2",{children:Ha(t.taskset.name)}),e.jsx("span",{children:t.job?Va(t.job.status):t.taskset.readiness?.ready?"Ready to train":"Needs review"})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Run"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Primary recommendation",value:s.toUpperCase()}),e.jsx(O,{label:"Training stage",value:u}),e.jsx(O,{label:"Base model",value:i?.baseModel.id??"Not selected"}),e.jsx(O,{label:"Compute",value:t.plan?Ga(t.plan.destinationId):"Not selected"}),e.jsx(O,{label:"Started",value:Ka(t.job?.startedAt??null)}),e.jsx(O,{label:"Duration",value:qa(t.job?.startedAt??null,c)})]})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Data"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Training examples",value:String(n)}),e.jsx(O,{label:"Test examples",value:String(a)}),e.jsx(O,{label:"Dataset sources",value:String(t.taskset.sourceRefs.length)})]})]}),i?e.jsxs("section",{children:[e.jsx("h3",{children:"Recipe"}),e.jsxs("dl",{children:[i.method==="grpo"?e.jsx(O,{label:"RL loss",value:i.loss.method==="gspo-token"?"GSPO-token":i.loss.method.toUpperCase()}):null,e.jsx(O,{label:"LoRA rank",value:String(i.lora.rank)}),e.jsx(O,{label:"Learning rate",value:String(i.optimizer.learningRate)}),e.jsx(O,{label:"Optimizer steps",value:String(i.optimizer.maxSteps)}),e.jsx(O,{label:i.method==="grpo"?"Prompt length":"Sequence length",value:String(i.method==="grpo"?i.dataset.maxPromptTokens:i.dataset.maxSequenceLength)})]})]}):null,e.jsxs("section",{children:[e.jsx("h3",{children:"Result"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Adapter",value:t.lineage?`${u} ready`:"Not created"}),e.jsx(O,{label:"Evaluation",value:t.lineage?.frozenEvaluationArtifactId?"Completed":"Not completed"}),e.jsx(O,{label:"Artifacts",value:String(t.artifacts.length)})]})]})]})}function O({label:t,value:s}){return e.jsxs("div",{children:[e.jsx("dt",{children:t}),e.jsx("dd",{children:s})]})}function Hi(t){const s=Xs("","","folder");for(const n of t){const a=n.endsWith("/"),i=n.split("/").filter(Boolean);if(i.length===0)continue;let u=s,c="";for(let f=0;f<i.length;f+=1){const h=i[f];c=c?`${c}/${h}`:h;const m=!a&&f===i.length-1?"file":"folder",o=`${m}:${h}`;let x=u.childMap.get(o);x||(x=Xs(h,c,m),u.childMap.set(o,x),u.children.push(x)),u=x}}return dn(s.children)}function Xs(t,s,n){return{name:t,path:s,type:n,children:[],childMap:new Map}}function dn(t){return t.sort((s,n)=>s.type!==n.type?s.type==="folder"?-1:1:s.name.localeCompare(n.name)).map(s=>({name:s.name,path:s.path,type:s.type,children:dn(s.children)}))}function is({className:t,currentStatus:s,onSetStatus:n}){const a=s==="pinned",i=s==="saved_for_later";return e.jsxs("span",{className:`workspace-file-bookmark-actions ${t??"workspace-file-heading-actions"}`,children:[e.jsx("button",{type:"button",className:a?"active":void 0,"data-tooltip":a?"Unpin file":"Pin file","aria-label":a?"Unpin file":"Pin file","aria-pressed":a,onClick:()=>n(a?"none":"pinned"),children:a?e.jsx(pa,{size:14}):e.jsx(ha,{size:14})}),e.jsx("button",{type:"button",className:i?"active":void 0,"data-tooltip":i?"Remove from Save for later":"Save file for later","aria-label":i?"Remove from Save for later":"Save file for later","aria-pressed":i,onClick:()=>n(i?"none":"saved_for_later"),children:i?e.jsx(ma,{size:14}):e.jsx(xa,{size:14})})]})}function Vi({changedByPath:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=l.useMemo(()=>Hi(a),[a]);return e.jsxs("div",{className:"workspace-file-tree-view",children:[e.jsxs("div",{className:"workspace-file-tree-header",children:[e.jsx(yt,{size:14}),e.jsx("strong",{title:n??void 0,children:n?n.split("/").at(-1):"Files"}),e.jsx("span",{children:a.length})]}),e.jsx("div",{className:"workspace-file-tree",children:m.map(o=>e.jsx(un,{changedByPath:t,expandedFolderPaths:s,node:o,rootPath:n,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h},`${o.type}:${o.path}`))})]})}function un({changedByPath:t,depth:s=0,expandedFolderPaths:n,node:a,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:f,onSetFileBookmarkStatus:h,onToggleFolder:m}){const o=i?`${i}/${a.path}`:a.path,x=a.type==="folder"&&n.has(o),S=t.get(o),k=2+s*11;return a.type==="folder"?e.jsxs("div",{className:"workspace-file-tree-node",children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row folder","aria-expanded":x,style:{paddingLeft:k},onClick:()=>m(o),children:[x?e.jsx(yt,{size:14}):e.jsx(ba,{size:14}),e.jsx("span",{children:a.name})]}),x&&a.children.map(N=>e.jsx(un,{changedByPath:t,depth:s+1,expandedFolderPaths:n,node:N,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:f,onSetFileBookmarkStatus:h,onToggleFolder:m},`${N.type}:${N.path}`))]}):e.jsxs("div",{className:`workspace-file-tree-row file ${S?"changed":""} ${u===o?"selected":""}`,style:{paddingLeft:k},children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row-main",title:o,onClick:()=>f(o),children:[e.jsx(Wa,{size:13}),e.jsx("span",{children:a.name}),S&&e.jsxs("small",{children:[e.jsxs("span",{className:"diff-addition",children:["+",S.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",S.deletions]})]})]}),h?e.jsx(is,{className:"workspace-file-tree-bookmark-actions",currentStatus:c?.(o)??null,onSetStatus:N=>h(o,N)}):null]})}function Zs({diff:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=t?.files??[],o=l.useMemo(()=>new Map(m.map(k=>[k.path,k])),[m]),x=n?.replace(/^\/+|\/+$/g,"")||null,S=l.useMemo(()=>{if(!x)return a;const k=`${x}/`;return a.filter(N=>N.startsWith(k)).map(N=>N.slice(k.length)).filter(Boolean)},[x,a]);return e.jsx("div",{className:"workspace-diff-files-view",children:e.jsx(Vi,{changedByPath:o,expandedFolderPaths:s,rootPath:x,repoFiles:S,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h})})}function Gi({collapsed:t,editorControlsVisible:s,hideWhiteSpace:n,loadFullFiles:a,renderMarkdown:i,wordDiffs:u,wordWrap:c,onClose:f,onCopyGitApply:h,onRefresh:m,onToggleCollapsed:o,onToggleEditorControlsVisible:x,onToggleHideWhiteSpace:S,onToggleLoadFullFiles:k,onToggleRenderMarkdown:N,onToggleWordDiffs:E,onToggleWordWrap:_}){return e.jsxs("div",{className:"workspace-diff-options-menu",role:"menu",children:[e.jsx(ce,{icon:e.jsx(as,{size:14}),label:"Refresh",onClick:m,onClose:f}),e.jsx(ce,{checked:c,icon:e.jsx(Ia,{size:14}),label:"Enable word wrap",onClick:_,onClose:f}),e.jsx(ce,{checked:t,icon:e.jsx(si,{size:14}),label:"Collapse all diffs",onClick:o,onClose:f}),e.jsx("div",{className:"workspace-diff-menu-divider"}),e.jsx(ce,{checked:s,icon:e.jsx(oi,{size:14}),label:"Show editor controls",onClick:x,onClose:f}),e.jsx(ce,{checked:i,icon:e.jsx(an,{size:14}),label:"Render Markdown",onClick:N,onClose:f}),e.jsx(ce,{checked:!a,icon:e.jsx(lt,{size:14}),label:"Show diffs first",onClick:k,onClose:f}),e.jsx(ce,{checked:u,icon:e.jsx(ei,{size:14}),label:"Enable word diffs",onClick:E,onClose:f}),e.jsx(ce,{checked:n,icon:e.jsx(ri,{size:14}),label:"Hide white space",onClick:S,onClose:f}),e.jsx(ce,{icon:e.jsx(Qa,{size:14}),label:"Copy git apply command",onClick:h,onClose:f})]})}function ce({checked:t,icon:s,label:n,onClick:a,onClose:i}){return e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{a?.(),i()},children:[s,e.jsx("span",{children:n}),t&&e.jsx(ga,{size:14})]})}function Ki({addMenuOpen:t,expanded:s,filteredFiles:n,dirtyFilePaths:a,openFiles:i,goalDetailsAvailable:u,searchOpen:c,searchQuery:f,selectedPath:h,sideChatTabs:m=[],summaryAvailable:o,sourceStatus:x,sourceSwitcher:S,visibleTab:k,getFileBookmarkStatus:N,onCloseFileTab:E,onCloseSideChat:_,onCloseSearch:I,onOpenFile:G,onOpenBrowser:U,onOpenSearch:B,onOpenSideChat:j,onSearchQueryChange:R,onSetFileBookmarkStatus:T,onSelectFile:M,onSelectFiles:A,onSelectGoal:Q,onSelectSummary:q,onSelectSideChat:z,onToggleAddMenu:H,onToggleExpanded:re}){const le=l.useRef(null);l.useEffect(()=>{if(!t&&!c)return;function w(){t&&H(),c&&I()}function F(de){le.current?.contains(de.target)||w()}function D(de){de.key==="Escape"&&w()}return document.addEventListener("pointerdown",F),document.addEventListener("keydown",D),()=>{document.removeEventListener("pointerdown",F),document.removeEventListener("keydown",D)}},[t,I,H,c]);function Y(w){if(w.key==="Escape"){I();return}w.key==="Enter"&&n[0]&&G(n[0])}function J(w){if(!["ArrowRight","ArrowLeft","Home","End"].includes(w.key))return;const F=w.target;if(!(F instanceof HTMLButtonElement)||F.getAttribute("role")!=="tab")return;const D=Array.from(w.currentTarget.querySelectorAll('button[role="tab"]')),de=D.indexOf(F);if(de<0||D.length===0)return;w.preventDefault();const Et=Na(de,D.length,w.key),Ae=D[Et];if(!Ae)return;Ae.focus(),Ae.click();const X=Ae.id;X&&window.requestAnimationFrame(()=>document.getElementById(X)?.focus())}return e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsxs("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",onKeyDown:J,children:[u?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="goal"?"active":""}`,role:"tab","aria-selected":k==="goal",onClick:Q,children:[e.jsx(lt,{size:14}),e.jsx("span",{children:"Goal"})]}):null,o&&q?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="summary"?"active":""}`,role:"tab","aria-selected":k==="summary",onClick:q,children:[e.jsx(Vs,{size:14}),e.jsx("span",{children:"Summary"})]}):null,e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="files"?"active":""}`,role:"tab",id:"right-sidebar-files-tab","aria-controls":"right-sidebar-files-panel","aria-selected":k==="files",tabIndex:k==="files"?0:-1,onClick:A,children:[e.jsx(yt,{size:14}),e.jsx("span",{children:"Files"})]}),i.map(w=>e.jsxs("div",{className:`workspace-diff-tab file ${k==="file"&&h===w.path?"active":""}`,children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab","aria-selected":k==="file"&&h===w.path,title:w.path,onClick:()=>M(w.path),children:[e.jsx(lt,{className:"workspace-diff-tab-icon",size:13}),a.has(w.path)&&e.jsx("span",{className:"workspace-diff-tab-dirty","aria-hidden":"true"}),e.jsx("span",{children:w.path.split("/").pop()})]}),T?e.jsx(is,{className:"workspace-diff-tab-bookmark-actions",currentStatus:N?.(w.path)??null,onSetStatus:F=>T(w.path,F)}):null,e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${w.path}`,onClick:F=>E(w.path,F),children:e.jsx(Is,{size:12})})]},w.path)),m.map(w=>e.jsxs("div",{className:"workspace-diff-tab right-chat-tab",children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab",id:`right-chat-tab-${w.id}`,"aria-controls":`right-chat-panel-${w.id}`,"aria-selected":!1,tabIndex:-1,title:w.title,onClick:()=>z?.(w.id),children:[w.running?e.jsx("span",{className:"right-chat-status-dot","aria-label":"Running"}):null,e.jsx("span",{children:w.title})]}),_?e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${w.title}`,"aria-label":`Close ${w.title}`,onClick:F=>{F.stopPropagation(),_(w.id)},children:e.jsx(Is,{size:12})}):null]},w.id)),e.jsxs("div",{className:"workspace-diff-add-anchor",ref:le,children:[e.jsx("button",{type:"button",className:`workspace-diff-add-tab ${t||c?"active":""}`,title:"Add","aria-label":"Add to right sidebar",onClick:H,children:e.jsx(ja,{size:15})}),t&&e.jsxs("div",{className:"workspace-diff-add-menu",role:"menu",children:[j?e.jsxs("button",{type:"button",role:"menuitem",onClick:j,children:[e.jsx(va,{size:14}),e.jsx("span",{children:"New task"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:A,children:[e.jsx(yt,{size:14}),e.jsx("span",{children:"Files"}),e.jsx("kbd",{})]}),o&&q?e.jsxs("button",{type:"button",role:"menuitem",onClick:q,children:[e.jsx(Vs,{size:14}),e.jsx("span",{children:"Summary"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:B,children:[e.jsx(ka,{size:14}),e.jsx("span",{children:"Open file"}),e.jsx("kbd",{children:"Ctrl+P"})]}),U?e.jsxs("button",{type:"button",role:"menuitem",onClick:U,children:[e.jsx(wa,{size:14}),e.jsx("span",{children:"Browser"}),e.jsx("kbd",{children:"Ctrl+I"})]}):null]}),c&&e.jsxs("div",{className:"workspace-file-search-popover",children:[e.jsx("input",{autoFocus:!0,placeholder:"Search files",value:f,onChange:w=>R(w.target.value),onKeyDown:Y}),e.jsx("span",{children:"Files"}),e.jsx("div",{className:"workspace-file-search-results",children:n.length===0?e.jsx("small",{children:"Type to search for files"}):n.map(w=>e.jsx("button",{type:"button",onClick:()=>G(w),children:w},w))})]})]})]}),S||x?e.jsxs("div",{className:"workspace-diff-source-bar","aria-label":"Workspace source",children:[S?e.jsx("div",{className:"workspace-diff-source-toggle",role:"group","aria-label":"File source",children:S.options.map(w=>e.jsx("button",{type:"button",className:S.value===w.value?"active":"","aria-pressed":S.value===w.value,onClick:()=>S.onChange(w.value),children:w.label},w.value))}):null,x?e.jsx("span",{className:`workspace-diff-source-status ${x.tone}`,children:x.label}):null]}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:s?"Restore files panel":"Expand files panel","aria-label":s?"Restore files panel":"Expand files panel",onClick:re,children:s?e.jsx(Xa,{size:14}):e.jsx(ya,{size:14})})]})}function qi({canCheckActiveFile:t,canSaveActiveFile:s,collapsed:n,editorControlsVisible:a,editorDiagnosticStatus:i,editorDiagnosticsChecking:u,hideWhiteSpace:c,loadFullFiles:f,menuOpen:h,renderMarkdown:m,showEditorCommandBar:o,showRenderMarkdownToggle:x,splitView:S,wordDiffs:k,wordWrap:N,onCopyGitApply:E,onEditorCheck:_,onEditorRedo:I,onEditorSave:G,onEditorUndo:U,onRefresh:B,onToggleCollapsed:j,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:T,onToggleLoadFullFiles:M,onToggleMenu:A,onToggleRenderMarkdown:Q,onToggleSplitView:q,onToggleWordDiffs:z,onToggleWordWrap:H}){return e.jsx("div",{className:"workspace-diff-toolbar",children:e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsxs("div",{className:"workspace-diff-menu-anchor",children:[e.jsx("button",{type:"button",className:"diff-icon-button",title:"Diff options","aria-haspopup":"menu","aria-expanded":h,onClick:()=>A(),children:e.jsx(Sa,{size:15})}),h&&e.jsx(Gi,{collapsed:n,editorControlsVisible:a,hideWhiteSpace:c,loadFullFiles:f,renderMarkdown:m,wordDiffs:k,wordWrap:N,onClose:()=>A(!1),onCopyGitApply:E,onRefresh:B,onToggleCollapsed:j,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:T,onToggleLoadFullFiles:M,onToggleRenderMarkdown:Q,onToggleWordDiffs:z,onToggleWordWrap:H})]}),o&&e.jsxs("div",{className:"workspace-editor-command-bar","aria-label":"Editor controls",children:[e.jsx("button",{type:"button",className:"diff-icon-button",title:"Save file","aria-label":"Save file",disabled:!s,onClick:G,children:e.jsx(Za,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Undo","aria-label":"Undo",onClick:U,children:e.jsx(hi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Redo","aria-label":"Redo",onClick:I,children:e.jsx(fi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Check file","aria-label":"Check file",disabled:!t,onClick:_,children:u?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(Bs,{size:14})}),i&&e.jsxs("span",{className:`workspace-editor-diagnostic-chip ${i.severity}`,children:[i.severity==="error"||i.severity==="warning"||i.severity==="unavailable"?e.jsx(nn,{size:13}):e.jsx(Bs,{size:13}),e.jsx("span",{children:i.label})]})]}),x&&e.jsx("button",{type:"button",className:`diff-icon-button ${m?"active":""}`,title:m?"Show Markdown source":"Render Markdown","aria-label":m?"Show Markdown source":"Render Markdown","aria-pressed":m,onClick:Q,children:e.jsx(an,{size:14})}),e.jsx("button",{type:"button",className:`diff-icon-button ${S?"active":""}`,title:S?"Show unified diff":"Show split diff","aria-label":S?"Show unified diff":"Show split diff","aria-pressed":S,onClick:q,children:e.jsx(ai,{size:14})})]})})}const Xi={cjs:"typescript",css:"css",html:"html",js:"typescript",json:"json",jsx:"typescript",md:"markdown",mjs:"typescript",py:"python",sh:"shell",ts:"typescript",tsx:"typescript",yaml:"yaml",yml:"yaml"};function rs(t){const s=t.split("/").pop()?.toLowerCase()??"";if(s==="dockerfile")return"shell";if(s==="readme"||s==="readme.md")return"markdown";const n=s.includes(".")?s.split(".").pop()??"":"";return Xi[n]??"text"}function Zi(t,s){return t?s==="markdown"?Qi(t):s==="json"?Fe(t,/("(?:\\.|[^"\\])*"(?=\s*:)|"(?:\\.|[^"\\])*"|[-]?\b\d+(?:\.\d+)?\b|\btrue\b|\bfalse\b|\bnull\b|[{}[\]:,])/g):s==="css"?Fe(t,/(\/\*.*?\*\/|#[\da-fA-F]{3,8}\b|--[\w-]+|[.#]?[\w-]+(?=\s*:)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b\d+(?:\.\d+)?(?:px|rem|em|%|vh|vw)?\b|[{}():;,])/g):s==="html"?Fe(t,/(<!--.*?-->|<\/?[\w-]+|[\w:-]+(?==)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[<>/=])/g):s==="shell"?Fe(t,/(#.*$|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:cd|cp|export|git|npm|pnpm|bun|yarn|rm|mkdir|test|if|then|fi|for|do|done|echo)\b|\$[\w_]+|&&|\|\||[|&;=])/g):s==="python"?Fe(t,/(#.*$|"""[\s\S]*?"""|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:class|def|return|if|elif|else|for|while|try|except|finally|with|as|import|from|None|True|False|async|await|lambda|yield)\b|\b[A-Z][\w]*\b|\b\d+(?:\.\d+)?\b|[+\-*/%=<>!&|.:,()[\]{}]+)/g):Fe(t,/(\/\/.*$|\/\*.*?\*\/|`(?:\\.|[^`\\])*`|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:abstract|as|async|await|boolean|break|case|catch|class|const|continue|default|else|enum|export|extends|false|finally|for|from|function|if|import|in|interface|let|new|null|number|of|return|string|switch|throw|true|try|type|undefined|void|while)\b|\b[A-Z][\w]*\b|\b\d+(?:\.\d+)?\b|[+\-*/%=<>!&|?:.,()[\]{}]+)/g):[{text:" ",kind:"plain"}]}function Qi(t){return/^\s{0,3}#{1,6}\s/.test(t)?[{text:t,kind:"keyword"}]:/^\s*[-*+]\s/.test(t)?[{text:t,kind:"property"}]:Fe(t,/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)]+\)|https?:\/\/\S+)/g)}function Yi(t){return/^(\/\/|#|\/\*|<!--)/.test(t)?"comment":/^["'`]/.test(t)?"string":/^[-]?\d/.test(t)||/^#[\da-fA-F]{3,8}\b/.test(t)?"number":/^\b[A-Z]/.test(t)?"type":/^[.#]?[\w-]+$/.test(t)&&t.includes("-")?"property":/^(?:[{}()[\],.:;<>/=+\-*&|!?%]+)$/.test(t)?"operator":/^(?:--|\$)/.test(t)?"property":"keyword"}function Fe(t,s){const n=[];let a=0;for(const i of t.matchAll(s)){const u=i.index??0;u>a&&n.push({text:t.slice(a,u),kind:"plain"});const c=i[0];if(n.push({text:c,kind:Yi(c)}),a=u+c.length,/^(\/\/|#|<!--)/.test(c))break}return a<t.length&&n.push({text:t.slice(a),kind:"plain"}),n.length>0?n:[{text:t,kind:"plain"}]}function Nt({language:t,text:s}){return e.jsx(e.Fragment,{children:Zi(s,t).map((n,a)=>e.jsx("span",{className:`syntax-token ${n.kind}`,children:n.text},`${a}-${n.text}`))})}const Ji=`
|
|
3
3
|
|
|
4
|
-
[file truncated]`,er=l.lazy(()=>fa(()=>import("./WorkspaceMonacoEditor-
|
|
4
|
+
[file truncated]`,er=l.lazy(()=>fa(()=>import("./WorkspaceMonacoEditor-cDO3Elh0.js").then(t=>t.jc),__vite__mapDeps([0,1,2,3]),import.meta.url)),Jt=6,tr=18,$e=22,Qs=44,sr=160,Ys=12;function Ct({path:t,workspaceName:s,workspaceRootPath:n,onSelectPath:a}){const i=ss(t,n),u=Ra(i),c=u?nr(i):s?.trim()||"Workspace",h=(u&&c!=="/"&&i.startsWith(`${c}/`)?i.slice(c.length+1):i).split("/").filter(Boolean),m=!!(a&&!u);return e.jsxs("span",{className:"workspace-file-breadcrumbs",title:u?i:`${c} > ${i}`,children:[a&&!u?e.jsx("button",{type:"button",onClick:()=>a(null),children:c}):e.jsx("span",{children:c}),h.map((o,x)=>{const S=x===h.length-1,k=h.slice(0,x+1).join("/");return e.jsxs("span",{className:"workspace-file-breadcrumb-segment",children:[e.jsx($a,{size:13}),a&&m&&!S?e.jsx("button",{type:"button",onClick:()=>a(k),children:o}):e.jsx("span",{children:o})]},`${x}-${o}`)})]})}function nr(t){const s=/^[A-Za-z]:\//.exec(t);return s?s[0].slice(0,-1):"/"}function ar({collapsed:t=!1,diagnostics:s=[],draftContent:n,editable:a=!1,editorRef:i,error:u,file:c,hideWhiteSpace:f=!1,headerActions:h,imageSrc:m,loading:o,loadFullFiles:x,onOpenImage:S,onSelectBreadcrumbPath:k,onDraftContentChange:N,onLspAction:E,onSave:_,renderMarkdown:I,saveError:G,saving:U=!1,splitView:B=!1,wordDiffs:j=!1,wordWrap:R,workspaceName:T,workspaceRootPath:M}){Ee(u,{prefix:"File preview"}),Ee(G,{prefix:"Save failed"});const A=n??c.content??"",Q=l.useMemo(()=>A.split(`
|
|
5
5
|
`).slice(0,800),[A]),q=rs(c.path),z=n!=null||c.content!=null,H=A.endsWith(Ji),re=I&&z&&ts(c.path),le=z&&Ca(c.path)&&cr(A);return m?e.jsxs("div",{className:"workspace-file-preview",children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:c.path,workspaceName:T,workspaceRootPath:M,onSelectPath:k}),e.jsxs("span",{className:"diff-addition",children:["+",c.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",c.deletions]})]}),h]}),e.jsx("div",{className:"workspace-file-image-stage",children:e.jsx("button",{type:"button",className:"workspace-file-image-button","aria-label":`Open image preview for ${c.path}`,onClick:S,children:e.jsx("img",{alt:c.path,decoding:"async",src:m})})})]}):!x&&c.patch||!z&&c.patch?B?e.jsx(rr,{collapsed:t,file:c,hideWhiteSpace:f,onSelectBreadcrumbPath:k,wordDiffs:j,wordWrap:R,headerActions:h,workspaceName:T,workspaceRootPath:M}):e.jsx(ir,{collapsed:t,file:c,hideWhiteSpace:f,wordWrap:R,workspaceName:T,workspaceRootPath:M,onSelectBreadcrumbPath:k,headerActions:h}):e.jsxs("div",{className:`workspace-file-preview ${R?"wrap":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:c.path,workspaceName:T,workspaceRootPath:M,onSelectPath:k}),e.jsxs("span",{className:"diff-addition",children:["+",c.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",c.deletions]})]}),e.jsxs("span",{className:"workspace-file-heading-end",children:[U?e.jsx("span",{className:"workspace-file-save-state",children:"Saving"}):null,h]})]}),z?re?e.jsx("div",{className:"workspace-markdown-preview",children:e.jsx(_a,{content:A})}):le?e.jsx(lr,{file:c,contentBase64:A}):a&&!H?e.jsx(l.Suspense,{fallback:e.jsx("div",{className:"workspace-diff-code-empty",children:"Loading editor"}),children:e.jsx(er,{diagnostics:s,filePath:c.path,onChange:Y=>N?.(Y),onLspAction:E,onSave:()=>_?.(),ref:i,value:A,wordWrap:R})}):e.jsx("div",{className:"workspace-file-code",children:Q.map((Y,J)=>e.jsxs("div",{className:"workspace-file-code-row",children:[e.jsx("span",{children:J+1}),e.jsx("code",{children:e.jsx(Nt,{language:q,text:Y||" "})})]},`${J}-${Y}`))}):e.jsx("div",{className:"workspace-diff-code-empty",children:o?"Loading file content":"No file content available."})]})}function ir({collapsed:t=!1,file:s,hideWhiteSpace:n=!1,wordWrap:a,workspaceName:i,workspaceRootPath:u,onSelectBreadcrumbPath:c,headerActions:f}){const h=l.useMemo(()=>pn(s.patch,n),[s.patch,n]),m=rs(s.path);return e.jsxs("div",{className:`workspace-diff-preview ${a?"wrap":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:s.path,workspaceName:i??null,workspaceRootPath:u,onSelectPath:c}),e.jsxs("span",{className:"diff-addition",children:["+",s.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",s.deletions]})]}),f]}),t?e.jsx("div",{className:"workspace-diff-code-empty",children:"Diff collapsed"}):e.jsx(fn,{ariaLabel:`${s.path} diff`,className:"workspace-diff-code",emptyMessage:"No patch available.",rows:h,renderRow:(o,x)=>o.kind==="spacer"?e.jsx("div",{className:"workspace-diff-spacer",role:"row",children:o.label},`${o.label}-${x}`):e.jsxs("div",{className:`workspace-diff-code-row ${o.kind}`,role:"row",children:[e.jsx("span",{className:"workspace-diff-line-number",role:"cell",children:o.newLine||o.oldLine}),e.jsx("code",{role:"cell",children:e.jsx(Nt,{language:m,text:o.newContent||o.oldContent||" "})})]},`${o.oldLine}-${o.newLine}-${x}`),wordWrap:a})]})}function rr({collapsed:t,file:s,hideWhiteSpace:n,wordDiffs:a,wordWrap:i,workspaceName:u,workspaceRootPath:c,onSelectBreadcrumbPath:f,headerActions:h}){const m=l.useMemo(()=>pn(s.patch,n),[s.patch,n]),o=rs(s.path);return e.jsxs("div",{className:`workspace-diff-preview split ${i?"wrap":""} ${a?"word-diffs":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:s.path,workspaceName:u,workspaceRootPath:c,onSelectPath:f}),e.jsxs("span",{className:"diff-addition",children:["+",s.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",s.deletions]})]}),e.jsxs("span",{className:"workspace-file-heading-end",children:[h,e.jsx(Ya,{size:14})]})]}),t?e.jsx("div",{className:"workspace-diff-code-empty",children:"Diff collapsed"}):e.jsx(fn,{ariaLabel:`${s.path} split diff`,className:"workspace-split-code",emptyMessage:"No patch available.",rows:m,renderRow:(x,S)=>x.kind==="spacer"?e.jsx("div",{className:"workspace-diff-spacer split",role:"row",children:x.label},`${x.label}-${S}`):e.jsxs("div",{className:`workspace-split-row ${x.kind}`,role:"row",children:[e.jsx("span",{className:"workspace-diff-line-number old",role:"cell",children:x.oldLine}),e.jsx("code",{className:"old",role:"cell",children:e.jsx(Nt,{language:o,text:x.oldContent||" "})}),e.jsx("span",{className:"workspace-diff-line-number new",role:"cell",children:x.newLine}),e.jsx("code",{className:"new",role:"cell",children:e.jsx(Nt,{language:o,text:x.newContent||" "})})]},`${x.oldLine}-${x.newLine}-${S}`),wordWrap:i})]})}function lr({file:t,contentBase64:s}){const n=l.useMemo(()=>{const a=dr(s);if(!a)return null;const i=new Blob([new Uint8Array(a)],{type:or(t.path)});return URL.createObjectURL(i)},[s,t.path]);return l.useEffect(()=>()=>{n&&URL.revokeObjectURL(n)},[n]),n?e.jsxs("div",{className:"workspace-document-preview",children:[e.jsxs("div",{className:"workspace-document-preview-card",children:[e.jsx("strong",{children:t.path.split("/").pop()}),e.jsx("span",{children:/\.pdf$/i.test(t.path)?"PDF document":"Word document"}),e.jsx("a",{href:n,download:t.path.split("/").pop()||"document",children:"Download document"})]}),e.jsx("iframe",{src:n,title:`${t.path} preview`})]}):e.jsx("div",{className:"workspace-diff-code-empty",children:"Document preview unavailable."})}function or(t){return/\.pdf$/i.test(t)?"application/pdf":/\.docx$/i.test(t)?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"application/msword"}function cr(t){return t.length>0&&/^[A-Za-z0-9+/=\s]+$/.test(t)}function dr(t){try{const s=atob(t.replace(/\s/g,"")),n=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)n[a]=s.charCodeAt(a);return n}catch{return null}}function fn({ariaLabel:t,className:s,emptyMessage:n,rows:a,renderRow:i,wordWrap:u}){const c=!u&&a.length>sr,{endIndex:f,offsetTop:h,scrollRef:m,startIndex:o,totalHeight:x}=ur(a.length,c);return a.length===0?e.jsx("div",{className:s,role:"table","aria-label":t,children:e.jsx("div",{className:"workspace-diff-code-empty",children:n})}):c?e.jsx("div",{className:`${s} virtualized`,ref:m,role:"table","aria-label":t,"aria-rowcount":a.length,children:e.jsx("div",{className:"workspace-diff-virtual-spacer",style:{height:x},children:e.jsx("div",{className:"workspace-diff-virtual-window",style:{transform:`translateY(${h}px)`},children:a.slice(o,f).map((S,k)=>i(S,o+k))})})}):e.jsx("div",{className:s,role:"table","aria-label":t,children:a.map(i)})}function ur(t,s){const n=l.useRef(null),[a,i]=l.useState({height:$e*Qs,scrollTop:0}),u=l.useCallback(()=>{const m=n.current;m&&i({height:m.clientHeight||$e*Qs,scrollTop:m.scrollTop})},[]);if(l.useEffect(()=>{if(!s)return;const m=n.current;if(!m)return;u();let o=0;const x=()=>{if(typeof window>"u"){u();return}window.cancelAnimationFrame(o),o=window.requestAnimationFrame(u)};m.addEventListener("scroll",x,{passive:!0});const S=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>x());return S?.observe(m),()=>{m.removeEventListener("scroll",x),S?.disconnect(),typeof window<"u"&&window.cancelAnimationFrame(o)}},[s,u]),!s)return{endIndex:t,offsetTop:0,scrollRef:n,startIndex:0,totalHeight:t*$e};const c=Math.ceil(a.height/$e),f=Math.max(0,Math.floor(a.scrollTop/$e)-Ys);return{endIndex:Math.min(t,f+c+Ys*2),offsetTop:f*$e,scrollRef:n,startIndex:f,totalHeight:t*$e}}function pn(t,s){if(!t.trim())return[];const n=[];let a=0,i=0,u=null,c=null,f=!1,h=[];function m(){n.push(...fr(h)),h=[]}function o(){f&&(m(),u=a,c=i,f=!1)}for(const x of t.split(`
|
|
6
6
|
`)){const S=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(x);if(S){o();const E=Number(S[1]),_=Number(S[2]);if(u!==null&&c!==null){const I=Math.max(E-u,_-c,0);I>0&&n.push({kind:"spacer",label:hn(I)})}a=E,i=_,f=!0;continue}if(x.startsWith("diff --git")||x.startsWith("index ")||x.startsWith("--- ")||x.startsWith("+++ ")||!f||x.startsWith("\\ No newline"))continue;const k=x.slice(1)||" ";if(s&&!k.trim())continue;if(x.startsWith("+")){m(),n.push({kind:"addition",oldLine:"",newLine:String(i||""),oldContent:"",newContent:k}),i+=1;continue}if(x.startsWith("-")){m(),n.push({kind:"deletion",oldLine:String(a||""),newLine:"",oldContent:k,newContent:""}),a+=1;continue}const N=x.startsWith(" ")?x.slice(1)||" ":x||" ";s&&!N.trim()||(h.push({kind:"context",oldLine:String(a||""),newLine:String(i||""),oldContent:N,newContent:N}),a+=1,i+=1)}return o(),n}function fr(t){if(t.length<tr)return t;const s=t.length-Jt*2;return s<=0?t:[...t.slice(0,Jt),{kind:"spacer",label:hn(s)},...t.slice(-Jt)]}function hn(t){return`${t} unmodified ${t===1?"line":"lines"}`}const Rt=`
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as m,j as t}from"./index-B5RqBp_p.js";import{c as ut,bd as Ye,be as Mt,bf as Ut,X as mt,bg as Ae,aK as Lt,bh as Ne,aV as Ot,I as Ft,a$ as at,E as Bt,bi as Dt,aP as Gt,aB as Tt,bj as kt,bk as st,v as O,aJ as Vt,ba as Ht,S as Xt,bc as Je,C as Jt,aq as Kt,h as Qt}from"./App-kwt-UxX_.js";import{I as Zt}from"./info-BWvLCbJ2.js";import{P as $e}from"./play-DsP3gpGK.js";import{G as Yt}from"./git-commit-horizontal-BifoV1dR.js";import{R as Ke}from"./refresh-cw-DaASy_i0.js";import{S as Wt}from"./square-DTl9YrMp.js";import{U as rt}from"./upload-juEp2zRQ.js";const en=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],tn=ut("hammer",en);const nn=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],an=ut("monitor",nn);function sn(e){const n=te(e?.data),a=te(n.preview);return(typeof a.url=="string"?a.url.trim():"")||null}function rn(){const e=window.open("","_blank");return e?(e.document.write('<!doctype html><title>Opening sandbox preview</title><body style="margin:0;background:#05070a;color:#f5f5f4;font:14px system-ui,sans-serif;display:grid;place-items:center;height:100vh;">Opening sandbox preview...</body>'),e.document.close(),e):null}function ye(e,n){if(!n){e?.close();return}if(e){e.opener=null,e.location.href=n;return}window.open(n,"_blank","noopener,noreferrer")}function pt(e){const n=ln(e),a=on(te(e?.resources)),i=te(te(e?.inputs).schema),g=te(i.properties),u=new Set(ft(i.required)),l=[],x=[];for(const[p,N]of Object.entries(g)){const c=te(N),U=te(c["x-openpond-upload"]??c.xOpenPondUpload),I=typeof c.type=="string"?c.type:"string",V=te(c.items),z=gn(c,U),v=c.format==="file"||U.enabled===!0||I==="array"&&V.format==="file",q=typeof c.title=="string"&&c.title.trim()?c.title.trim():hn(p);if(v){x.push({name:p,label:q,required:u.has(p),multiple:I==="array"||U.multiple===!0,accept:bn(U,c),targetPath:fn(U,p),targetNames:z});continue}(I==="string"||I==="number"||I==="integer"||I==="boolean")&&l.push({name:p,label:q,required:u.has(p),type:I,defaultValue:typeof c.default=="string"||typeof c.default=="number"||typeof c.default=="boolean"?String(c.default):"",targetNames:z})}return{entrypoints:n,scalarInputs:l,fileInputs:x,envInputs:dn(e),resources:a,volumes:cn(e,x),schedules:un(e)}}function Fe(e,n){const a=n.trim();return e.filter(i=>!i.targetNames||i.targetNames.length===0?!0:i.targetNames.includes(a))}function ln(e){return e?Ye(e).flatMap(n=>{if(n.kind==="action")return[];const a=n.name.trim(),i=n.command.trim(),g=Be(n.timeoutSeconds),u=n.ports.flatMap(l=>{const x=Be(l.port);return x?[{port:x,label:typeof l.label=="string"&&l.label.trim()?l.label.trim():"web",access:l.access==="public"?"public":"private",path:typeof l.path=="string"&&l.path.trim()?l.path.trim():"/"}]:[]});return a&&i?[{name:a,command:i,timeoutSeconds:g,ports:u}]:[]}):[]}function on(e){return{cpu:Qe(e.cpu)??1,memoryGb:Qe(e.memoryGb)??1,diskGb:Qe(e.diskGb)??8}}function cn(e,n){const a=Array.isArray(e?.volumes)?e.volumes:[];if(a.length>0)return a.map((u,l)=>{const x=l===0?"volume":`volume-${l+1}`,p=typeof u.name=="string"&&u.name.trim()?u.name.trim():x;return{name:p,mountPath:typeof u.mountPath=="string"&&u.mountPath.trim()?u.mountPath.trim():`/workspace/volumes/${p}`,...Be(u.storageGb)?{storageGb:Be(u.storageGb)??void 0}:{},deleteOnSandboxDelete:u.deleteOnSandboxDelete===!0}});const i=n.find(u=>u.targetPath.startsWith("volumes/"));if(!i)return[];const[,g="volume"]=i.targetPath.split("/");return[{name:g,mountPath:`/workspace/volumes/${g}`,storageGb:8,deleteOnSandboxDelete:!1}]}function dn(e){return(Array.isArray(e?.inputs.env)?e.inputs.env:[]).flatMap(a=>{const i=typeof a.name=="string"?a.name.trim():"";return i?[{name:i,required:a.required===!0,secret:a.secret!==!1,description:typeof a.description=="string"?a.description.trim():""}]:[]})}function un(e){return e?.schedules?.length?e.schedules.flatMap(n=>{const a=typeof n.name=="string"?n.name.trim():"",i=mn(n);if(!a||!i.scheduleExpression)return[];try{return[{name:a,...typeof n.description=="string"&&n.description.trim()?{description:n.description.trim()}:{},enabled:!1,...i,...typeof n.timezone=="string"&&n.timezone.trim()?{timezone:n.timezone.trim()}:{},...typeof n.startAt=="string"&&n.startAt.trim()?{startAt:n.startAt.trim()}:{},...typeof n.endAt=="string"&&n.endAt.trim()?{endAt:n.endAt.trim()}:{},...typeof n.maxRuns=="number"&&Number.isInteger(n.maxRuns)&&n.maxRuns>0?{maxRuns:n.maxRuns}:{},runtimePolicy:n.runtimePolicy,target:pn(e,n),...n.budget?{budget:n.budget}:{},...n.resources?{resources:n.resources}:{},...n.quotas?{quotas:n.quotas}:{},...n.lifecycle?{lifecycle:n.lifecycle}:{},...n.retentionPolicy?{retentionPolicy:n.retentionPolicy}:{},...n.env?{env:n.env}:{},...n.integrationLeases?{integrationLeases:n.integrationLeases}:{},metadata:{...te(n.metadata),manifestScheduleName:a,source:"openpond-app-sandbox-template-start"}}]}catch{return[]}}):[]}function mn(e){return e.scheduleExpression?{scheduleType:e.scheduleType??"cron",scheduleExpression:e.scheduleExpression}:e.rate?{scheduleType:"rate",scheduleExpression:/^rate\(/i.test(e.rate)?e.rate:`rate(${e.rate})`}:e.once?{scheduleType:"once",scheduleExpression:/^at\(/i.test(e.once)?e.once:`at(${e.once})`}:{scheduleType:"cron",scheduleExpression:e.cron??""}}function pn(e,n){const a=n.command??n.target?.command??null;if(a)return{kind:"command",command:a,requiresStart:n.requiresStart??n.target?.requiresStart??!1};const i=n.target?.kind??"action";if(i==="start")return{kind:"command",command:e.start.command,requiresStart:n.requiresStart??n.target?.requiresStart??e.start.requiresStart??!1};if(i==="service"){const l=n.target?.name??"",x=e.services.find(p=>p.name===l);if(!x)throw new Error("schedule_service_target_missing");return{kind:"command",command:x.command,requiresStart:n.requiresStart??n.target?.requiresStart??x.requiresStart??!1}}const g=n.actionName??n.action??n.target?.actionName??(n.target?.kind==="action"?n.target?.name:void 0),u=e.actions.find(l=>l.name===g);if(!u)throw new Error("schedule_action_target_missing");return{kind:"command",command:u.command,requiresStart:n.requiresStart??n.target?.requiresStart??u.requiresStart??!1}}function gt(e,n){return e.flatMap(a=>{const i=(n[a.name]??"").trim();return i?[{name:a.name,secretRef:i}]:[]})}function bt(e,n){const a={};for(const i of e){const g=n[i.name]??"";if(!(!g.trim()&&!i.required))if(i.type==="boolean")a[i.name]=g==="true";else if(i.type==="number"||i.type==="integer"){const u=Number(g);Number.isFinite(u)&&(a[i.name]=i.type==="integer"?Math.trunc(u):u)}else a[i.name]=g}return a}function gn(e,n){const a=e["x-openpond-targets"]??e.xOpenPondTargets??n.targets??n.actions,i=ft(a).map(g=>g.trim()).filter(Boolean);return i.length>0?[...new Set(i)]:null}function bn(e,n){return typeof e.accept=="string"?e.accept.trim():Array.isArray(e.accept)?e.accept.filter(a=>typeof a=="string").join(","):typeof n.accept=="string"?n.accept.trim():""}function fn(e,n){return(typeof e.targetPath=="string"&&e.targetPath.trim()?e.targetPath.trim():typeof e.path=="string"&&e.path.trim()?e.path.trim():`uploads/${n}`).replace(/^\/+/,"").replace(/^workspace\//,"").replace(/\/+$/,"")}function Qe(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:null}function Be(e){const n=Number(e);return Number.isInteger(n)&&n>0?n:null}function xn(e,n){return[n,...e.slice(1)]}function ft(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}function hn(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function te(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function jn({busy:e,defaultRepoUrl:n,projectName:a,commitBeforeCreate:i,templateManifest:g,uploadBeforeCreate:u,onClose:l,onSubmit:x}){const p=m.useMemo(()=>pt(g),[g]),N=p.entrypoints[0]??null,[c,U]=m.useState(n),[I,V]=m.useState(N?.name??""),[z,v]=m.useState(N?.command??""),[q,H]=m.useState(N?.timeoutSeconds?String(N.timeoutSeconds):""),[X,b]=m.useState(`Update ${a}`),[j,A]=m.useState("0.05"),[_,F]=m.useState(()=>Object.fromEntries(p.scalarInputs.map(r=>[r.name,r.defaultValue]))),[B,ae]=m.useState(()=>Object.fromEntries(p.envInputs.map(r=>[r.name,""]))),[Z,fe]=m.useState({}),K=p.volumes[0]??null,[Y,o]=m.useState(p.volumes.length>0||p.fileInputs.length>0),[P,w]=m.useState(K?.name??"volume"),[R,$]=m.useState(K?.mountPath??"/workspace/volumes/volume"),[J,ce]=m.useState(String(K?.storageGb??8)),[Pe,de]=m.useState(!(K?.deleteOnSandboxDelete??!1)),[M,ze]=m.useState(p.schedules),qe=p.entrypoints.find(r=>r.name===I)??N,se=qe?.ports??[],re=se[0]??null,[ue,xe]=m.useState(!!re),[Ce,me]=m.useState(re?String(re.port):""),D=Number(Ce),he=Number(j),ie=Number(J),le=Number(q),ke=!q.trim()||Number.isInteger(le)&&le>0&&le<=86400,oe=!ue||Number.isInteger(D)&&D>=Mt&&D<=Ut&&se.some(r=>r.port===D),Ie=Number.isFinite(he)&&he>0,ne=!Y||Number.isInteger(ie)&&ie>0,G=M.every(r=>!r.enabled||!!r.scheduleExpression.trim()),W=Fe(p.scalarInputs,I),je=Fe(p.fileInputs,I),Me=p.envInputs.every(r=>!r.required||!!(B[r.name]??"").trim()),ve=p.envInputs.filter(r=>r.required&&!(B[r.name]??"").trim()),Re=(u||!!c.trim())&&!!z.trim()&&Ie&&ke&&ne&&W.every(r=>!r.required||!!(_[r.name]??"").trim())&&je.every(r=>!r.required||(Z[r.name]?.length??0)>0)&&Me&&G&&oe;function Ve(r){V(r);const f=p.entrypoints.find(E=>E.name===r);if(!f)return;v(f.command),H(f.timeoutSeconds?String(f.timeoutSeconds):"");const y=f.ports[0]??null;me(y?String(y.port):""),xe(!!y)}function _e(r,f){F(y=>({...y,[r]:f}))}function pe(r,f){ae(y=>({...y,[r]:f}))}function He(r,f){const y=Array.from(f.target.files??[]);fe(E=>({...E,[r.name]:r.multiple?y:y.slice(0,1)}))}function ee(r,f){ze(y=>y.map((E,ge)=>ge===r?{...E,...f}:E))}function Ee(r){r.preventDefault(),!(!Re||e)&&x({repoUrl:c.trim(),command:z.trim(),entrypointName:I,commitMessage:X.trim(),budgetUsd:j.trim(),params:bt(W,_),env:gt(p.envInputs,B),timeoutSeconds:q.trim()&&Number.isInteger(le)?le:qe?.timeoutSeconds??null,uploads:je.flatMap(f=>{const y=Z[f.name]??[];return y.length>0?[{inputName:f.name,label:f.label,targetPath:f.targetPath,multiple:f.multiple,files:y}]:[]}),resources:p.resources,volumes:Y?xn(p.volumes,{...P.trim()?{name:P.trim()}:{},...R.trim()?{mountPath:R.trim()}:{},...Number.isInteger(ie)&&ie>0?{storageGb:ie}:{},deleteOnSandboxDelete:!Pe}):[],schedules:M.filter(f=>f.enabled),openPreview:ue,previewPort:ue?D:null,previewLabel:se.find(f=>f.port===D)?.label??"web",previewAccess:se.find(f=>f.port===D)?.access??"private"})}return t.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:t.jsxs("form",{className:"git-dialog run-once-dialog sandbox-start-dialog",role:"dialog","aria-modal":"true","aria-label":"Start sandbox",onSubmit:Ee,children:[t.jsx("button",{className:"git-dialog-close",disabled:e,type:"button",title:"Close","aria-label":"Close",onClick:l,children:t.jsx(mt,{size:15})}),t.jsxs("div",{className:"sandbox-start-dialog-heading",children:[t.jsx("div",{className:"git-dialog-icon",children:t.jsx(Ae,{size:18})}),t.jsx("h2",{children:"Start sandbox"}),t.jsxs("div",{className:"git-dialog-row",children:[t.jsx("span",{children:"Project"}),t.jsx("strong",{children:a})]})]}),t.jsxs("div",{className:"sandbox-start-dialog-body",children:[u?null:t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Repository"}),t.jsx("input",{disabled:e,value:c,onChange:r=>U(r.target.value)})]}),i?t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Commit message"}),t.jsx("input",{disabled:e,value:X,onChange:r=>b(r.target.value)})]}):null,p.entrypoints.length>0?t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Run target"}),t.jsx("select",{disabled:e,value:I,onChange:r=>Ve(r.target.value),children:p.entrypoints.map(r=>t.jsx("option",{value:r.name,children:r.name},r.name))})]}):null,t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Shell command"}),t.jsx("input",{disabled:e,value:z,onChange:r=>v(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Timeout seconds"}),t.jsx("input",{disabled:e,inputMode:"numeric",value:q,onChange:r=>H(r.target.value)})]}),W.map(r=>r.type==="boolean"?t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:(_[r.name]??"")==="true",disabled:e,type:"checkbox",onChange:f=>_e(r.name,f.target.checked?"true":"false")}),t.jsx("span",{}),r.label]},r.name):t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:r.label}),t.jsx("input",{disabled:e,inputMode:r.type==="number"||r.type==="integer"?"decimal":void 0,value:_[r.name]??"",onChange:f=>_e(r.name,f.target.value)})]},r.name)),je.map(r=>t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:r.label}),t.jsx("input",{accept:r.accept||void 0,disabled:e,multiple:r.multiple,type:"file",onChange:f=>He(r,f)})]},r.name)),p.envInputs.length>0?t.jsxs("div",{className:"sandbox-start-env-section",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Environment"}),ve.length>0?t.jsxs("p",{className:"sandbox-start-env-warning",role:"status",children:["Required sandbox secret ref missing: ",ve.map(r=>r.name).join(", ")]}):null,p.envInputs.map(r=>{const f=B[r.name]??"",y=r.required&&!f.trim(),E=`sandbox-env-${r.name}-description`;return t.jsxs("label",{className:"git-dialog-field",children:[t.jsxs("span",{children:[r.name,r.required?" *":""]}),t.jsx("input",{"aria-describedby":E,"aria-invalid":y,disabled:e,placeholder:"openpond://secret/...",value:f,onChange:ge=>pe(r.name,ge.target.value)}),t.jsx("small",{id:E,children:y?"Add a sandbox secret ref before starting.":r.description||"Sandbox secret ref only."})]},r.name)})]}):null,je.length>0||p.volumes.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:Y,disabled:e,type:"checkbox",onChange:r=>o(r.target.checked)}),t.jsx("span",{}),"Mount volume"]}),Y?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"run-once-dialog-grid",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Volume"}),t.jsx("input",{disabled:e,value:P,onChange:r=>w(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Storage GiB"}),t.jsx("input",{disabled:e,inputMode:"numeric",value:J,onChange:r=>ce(r.target.value)})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Mount path"}),t.jsx("input",{disabled:e,value:R,onChange:r=>$(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:Pe,disabled:e,type:"checkbox",onChange:r=>de(r.target.checked)}),t.jsx("span",{}),"Keep volume"]})]}):null]}):null,M.length>0?t.jsxs("div",{className:"sandbox-start-schedules",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Schedules"}),M.map((r,f)=>t.jsxs("div",{className:"sandbox-start-schedule-row",children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:r.enabled,disabled:e,type:"checkbox",onChange:y=>ee(f,{enabled:y.target.checked})}),t.jsx("span",{}),r.name]}),t.jsxs("div",{className:"run-once-dialog-grid",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Type"}),t.jsxs("select",{disabled:e||!r.enabled,value:r.scheduleType,onChange:y=>ee(f,{scheduleType:y.target.value}),children:[t.jsx("option",{value:"rate",children:"Rate"}),t.jsx("option",{value:"cron",children:"Cron"}),t.jsx("option",{value:"once",children:"Once"})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Max runs"}),t.jsx("input",{disabled:e||!r.enabled,inputMode:"numeric",value:r.maxRuns??"",onChange:y=>{const E=Number(y.target.value);ee(f,{maxRuns:Number.isInteger(E)&&E>0?E:null})}})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Expression"}),t.jsx("input",{disabled:e||!r.enabled,value:r.scheduleExpression,onChange:y=>ee(f,{scheduleExpression:y.target.value})})]})]},r.name))]}):null,t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Budget"}),t.jsx("input",{disabled:e,inputMode:"decimal",value:j,onChange:r=>A(r.target.value)})]}),se.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:ue,disabled:e,type:"checkbox",onChange:r=>xe(r.target.checked)}),t.jsx("span",{}),"Open preview"]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Preview port"}),t.jsx("select",{disabled:e||!ue,value:Ce,onChange:r=>me(r.target.value),children:se.map(r=>t.jsx("option",{value:r.port,children:r.label?`${r.label} (${r.port})`:r.port},r.port))})]})]}):null]}),t.jsxs("div",{className:"git-dialog-footer sandbox-start-dialog-footer",children:[t.jsx("button",{className:"git-dialog-secondary",disabled:e,type:"button",onClick:l,children:"Cancel"}),t.jsxs("button",{className:"git-dialog-primary",disabled:e||!Re,title:Me?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx(Lt,{size:14}),"Start"]})]})]})})}function vn({busy:e,projectName:n,templateManifest:a,onClose:i,onSubmit:g}){const u=m.useMemo(()=>pt(a),[a]),l=m.useMemo(()=>a?Ye(a).filter(o=>o.kind==="action"):[],[a]),x=l[0]??null,[p,N]=m.useState("sandbox"),[c,U]=m.useState(x?.name??""),[I,V]=m.useState(()=>Object.fromEntries(u.scalarInputs.map(o=>[o.name,o.defaultValue]))),[z,v]=m.useState(()=>Object.fromEntries(u.envInputs.map(o=>[o.name,""]))),[q,H]=m.useState({}),X=Fe(u.scalarInputs,c),b=Fe(u.fileInputs,c),j=p==="sandbox"?u.envInputs:[],A=X.every(o=>!o.required||!!(I[o.name]??"").trim()),_=b.every(o=>!o.required||(q[o.name]?.length??0)>0),F=j.every(o=>!o.required||!!(z[o.name]??"").trim()),B=j.filter(o=>o.required&&!(z[o.name]??"").trim()),ae=!!c&&A&&_&&F;function Z(o,P){V(w=>({...w,[o]:P}))}function fe(o,P){v(w=>({...w,[o]:P}))}function K(o,P,w){const R=Array.from(w.target.files??[]);H($=>({...$,[o]:P?R:R.slice(0,1)}))}function Y(o){o.preventDefault(),!(!ae||e)&&g({mode:p,target:c,params:bt(X,I),env:p==="sandbox"?gt(j,z):[],uploads:b.flatMap(P=>{const w=q[P.name]??[];return w.length>0?[{inputName:P.name,label:P.label,targetPath:P.targetPath,multiple:P.multiple,files:w}]:[]})})}return t.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:t.jsxs("form",{className:"git-dialog run-once-dialog sandbox-start-dialog",role:"dialog","aria-modal":"true","aria-label":"Run sandbox action",onSubmit:Y,children:[t.jsx("button",{className:"git-dialog-close",disabled:e,type:"button",title:"Close","aria-label":"Close",onClick:i,children:t.jsx(mt,{size:15})}),t.jsxs("div",{className:"sandbox-start-dialog-heading",children:[t.jsx("div",{className:"git-dialog-icon",children:t.jsx($e,{size:18})}),t.jsx("h2",{children:"Run action"}),t.jsxs("div",{className:"git-dialog-row",children:[t.jsx("span",{children:"Project"}),t.jsx("strong",{children:n})]})]}),t.jsxs("div",{className:"sandbox-start-dialog-body",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Action"}),t.jsx("select",{disabled:e||l.length===0,value:c,onChange:o=>U(o.target.value),children:l.map(o=>t.jsx("option",{value:o.name,children:o.name},o.name))})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Run on"}),t.jsxs("select",{disabled:e,value:p,onChange:o=>N(o.target.value==="local"?"local":"sandbox"),children:[t.jsx("option",{value:"sandbox",children:"Hosted sandbox (start/update)"}),t.jsx("option",{value:"local",children:"Local machine"})]})]}),X.map(o=>o.type==="boolean"?t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:(I[o.name]??"")==="true",disabled:e,type:"checkbox",onChange:P=>Z(o.name,P.target.checked?"true":"false")}),t.jsx("span",{}),o.label]},o.name):t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:o.label}),t.jsx("input",{disabled:e,inputMode:o.type==="number"||o.type==="integer"?"decimal":void 0,value:I[o.name]??"",onChange:P=>Z(o.name,P.target.value)})]},o.name)),b.map(o=>t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:o.label}),t.jsx("input",{accept:o.accept||void 0,disabled:e,multiple:o.multiple,type:"file",onChange:P=>K(o.name,o.multiple,P)})]},o.name)),j.length>0?t.jsxs("div",{className:"sandbox-start-env-section",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Environment"}),B.length>0?t.jsxs("p",{className:"sandbox-start-env-warning",role:"status",children:["Required sandbox secret ref missing: ",B.map(o=>o.name).join(", ")]}):null,j.map(o=>{const P=z[o.name]??"",w=o.required&&!P.trim(),R=`sandbox-action-env-${o.name}-description`;return t.jsxs("label",{className:"git-dialog-field",children:[t.jsxs("span",{children:[o.name,o.required?" *":""]}),t.jsx("input",{"aria-describedby":R,"aria-invalid":w,disabled:e,placeholder:"openpond://secret/...",value:P,onChange:$=>fe(o.name,$.target.value)}),t.jsx("small",{id:R,children:w?"Add a sandbox secret ref before running.":o.description||"Sandbox secret ref only."})]},o.name)})]}):null]}),t.jsxs("div",{className:"git-dialog-footer sandbox-start-dialog-footer",children:[t.jsx("button",{className:"git-dialog-secondary",disabled:e,type:"button",onClick:i,children:"Cancel"}),t.jsxs("button",{className:"git-dialog-primary",disabled:e||!ae,title:F?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx($e,{size:14}),"Run"]})]})]})})}function xt(e,n){const a=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"agent";return n==="cron"?`name: ${a}
|
|
1
|
+
import{r as m,j as t}from"./index-De4k_YMo.js";import{c as ut,bd as Ye,be as Mt,bf as Ut,X as mt,bg as Ae,aK as Lt,bh as Ne,aV as Ot,I as Ft,a$ as at,E as Bt,bi as Dt,aP as Gt,aB as Tt,bj as kt,bk as st,v as O,aJ as Vt,ba as Ht,S as Xt,bc as Je,C as Jt,aq as Kt,h as Qt}from"./App-DQfdLgyV.js";import{I as Zt}from"./info-B-n_omgE.js";import{P as $e}from"./play-B5O4Hz_W.js";import{G as Yt}from"./git-commit-horizontal-C0QdA7uv.js";import{R as Ke}from"./refresh-cw-D2E-pp4H.js";import{S as Wt}from"./square-DUgXVoF0.js";import{U as rt}from"./upload-t7xHt3GY.js";const en=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],tn=ut("hammer",en);const nn=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],an=ut("monitor",nn);function sn(e){const n=te(e?.data),a=te(n.preview);return(typeof a.url=="string"?a.url.trim():"")||null}function rn(){const e=window.open("","_blank");return e?(e.document.write('<!doctype html><title>Opening sandbox preview</title><body style="margin:0;background:#05070a;color:#f5f5f4;font:14px system-ui,sans-serif;display:grid;place-items:center;height:100vh;">Opening sandbox preview...</body>'),e.document.close(),e):null}function ye(e,n){if(!n){e?.close();return}if(e){e.opener=null,e.location.href=n;return}window.open(n,"_blank","noopener,noreferrer")}function pt(e){const n=ln(e),a=on(te(e?.resources)),i=te(te(e?.inputs).schema),g=te(i.properties),u=new Set(ft(i.required)),l=[],x=[];for(const[p,N]of Object.entries(g)){const c=te(N),U=te(c["x-openpond-upload"]??c.xOpenPondUpload),I=typeof c.type=="string"?c.type:"string",V=te(c.items),z=gn(c,U),v=c.format==="file"||U.enabled===!0||I==="array"&&V.format==="file",q=typeof c.title=="string"&&c.title.trim()?c.title.trim():hn(p);if(v){x.push({name:p,label:q,required:u.has(p),multiple:I==="array"||U.multiple===!0,accept:bn(U,c),targetPath:fn(U,p),targetNames:z});continue}(I==="string"||I==="number"||I==="integer"||I==="boolean")&&l.push({name:p,label:q,required:u.has(p),type:I,defaultValue:typeof c.default=="string"||typeof c.default=="number"||typeof c.default=="boolean"?String(c.default):"",targetNames:z})}return{entrypoints:n,scalarInputs:l,fileInputs:x,envInputs:dn(e),resources:a,volumes:cn(e,x),schedules:un(e)}}function Fe(e,n){const a=n.trim();return e.filter(i=>!i.targetNames||i.targetNames.length===0?!0:i.targetNames.includes(a))}function ln(e){return e?Ye(e).flatMap(n=>{if(n.kind==="action")return[];const a=n.name.trim(),i=n.command.trim(),g=Be(n.timeoutSeconds),u=n.ports.flatMap(l=>{const x=Be(l.port);return x?[{port:x,label:typeof l.label=="string"&&l.label.trim()?l.label.trim():"web",access:l.access==="public"?"public":"private",path:typeof l.path=="string"&&l.path.trim()?l.path.trim():"/"}]:[]});return a&&i?[{name:a,command:i,timeoutSeconds:g,ports:u}]:[]}):[]}function on(e){return{cpu:Qe(e.cpu)??1,memoryGb:Qe(e.memoryGb)??1,diskGb:Qe(e.diskGb)??8}}function cn(e,n){const a=Array.isArray(e?.volumes)?e.volumes:[];if(a.length>0)return a.map((u,l)=>{const x=l===0?"volume":`volume-${l+1}`,p=typeof u.name=="string"&&u.name.trim()?u.name.trim():x;return{name:p,mountPath:typeof u.mountPath=="string"&&u.mountPath.trim()?u.mountPath.trim():`/workspace/volumes/${p}`,...Be(u.storageGb)?{storageGb:Be(u.storageGb)??void 0}:{},deleteOnSandboxDelete:u.deleteOnSandboxDelete===!0}});const i=n.find(u=>u.targetPath.startsWith("volumes/"));if(!i)return[];const[,g="volume"]=i.targetPath.split("/");return[{name:g,mountPath:`/workspace/volumes/${g}`,storageGb:8,deleteOnSandboxDelete:!1}]}function dn(e){return(Array.isArray(e?.inputs.env)?e.inputs.env:[]).flatMap(a=>{const i=typeof a.name=="string"?a.name.trim():"";return i?[{name:i,required:a.required===!0,secret:a.secret!==!1,description:typeof a.description=="string"?a.description.trim():""}]:[]})}function un(e){return e?.schedules?.length?e.schedules.flatMap(n=>{const a=typeof n.name=="string"?n.name.trim():"",i=mn(n);if(!a||!i.scheduleExpression)return[];try{return[{name:a,...typeof n.description=="string"&&n.description.trim()?{description:n.description.trim()}:{},enabled:!1,...i,...typeof n.timezone=="string"&&n.timezone.trim()?{timezone:n.timezone.trim()}:{},...typeof n.startAt=="string"&&n.startAt.trim()?{startAt:n.startAt.trim()}:{},...typeof n.endAt=="string"&&n.endAt.trim()?{endAt:n.endAt.trim()}:{},...typeof n.maxRuns=="number"&&Number.isInteger(n.maxRuns)&&n.maxRuns>0?{maxRuns:n.maxRuns}:{},runtimePolicy:n.runtimePolicy,target:pn(e,n),...n.budget?{budget:n.budget}:{},...n.resources?{resources:n.resources}:{},...n.quotas?{quotas:n.quotas}:{},...n.lifecycle?{lifecycle:n.lifecycle}:{},...n.retentionPolicy?{retentionPolicy:n.retentionPolicy}:{},...n.env?{env:n.env}:{},...n.integrationLeases?{integrationLeases:n.integrationLeases}:{},metadata:{...te(n.metadata),manifestScheduleName:a,source:"openpond-app-sandbox-template-start"}}]}catch{return[]}}):[]}function mn(e){return e.scheduleExpression?{scheduleType:e.scheduleType??"cron",scheduleExpression:e.scheduleExpression}:e.rate?{scheduleType:"rate",scheduleExpression:/^rate\(/i.test(e.rate)?e.rate:`rate(${e.rate})`}:e.once?{scheduleType:"once",scheduleExpression:/^at\(/i.test(e.once)?e.once:`at(${e.once})`}:{scheduleType:"cron",scheduleExpression:e.cron??""}}function pn(e,n){const a=n.command??n.target?.command??null;if(a)return{kind:"command",command:a,requiresStart:n.requiresStart??n.target?.requiresStart??!1};const i=n.target?.kind??"action";if(i==="start")return{kind:"command",command:e.start.command,requiresStart:n.requiresStart??n.target?.requiresStart??e.start.requiresStart??!1};if(i==="service"){const l=n.target?.name??"",x=e.services.find(p=>p.name===l);if(!x)throw new Error("schedule_service_target_missing");return{kind:"command",command:x.command,requiresStart:n.requiresStart??n.target?.requiresStart??x.requiresStart??!1}}const g=n.actionName??n.action??n.target?.actionName??(n.target?.kind==="action"?n.target?.name:void 0),u=e.actions.find(l=>l.name===g);if(!u)throw new Error("schedule_action_target_missing");return{kind:"command",command:u.command,requiresStart:n.requiresStart??n.target?.requiresStart??u.requiresStart??!1}}function gt(e,n){return e.flatMap(a=>{const i=(n[a.name]??"").trim();return i?[{name:a.name,secretRef:i}]:[]})}function bt(e,n){const a={};for(const i of e){const g=n[i.name]??"";if(!(!g.trim()&&!i.required))if(i.type==="boolean")a[i.name]=g==="true";else if(i.type==="number"||i.type==="integer"){const u=Number(g);Number.isFinite(u)&&(a[i.name]=i.type==="integer"?Math.trunc(u):u)}else a[i.name]=g}return a}function gn(e,n){const a=e["x-openpond-targets"]??e.xOpenPondTargets??n.targets??n.actions,i=ft(a).map(g=>g.trim()).filter(Boolean);return i.length>0?[...new Set(i)]:null}function bn(e,n){return typeof e.accept=="string"?e.accept.trim():Array.isArray(e.accept)?e.accept.filter(a=>typeof a=="string").join(","):typeof n.accept=="string"?n.accept.trim():""}function fn(e,n){return(typeof e.targetPath=="string"&&e.targetPath.trim()?e.targetPath.trim():typeof e.path=="string"&&e.path.trim()?e.path.trim():`uploads/${n}`).replace(/^\/+/,"").replace(/^workspace\//,"").replace(/\/+$/,"")}function Qe(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:null}function Be(e){const n=Number(e);return Number.isInteger(n)&&n>0?n:null}function xn(e,n){return[n,...e.slice(1)]}function ft(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}function hn(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function te(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function jn({busy:e,defaultRepoUrl:n,projectName:a,commitBeforeCreate:i,templateManifest:g,uploadBeforeCreate:u,onClose:l,onSubmit:x}){const p=m.useMemo(()=>pt(g),[g]),N=p.entrypoints[0]??null,[c,U]=m.useState(n),[I,V]=m.useState(N?.name??""),[z,v]=m.useState(N?.command??""),[q,H]=m.useState(N?.timeoutSeconds?String(N.timeoutSeconds):""),[X,b]=m.useState(`Update ${a}`),[j,A]=m.useState("0.05"),[_,F]=m.useState(()=>Object.fromEntries(p.scalarInputs.map(r=>[r.name,r.defaultValue]))),[B,ae]=m.useState(()=>Object.fromEntries(p.envInputs.map(r=>[r.name,""]))),[Z,fe]=m.useState({}),K=p.volumes[0]??null,[Y,o]=m.useState(p.volumes.length>0||p.fileInputs.length>0),[P,w]=m.useState(K?.name??"volume"),[R,$]=m.useState(K?.mountPath??"/workspace/volumes/volume"),[J,ce]=m.useState(String(K?.storageGb??8)),[Pe,de]=m.useState(!(K?.deleteOnSandboxDelete??!1)),[M,ze]=m.useState(p.schedules),qe=p.entrypoints.find(r=>r.name===I)??N,se=qe?.ports??[],re=se[0]??null,[ue,xe]=m.useState(!!re),[Ce,me]=m.useState(re?String(re.port):""),D=Number(Ce),he=Number(j),ie=Number(J),le=Number(q),ke=!q.trim()||Number.isInteger(le)&&le>0&&le<=86400,oe=!ue||Number.isInteger(D)&&D>=Mt&&D<=Ut&&se.some(r=>r.port===D),Ie=Number.isFinite(he)&&he>0,ne=!Y||Number.isInteger(ie)&&ie>0,G=M.every(r=>!r.enabled||!!r.scheduleExpression.trim()),W=Fe(p.scalarInputs,I),je=Fe(p.fileInputs,I),Me=p.envInputs.every(r=>!r.required||!!(B[r.name]??"").trim()),ve=p.envInputs.filter(r=>r.required&&!(B[r.name]??"").trim()),Re=(u||!!c.trim())&&!!z.trim()&&Ie&&ke&&ne&&W.every(r=>!r.required||!!(_[r.name]??"").trim())&&je.every(r=>!r.required||(Z[r.name]?.length??0)>0)&&Me&&G&&oe;function Ve(r){V(r);const f=p.entrypoints.find(E=>E.name===r);if(!f)return;v(f.command),H(f.timeoutSeconds?String(f.timeoutSeconds):"");const y=f.ports[0]??null;me(y?String(y.port):""),xe(!!y)}function _e(r,f){F(y=>({...y,[r]:f}))}function pe(r,f){ae(y=>({...y,[r]:f}))}function He(r,f){const y=Array.from(f.target.files??[]);fe(E=>({...E,[r.name]:r.multiple?y:y.slice(0,1)}))}function ee(r,f){ze(y=>y.map((E,ge)=>ge===r?{...E,...f}:E))}function Ee(r){r.preventDefault(),!(!Re||e)&&x({repoUrl:c.trim(),command:z.trim(),entrypointName:I,commitMessage:X.trim(),budgetUsd:j.trim(),params:bt(W,_),env:gt(p.envInputs,B),timeoutSeconds:q.trim()&&Number.isInteger(le)?le:qe?.timeoutSeconds??null,uploads:je.flatMap(f=>{const y=Z[f.name]??[];return y.length>0?[{inputName:f.name,label:f.label,targetPath:f.targetPath,multiple:f.multiple,files:y}]:[]}),resources:p.resources,volumes:Y?xn(p.volumes,{...P.trim()?{name:P.trim()}:{},...R.trim()?{mountPath:R.trim()}:{},...Number.isInteger(ie)&&ie>0?{storageGb:ie}:{},deleteOnSandboxDelete:!Pe}):[],schedules:M.filter(f=>f.enabled),openPreview:ue,previewPort:ue?D:null,previewLabel:se.find(f=>f.port===D)?.label??"web",previewAccess:se.find(f=>f.port===D)?.access??"private"})}return t.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:t.jsxs("form",{className:"git-dialog run-once-dialog sandbox-start-dialog",role:"dialog","aria-modal":"true","aria-label":"Start sandbox",onSubmit:Ee,children:[t.jsx("button",{className:"git-dialog-close",disabled:e,type:"button",title:"Close","aria-label":"Close",onClick:l,children:t.jsx(mt,{size:15})}),t.jsxs("div",{className:"sandbox-start-dialog-heading",children:[t.jsx("div",{className:"git-dialog-icon",children:t.jsx(Ae,{size:18})}),t.jsx("h2",{children:"Start sandbox"}),t.jsxs("div",{className:"git-dialog-row",children:[t.jsx("span",{children:"Project"}),t.jsx("strong",{children:a})]})]}),t.jsxs("div",{className:"sandbox-start-dialog-body",children:[u?null:t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Repository"}),t.jsx("input",{disabled:e,value:c,onChange:r=>U(r.target.value)})]}),i?t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Commit message"}),t.jsx("input",{disabled:e,value:X,onChange:r=>b(r.target.value)})]}):null,p.entrypoints.length>0?t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Run target"}),t.jsx("select",{disabled:e,value:I,onChange:r=>Ve(r.target.value),children:p.entrypoints.map(r=>t.jsx("option",{value:r.name,children:r.name},r.name))})]}):null,t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Shell command"}),t.jsx("input",{disabled:e,value:z,onChange:r=>v(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Timeout seconds"}),t.jsx("input",{disabled:e,inputMode:"numeric",value:q,onChange:r=>H(r.target.value)})]}),W.map(r=>r.type==="boolean"?t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:(_[r.name]??"")==="true",disabled:e,type:"checkbox",onChange:f=>_e(r.name,f.target.checked?"true":"false")}),t.jsx("span",{}),r.label]},r.name):t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:r.label}),t.jsx("input",{disabled:e,inputMode:r.type==="number"||r.type==="integer"?"decimal":void 0,value:_[r.name]??"",onChange:f=>_e(r.name,f.target.value)})]},r.name)),je.map(r=>t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:r.label}),t.jsx("input",{accept:r.accept||void 0,disabled:e,multiple:r.multiple,type:"file",onChange:f=>He(r,f)})]},r.name)),p.envInputs.length>0?t.jsxs("div",{className:"sandbox-start-env-section",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Environment"}),ve.length>0?t.jsxs("p",{className:"sandbox-start-env-warning",role:"status",children:["Required sandbox secret ref missing: ",ve.map(r=>r.name).join(", ")]}):null,p.envInputs.map(r=>{const f=B[r.name]??"",y=r.required&&!f.trim(),E=`sandbox-env-${r.name}-description`;return t.jsxs("label",{className:"git-dialog-field",children:[t.jsxs("span",{children:[r.name,r.required?" *":""]}),t.jsx("input",{"aria-describedby":E,"aria-invalid":y,disabled:e,placeholder:"openpond://secret/...",value:f,onChange:ge=>pe(r.name,ge.target.value)}),t.jsx("small",{id:E,children:y?"Add a sandbox secret ref before starting.":r.description||"Sandbox secret ref only."})]},r.name)})]}):null,je.length>0||p.volumes.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:Y,disabled:e,type:"checkbox",onChange:r=>o(r.target.checked)}),t.jsx("span",{}),"Mount volume"]}),Y?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"run-once-dialog-grid",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Volume"}),t.jsx("input",{disabled:e,value:P,onChange:r=>w(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Storage GiB"}),t.jsx("input",{disabled:e,inputMode:"numeric",value:J,onChange:r=>ce(r.target.value)})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Mount path"}),t.jsx("input",{disabled:e,value:R,onChange:r=>$(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:Pe,disabled:e,type:"checkbox",onChange:r=>de(r.target.checked)}),t.jsx("span",{}),"Keep volume"]})]}):null]}):null,M.length>0?t.jsxs("div",{className:"sandbox-start-schedules",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Schedules"}),M.map((r,f)=>t.jsxs("div",{className:"sandbox-start-schedule-row",children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:r.enabled,disabled:e,type:"checkbox",onChange:y=>ee(f,{enabled:y.target.checked})}),t.jsx("span",{}),r.name]}),t.jsxs("div",{className:"run-once-dialog-grid",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Type"}),t.jsxs("select",{disabled:e||!r.enabled,value:r.scheduleType,onChange:y=>ee(f,{scheduleType:y.target.value}),children:[t.jsx("option",{value:"rate",children:"Rate"}),t.jsx("option",{value:"cron",children:"Cron"}),t.jsx("option",{value:"once",children:"Once"})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Max runs"}),t.jsx("input",{disabled:e||!r.enabled,inputMode:"numeric",value:r.maxRuns??"",onChange:y=>{const E=Number(y.target.value);ee(f,{maxRuns:Number.isInteger(E)&&E>0?E:null})}})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Expression"}),t.jsx("input",{disabled:e||!r.enabled,value:r.scheduleExpression,onChange:y=>ee(f,{scheduleExpression:y.target.value})})]})]},r.name))]}):null,t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Budget"}),t.jsx("input",{disabled:e,inputMode:"decimal",value:j,onChange:r=>A(r.target.value)})]}),se.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:ue,disabled:e,type:"checkbox",onChange:r=>xe(r.target.checked)}),t.jsx("span",{}),"Open preview"]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Preview port"}),t.jsx("select",{disabled:e||!ue,value:Ce,onChange:r=>me(r.target.value),children:se.map(r=>t.jsx("option",{value:r.port,children:r.label?`${r.label} (${r.port})`:r.port},r.port))})]})]}):null]}),t.jsxs("div",{className:"git-dialog-footer sandbox-start-dialog-footer",children:[t.jsx("button",{className:"git-dialog-secondary",disabled:e,type:"button",onClick:l,children:"Cancel"}),t.jsxs("button",{className:"git-dialog-primary",disabled:e||!Re,title:Me?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx(Lt,{size:14}),"Start"]})]})]})})}function vn({busy:e,projectName:n,templateManifest:a,onClose:i,onSubmit:g}){const u=m.useMemo(()=>pt(a),[a]),l=m.useMemo(()=>a?Ye(a).filter(o=>o.kind==="action"):[],[a]),x=l[0]??null,[p,N]=m.useState("sandbox"),[c,U]=m.useState(x?.name??""),[I,V]=m.useState(()=>Object.fromEntries(u.scalarInputs.map(o=>[o.name,o.defaultValue]))),[z,v]=m.useState(()=>Object.fromEntries(u.envInputs.map(o=>[o.name,""]))),[q,H]=m.useState({}),X=Fe(u.scalarInputs,c),b=Fe(u.fileInputs,c),j=p==="sandbox"?u.envInputs:[],A=X.every(o=>!o.required||!!(I[o.name]??"").trim()),_=b.every(o=>!o.required||(q[o.name]?.length??0)>0),F=j.every(o=>!o.required||!!(z[o.name]??"").trim()),B=j.filter(o=>o.required&&!(z[o.name]??"").trim()),ae=!!c&&A&&_&&F;function Z(o,P){V(w=>({...w,[o]:P}))}function fe(o,P){v(w=>({...w,[o]:P}))}function K(o,P,w){const R=Array.from(w.target.files??[]);H($=>({...$,[o]:P?R:R.slice(0,1)}))}function Y(o){o.preventDefault(),!(!ae||e)&&g({mode:p,target:c,params:bt(X,I),env:p==="sandbox"?gt(j,z):[],uploads:b.flatMap(P=>{const w=q[P.name]??[];return w.length>0?[{inputName:P.name,label:P.label,targetPath:P.targetPath,multiple:P.multiple,files:w}]:[]})})}return t.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:t.jsxs("form",{className:"git-dialog run-once-dialog sandbox-start-dialog",role:"dialog","aria-modal":"true","aria-label":"Run sandbox action",onSubmit:Y,children:[t.jsx("button",{className:"git-dialog-close",disabled:e,type:"button",title:"Close","aria-label":"Close",onClick:i,children:t.jsx(mt,{size:15})}),t.jsxs("div",{className:"sandbox-start-dialog-heading",children:[t.jsx("div",{className:"git-dialog-icon",children:t.jsx($e,{size:18})}),t.jsx("h2",{children:"Run action"}),t.jsxs("div",{className:"git-dialog-row",children:[t.jsx("span",{children:"Project"}),t.jsx("strong",{children:n})]})]}),t.jsxs("div",{className:"sandbox-start-dialog-body",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Action"}),t.jsx("select",{disabled:e||l.length===0,value:c,onChange:o=>U(o.target.value),children:l.map(o=>t.jsx("option",{value:o.name,children:o.name},o.name))})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Run on"}),t.jsxs("select",{disabled:e,value:p,onChange:o=>N(o.target.value==="local"?"local":"sandbox"),children:[t.jsx("option",{value:"sandbox",children:"Hosted sandbox (start/update)"}),t.jsx("option",{value:"local",children:"Local machine"})]})]}),X.map(o=>o.type==="boolean"?t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:(I[o.name]??"")==="true",disabled:e,type:"checkbox",onChange:P=>Z(o.name,P.target.checked?"true":"false")}),t.jsx("span",{}),o.label]},o.name):t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:o.label}),t.jsx("input",{disabled:e,inputMode:o.type==="number"||o.type==="integer"?"decimal":void 0,value:I[o.name]??"",onChange:P=>Z(o.name,P.target.value)})]},o.name)),b.map(o=>t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:o.label}),t.jsx("input",{accept:o.accept||void 0,disabled:e,multiple:o.multiple,type:"file",onChange:P=>K(o.name,o.multiple,P)})]},o.name)),j.length>0?t.jsxs("div",{className:"sandbox-start-env-section",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Environment"}),B.length>0?t.jsxs("p",{className:"sandbox-start-env-warning",role:"status",children:["Required sandbox secret ref missing: ",B.map(o=>o.name).join(", ")]}):null,j.map(o=>{const P=z[o.name]??"",w=o.required&&!P.trim(),R=`sandbox-action-env-${o.name}-description`;return t.jsxs("label",{className:"git-dialog-field",children:[t.jsxs("span",{children:[o.name,o.required?" *":""]}),t.jsx("input",{"aria-describedby":R,"aria-invalid":w,disabled:e,placeholder:"openpond://secret/...",value:P,onChange:$=>fe(o.name,$.target.value)}),t.jsx("small",{id:R,children:w?"Add a sandbox secret ref before running.":o.description||"Sandbox secret ref only."})]},o.name)})]}):null]}),t.jsxs("div",{className:"git-dialog-footer sandbox-start-dialog-footer",children:[t.jsx("button",{className:"git-dialog-secondary",disabled:e,type:"button",onClick:i,children:"Cancel"}),t.jsxs("button",{className:"git-dialog-primary",disabled:e||!ae,title:F?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx($e,{size:14}),"Run"]})]})]})})}function xt(e,n){const a=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"agent";return n==="cron"?`name: ${a}
|
|
2
2
|
version: 0.1.0
|
|
3
3
|
useCase: scheduled_report
|
|
4
4
|
start:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-De4k_YMo.js";/* empty css */import{C as z}from"./cloud-upload-DisZOwXE.js";import{bc as j,I as _,X as D}from"./App-DQfdLgyV.js";import{G as h}from"./git-commit-horizontal-C0QdA7uv.js";import{U as B}from"./upload-t7xHt3GY.js";function E({open:s,branch:l,filesChanged:i,additions:c,deletions:n,message:m,includeUnstaged:g,nextStep:a,draft:p,busy:t,canPush:u,canPublish:b,onMessageChange:f,onIncludeUnstagedChange:C,onNextStepChange:r,onDraftChange:N,onClose:v,onSubmit:k}){return s?e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:e.jsxs("form",{className:"git-dialog commit-dialog","aria-label":"Commit changes",onSubmit:o=>{o.preventDefault(),k()},children:[e.jsx(x,{disabled:t,onClose:v}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(h,{size:18})}),e.jsx("h2",{children:"Commit your changes"}),e.jsxs("div",{className:"git-dialog-row",children:[e.jsx("span",{children:"Branch"}),e.jsxs("strong",{children:[e.jsx(j,{size:14}),l??"No branch"]})]}),e.jsxs("div",{className:"git-dialog-row",children:[e.jsx("span",{children:"Changes"}),e.jsxs("strong",{children:[i," ",i===1?"file":"files",e.jsxs("span",{className:"git-dialog-additions",children:["+",c]}),e.jsxs("span",{className:"git-dialog-deletions",children:["-",n]})]})]}),e.jsxs("label",{className:"git-dialog-toggle",children:[e.jsx("input",{checked:g,disabled:t,type:"checkbox",onChange:o=>C(o.target.checked)}),e.jsx("span",{}),"Include unstaged"]}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsxs("span",{children:["Commit message",e.jsx("small",{children:"Leave blank to use an autogenerated message"})]}),e.jsx("textarea",{value:m,disabled:t,placeholder:"Update workspace",onChange:o=>f(o.target.value)})]}),e.jsxs("fieldset",{className:"git-dialog-next",children:[e.jsx("legend",{children:"Next steps"}),e.jsx(d,{active:a==="commit",icon:e.jsx(h,{size:14}),label:"Commit",disabled:t,onSelect:()=>r("commit")}),e.jsx(d,{active:a==="commit_push",icon:e.jsx(B,{size:14}),label:"Commit & push",disabled:t||!u,onSelect:()=>r("commit_push")}),b&&e.jsx(d,{active:a==="commit_publish",icon:e.jsx(z,{size:14}),label:"Commit & publish",disabled:t,onSelect:()=>r("commit_publish")}),e.jsx(d,{active:a==="commit_pr",icon:e.jsx(_,{size:14}),label:"Commit & create PR",disabled:!0,onSelect:()=>r("commit_pr")})]}),e.jsxs("div",{className:"git-dialog-footer",children:[e.jsxs("label",{className:"git-dialog-toggle draft-toggle",children:[e.jsx("input",{checked:p,disabled:t||a!=="commit_pr",type:"checkbox",onChange:o=>N(o.target.checked)}),e.jsx("span",{}),"Draft"]}),e.jsx("button",{className:"git-dialog-primary",disabled:t||i===0,type:"submit",children:"Continue"})]})]})}):null}function F({open:s,branchName:l,busy:i,onBranchNameChange:c,onSetPrefix:n,onClose:m,onSubmit:g}){return s?e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:e.jsxs("form",{className:"git-dialog branch-dialog","aria-label":"Create branch",onSubmit:a=>{a.preventDefault(),g()},children:[e.jsx(x,{disabled:i,onClose:m}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(j,{size:18})}),e.jsx("h2",{children:"Work here"}),e.jsx("p",{children:"Create a branch to commit changes, push, and create a PR from this worktree."}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsxs("span",{children:["Branch name",e.jsx("button",{className:"git-dialog-inline-action",disabled:i,type:"button",onClick:n,children:"Set prefix"})]}),e.jsx("input",{autoFocus:!0,disabled:i,value:l,onChange:a=>c(a.target.value)})]}),e.jsx("button",{className:"git-dialog-primary full",disabled:i||!l.trim(),type:"submit",children:"Create"})]})}):null}function d({active:s,icon:l,label:i,disabled:c,onSelect:n}){return e.jsxs("button",{"aria-pressed":s,className:s?"active":"",disabled:c,type:"button",onClick:n,children:[l,e.jsx("span",{children:i}),s&&e.jsx("span",{className:"git-dialog-check",children:"✓"})]})}function x({disabled:s,onClose:l}){return e.jsx("button",{className:"git-dialog-close",disabled:s,type:"button",onClick:l,children:e.jsx(D,{size:16})})}export{F as BranchDialog,E as CommitDialog};
|