openpond 0.0.47 → 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{app-layer-4PR4BS7N.js → app-layer-E2JWCA6D.js} +2 -2
- package/dist/chunks/{app-server-runtime-4KT5OMVC.js → app-server-runtime-OWEIHFEU.js} +6 -6
- package/dist/chunks/{apps-V7TF6RTV.js → apps-VQDIVGST.js} +2 -2
- package/dist/chunks/{chunk-CGVG46T5.js → chunk-3BR4ACFF.js} +1 -1
- package/dist/chunks/{chunk-KPVNB2KS.js → chunk-64LWPRGN.js} +2 -2
- package/dist/chunks/{chunk-I4CQJSZK.js → chunk-7G472COA.js} +451 -80
- package/dist/chunks/{chunk-7B2K727D.js → chunk-7M4HGT5X.js} +1 -1
- package/dist/chunks/{chunk-TNM6UTTF.js → chunk-CNIMJPM5.js} +1315 -894
- package/dist/chunks/{chunk-HGJQUQAP.js → chunk-LRLDBKTI.js} +1 -1
- package/dist/chunks/{chunk-YYJH2WWX.js → chunk-NR2N6JAC.js} +1 -1
- package/dist/chunks/{chunk-IM67TWCC.js → chunk-NRLI3S72.js} +1 -1
- package/dist/chunks/{chunk-YBQTQWOY.js → chunk-QD4FR3O4.js} +32 -32
- package/dist/chunks/{chunk-ERQUG3HB.js → chunk-UJV3UYLP.js} +1 -1
- package/dist/chunks/{cli-TINOXBYY.js → cli-T6TTMVSU.js} +5 -5
- package/dist/chunks/{core-commands-O76V62SB.js → core-commands-UW4XTGXK.js} +3 -3
- package/dist/chunks/{desktop-test-N2UPF5PP.js → desktop-test-JTBPE7CH.js} +2 -2
- package/dist/chunks/{extension-XQBSBEVO.js → extension-VP7LMA32.js} +1 -1
- package/dist/chunks/{help-YSGYNWPJ.js → help-OZNCHHO3.js} +1 -1
- package/dist/chunks/{opchat-F5OFTH56.js → opchat-RY3QU5UJ.js} +2 -2
- package/dist/chunks/{organizations-EEQPOIAZ.js → organizations-GLKSXK3Q.js} +4 -4
- package/dist/chunks/{profile-3OGGNTDS.js → profile-JWUYJF23.js} +2 -2
- package/dist/chunks/{project-agent-LVOSTVE5.js → project-agent-L4EB7QFO.js} +2 -2
- package/dist/chunks/{sandbox-command-S3VMWGMH.js → sandbox-command-26255MSV.js} +2 -2
- package/dist/chunks/{sandbox-template-UDXW7LRZ.js → sandbox-template-6UDA3AEY.js} +3 -3
- package/dist/chunks/{src-64JULYJS.js → src-7S66FU4P.js} +22 -21
- package/dist/chunks/{src-JMDVVYFD.js → src-GCZ2GMG3.js} +3 -3
- package/dist/chunks/{teams-bot-YRKKQDYL.js → teams-bot-PO3GOLWU.js} +2 -2
- package/dist/chunks/{workspaces-EICADW3U.js → workspaces-26IF6TQV.js} +2 -2
- package/dist/cli.js +13 -13
- package/dist/web/assets/{AppDialog-Bqw26W0m.js → AppDialog-BTOxCNC5.js} +1 -1
- package/dist/web/assets/{AppsView-CWhWKF1c.js → AppsView-Cm5x09IS.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-MTkosLlw.js → BrowserSidebar-CIPh5JIn.js} +1 -1
- package/dist/web/assets/{CommandMenu-Bz9bpiwl.js → CommandMenu-DdR82TLd.js} +1 -1
- package/dist/web/assets/{CommunityView-BqFeUGPj.js → CommunityView-Dqu4cos1.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-B6BBqdaL.js → ComposerCreateImproveStrip-CW2QuI7r.js} +1 -1
- package/dist/web/assets/{GetStartedView-BsgErNU9.js → GetStartedView--CbCnzFQ.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-BLnFb7Mt.js → LabModelVersionDetailPage-BPUvR5XP.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-Ba6gRUbM.js → LabSkillSidebar-CnuyFZ1G.js} +1 -1
- package/dist/web/assets/{LabsRoute-BFV7VPOU.js → LabsRoute-CYk2dzQp.js} +3 -3
- package/dist/web/assets/{MainChatThread-B283zmgR.js → MainChatThread-0Tc95p0t.js} +2 -2
- package/dist/web/assets/{MainPane-Lv073mMC.js → MainPane-Bke4JEHC.js} +3 -3
- package/dist/web/assets/{MarkdownText-CinDMr2e.js → MarkdownText-DTBS9xe7.js} +1 -1
- package/dist/web/assets/{Messages-okIKN3y-.js → Messages-Bae_sFx5.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-B1QrK2aH.js → NativeSkillSidebar-DSoPD42b.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-CcbDk9Py.js → NewProjectDialog-CmXg2GK7.js} +1 -1
- package/dist/web/assets/{OutputsPage-CmwXC2Xd.js → OutputsPage-XmIreC0M.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-CHOpwL1L.js → RightChatPanelStack-BMOtbjus.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-BzSPcB3d.js → ScheduledWorkPage-Cn5a9VLV.js} +1 -1
- package/dist/web/assets/{SettingsView-CkmRV5NT.js → SettingsView-DXF8z3P2.js} +6 -6
- package/dist/web/assets/{TeamChatView-DevmTvuf.js → TeamChatView-CB_0oRid.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-CteY7dSQ.js → TerminalOverlay-XhABQsCB.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-AMq0npLN.js → TrainingCreationPanel-ChsDr2GP.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-BVxPaBhF.js → TrainingDraftPanel-CDlpnno6.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-BPIzRNKL.js → UsageSettingsSection-NbX7_3Uz.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-DMu3IIuX.js → WorkspaceDiffPanel-jaJU08NH.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-ConUKuWd.js → WorkspaceEnvironmentMenu-D0nvQmmj.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-o76400dH.js → WorkspaceGitDialogs-C0PMpVfj.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-HwyVbn8h.js → WorkspaceMonacoEditor-6QNGzQUi.js} +3 -3
- package/dist/web/assets/{arrow-up-right-BKN-maHj.js → arrow-up-right-Cx2xjktp.js} +1 -1
- package/dist/web/assets/{chevron-up-CVs6VVxb.js → chevron-up-UF_r7JHT.js} +1 -1
- package/dist/web/assets/{circle-alert-C01fZFW7.js → circle-alert-BUHAQ7Du.js} +1 -1
- package/dist/web/assets/{cloud-upload-jtADHeTW.js → cloud-upload-Cc_ZQEAm.js} +1 -1
- package/dist/web/assets/{cssMode-xJZoI37_.js → cssMode-CrigFsxI.js} +1 -1
- package/dist/web/assets/{folder-open-DyyC6ByN.js → folder-open-D7a4t258.js} +1 -1
- package/dist/web/assets/{folder-plus-UGSTW1kn.js → folder-plus-CmeHTj5W.js} +1 -1
- package/dist/web/assets/{git-branch-D6gtbKJu.js → git-branch-CaVUghsI.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-C_GYw-SZ.js → git-commit-horizontal-oiDAVV_Y.js} +1 -1
- package/dist/web/assets/{htmlMode-BjKG829K.js → htmlMode-CLzM5GNi.js} +1 -1
- package/dist/web/assets/index-De6p2npi.js +1 -0
- package/dist/web/assets/index-UUM3pwfd.css +1 -0
- package/dist/web/assets/index-Ure41UF0.js +178 -0
- package/dist/web/assets/{info-z2hv9cD1.js → info-dTkimobU.js} +1 -1
- package/dist/web/assets/{jsonMode-DjZzpcCY.js → jsonMode-BBF67cOE.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-B4RETEmT.js → lspLanguageFeatures-DHtN2nxz.js} +1 -1
- package/dist/web/assets/{monaco.contribution-I3nbx1nu.js → monaco.contribution-BClTZJd2.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DJK2Dt3T.js → monaco.contribution-C_GWU01R.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Du7kEHLz.js → monaco.contribution-DtM9AdPi.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DCRifLw0.js → monaco.contribution-riAIDf7J.js} +2 -2
- package/dist/web/assets/{monitor-DCUsiZyp.js → monitor-POfnZCWw.js} +1 -1
- package/dist/web/assets/{play-DCKc0E80.js → play-CjWTsI9z.js} +1 -1
- package/dist/web/assets/{python-DwbW9406.js → python-CvZQM_g2.js} +1 -1
- package/dist/web/assets/{refresh-cw-D6okuGLV.js → refresh-cw-CeHT_tXT.js} +1 -1
- package/dist/web/assets/{reply-KIN_PSFi.js → reply-BkH8nKWG.js} +1 -1
- package/dist/web/assets/{save-D7tbQpM9.js → save-CmJ92Odx.js} +1 -1
- package/dist/web/assets/{square-BUG8bwGr.js → square-B00f_944.js} +1 -1
- package/dist/web/assets/{square-pen-CWS_8PrJ.js → square-pen-LHr8bFfZ.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-CO8n70ql.js → toggleHighContrast-C6N52VOS.js} +1 -1
- package/dist/web/assets/{tsMode-f9Hqewvr.js → tsMode-CDIfvnHn.js} +1 -1
- package/dist/web/assets/{upload-DXI5er5D.js → upload-DK0-5jXz.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-BMvi6vmi.js → useLocalAgentSchedules-BUkZjV9E.js} +1 -1
- package/dist/web/assets/{wifi-off-B3ZtcrOA.js → wifi-off-BQGq-son.js} +1 -1
- package/dist/web/assets/{workers-CNGv6B0J.js → workers-BfcjsZ3C.js} +1 -1
- package/dist/web/assets/{yaml-C-tL3IVE.js → yaml-CNqgAihH.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-B8xSSlBW.js +0 -178
- package/dist/web/assets/index-C-1-yaL8.js +0 -1
- package/dist/web/assets/index-D9jTe16Q.css +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WorkspaceMonacoEditor-
|
|
2
|
-
import{c as Ee,j as e,F as lt,bd as zs,r as l,au as Fe,n as I,be as $t,aS as Ft,aN as Oe,bf as da,bg as ua,aq as fa,bh as pa,ar as ha,B as tn,b as ma,X as Is,P as xa,a1 as ba,a6 as ga,a0 as ja,$ as va,E as ka,a3 as Ws,bi as wa,bj as ts,bk as ya,bl as ss,bm as Sa,a as Na,_ as Ca,bn as Qt,bo as Ra,bp as ns,aZ as Ne,bq as $a,br as Bs,bs as Fa,bt as Ea,bu as Os,bv as Aa,bw as Pa}from"./index-B8xSSlBW.js";import{T as La,F as Da,A as Ta,a as _a,M as Ma,b as za,u as Us,I as Ia}from"./MarkdownText-CinDMr2e.js";import{C as sn}from"./circle-alert-C01fZFW7.js";import{R as as}from"./refresh-cw-D6okuGLV.js";import{t as Wa,a as Ba,m as Oa,s as Ua,d as Ha,f as Va,b as Ga}from"./training-model-data-B7-1Bxil.js";import{F as Ka}from"./square-pen-CWS_8PrJ.js";import{F as yt}from"./folder-open-DyyC6ByN.js";import{I as Hs}from"./info-z2hv9cD1.js";import{S as qa}from"./save-D7tbQpM9.js";import{C as Xa}from"./chevron-up-CVs6VVxb.js";const Za=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],Qa=Ee("text-align-start",Za);const Ya=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Ja=Ee("chevrons-up",Ya);const ei=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ti=Ee("columns-2",ei);const si=[["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"}]],ni=Ee("eye-off",si);const ai=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],ii=Ee("panel-top",ai);const ri=[["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"}]],li=Ee("redo-2",ri);const oi=[["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"}]],ci=Ee("undo-2",oi);function di({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 ${Fi(t?.run.state??null)}`,children:u})]}),e.jsx("div",{className:"goal-details-body",children:t?e.jsx(ui,{runtime:t}):s||n?e.jsx(pi,{goalRuntime:s,subagentRuntime:n,onRunSubagentLifecycleAction:a}):e.jsx($i,{})})]})}function ui({runtime:t}){const s=t.run,n=s.plan,a=zs(n?.metadata)??zs(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(fi,{run:s}),s.blockedReason?e.jsx(V,{title:"Blocked",children:e.jsxs("div",{className:"goal-details-alert",children:[e.jsx(sn,{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 fi({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 pi({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(hi,{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 hi({runtime:t,onRunSubagentLifecycleAction:s}){const[n,a]=l.useState(null),[i,u]=l.useState(null);Fe(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",ki(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",wi(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(xi,{pendingAction:n,run:f,onRun:c}):null]})]},f.id))})]}),t.finalResults.length>0?e.jsx(mi,{results:t.finalResults}):null]})}function mi({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: ",Ce(s.findings,3)]}):null,s.changedFiles.length>0?e.jsxs("small",{children:["Files: ",Ce(s.changedFiles,4)]}):null,s.testsRun.length>0?e.jsxs("small",{children:["Tests: ",Ce(s.testsRun,3)]}):null,s.validationAttempts.length>0?e.jsxs("small",{children:["Validation: ",Ce(s.validationAttempts,2)]}):null,s.refs.length>0?e.jsxs("small",{children:["Refs: ",Ce(s.refs.map(yi),4)]}):null,s.blockers.length>0?e.jsxs("small",{children:["Blockers: ",Ce(s.blockers,3)]}):null,s.workspaceRetention?e.jsxs("small",{children:["Workspace: ",Ni(s.workspaceRetention)]}):null,s.importantMessages.length>0?e.jsxs("small",{children:["Messages: ",Ce(s.importantMessages.map(Si),2)]}):null]},s.runId))})})}function xi({pendingAction:t,run:s,onRun:n}){const a=bi(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...":gi(i)},i)})})}function bi(t){const s=[],n=ji(t),a=vi(t);return n&&s.push("cleanup"),a&&s.push("archive"),s}function gi(t){return t==="cleanup"?"Clean":t==="archive"?"Archive":"Clean + archive"}function ji(t){if(!nn(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=an(a?.status);return i!=="removed"&&i!=="deleted"&&i!=="retained"&&i!=="skipped"}function vi(t){if(!t.childSessionId||!nn(t))return!1;const s=rt(rt(t.metadata)?.childSessionArchive),n=an(s?.status);return n!=="archived"&&n!=="already_archived"}function nn(t){return t.status==="completed"||t.status==="failed"||t.status==="cancelled"}function ki(t){const s=t.latestMeaningfulUpdate;return s?`${St(s.roleId)} ${s.status}: ${s.message}`:"No structured update"}function wi(t,s){if(t<=0&&s<=0)return"0 tokens";const n=`${s} ${s===1?"request":"requests"}`;return`${Ci(t)} tokens · ${n}`}function St(t){return t.slice(0,1).toUpperCase()+t.slice(1).replace(/[-_]+/g," ")}function yi(t){return`${t.kind}: ${t.label}`}function Si(t){return`${Z(t.kind)}: ${t.body}`}function Ni(t){const s=t.expiresAt?`until ${Ri(t.expiresAt)}`:"for inspection",n=t.trigger?` · ${Z(t.trigger)}`:"";return`retained ${s}${n}`}function Ce(t,s){const n=t.slice(0,s),a=t.length-n.length;return a>0?`${n.join(", ")} +${a}`:n.join(", ")}function Ci(t){if(t<1e3)return String(t);if(t>=1e6){const n=t/1e6;return`${Vs(n,n<10?2:1)}M`}const s=t/1e3;return`${Vs(s,s<10?1:0)}k`}function Ri(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Vs(t,s){return t.toFixed(s).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")}function $i(){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 an(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 Fi(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 Ei({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);Fe(o,{prefix:"Sandbox"}),Fe(S,{prefix:"Sandbox integrations"});const N=n?.integrationLeases??[],E=l.useMemo(()=>i.filter(j=>j.status==="active"),[i]),_=l.useMemo(()=>Pi(n),[n]),W=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 I.sandbox(s,t),R=await I.integrationConnections(s,Gs(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([I.integrationConnections(s,Gs(n)),I.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 I.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 I.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(()=>{W()},[W]),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:()=>{W()},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:Ks(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:rn(n.updatedAt)})]}),_?e.jsxs("div",{children:[e.jsx("dt",{children:"Receipt"}),e.jsxs("dd",{children:[Ks(_.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"," / ",Ti(j)," / ",Ai(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(La,{size:14})}),e.jsxs("div",{className:"sandbox-workspace-chip-row",children:[j.capabilities.slice(0,5).map(R=>e.jsx("span",{children:Di(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=Li(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:_i(j)}),e.jsx("small",{children:Mi(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(da,{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 Gs(t){return{status:"active"}}function Ai(t){return t.proxyUrl?"runtime proxy available":"metadata only, no runtime proxy"}function Pi(t){return t?.receipts?.at(-1)??null}function Li(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 Di(t,s){const n=$t(t);return(n?Ft(n):null)?.capabilities.find(i=>i.id===s)?.label??s}function Ti(t){return t.expiresAt?`expires ${rn(t.expiresAt)}`:"active"}function _i(t){const s=t.providerAccountName?.trim();return s?`${ae(t.provider)} / ${s}`:ae(t.provider)}function Mi(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 Ks(t){return t.length>10?`${t.slice(0,8)}...`:t}function rn(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 zi({summary:t}){const s=Wa(t.taskset),n=t.taskset.learningSignals.demonstrations.filter(c=>c.approved).length,a=t.taskset.tasks.filter(c=>c.split==="frozen_eval").length,i=t.plan?.recipe.method==="sft"||t.plan?.recipe.method==="grpo"?t.plan.recipe:null,u=Ba(t.taskset,t.plan);return e.jsxs("div",{className:"training-sidebar-summary",children:[e.jsxs("header",{children:[e.jsx("h2",{children:Oa(t.taskset.name)}),e.jsx("span",{children:t.job?Ua(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?Ha(t.plan.destinationId):"Not selected"}),e.jsx(O,{label:"Started",value:Va(t.job?.startedAt??null)}),e.jsx(O,{label:"Duration",value:Ga(t.job?.startedAt??null,t.job?.completedAt??null)})]})]}),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 Ii(t){const s=qs("","","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=qs(h,c,m),u.childMap.set(o,x),u.children.push(x)),u=x}}return ln(s.children)}function qs(t,s,n){return{name:t,path:s,type:n,children:[],childMap:new Map}}function ln(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:ln(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(ua,{size:14}):e.jsx(fa,{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(pa,{size:14}):e.jsx(ha,{size:14})})]})}function Wi({changedByPath:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=l.useMemo(()=>Ii(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(on,{changedByPath:t,expandedFolderPaths:s,node:o,rootPath:n,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h},`${o.type}:${o.path}`))})]})}function on({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(Ka,{size:14}),e.jsx("span",{children:a.name})]}),x&&a.children.map(N=>e.jsx(on,{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(Da,{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 Xs({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(Wi,{changedByPath:o,expandedFolderPaths:s,rootPath:x,repoFiles:S,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h})})}function Bi({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(Ta,{size:14}),label:"Enable word wrap",onClick:_,onClose:f}),e.jsx(ce,{checked:t,icon:e.jsx(Ja,{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(ii,{size:14}),label:"Show editor controls",onClick:x,onClose:f}),e.jsx(ce,{checked:i,icon:e.jsx(tn,{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(Qa,{size:14}),label:"Enable word diffs",onClick:E,onClose:f}),e.jsx(ce,{checked:n,icon:e.jsx(ni,{size:14}),label:"Hide white space",onClick:S,onClose:f}),e.jsx(ce,{icon:e.jsx(_a,{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(ma,{size:14})]})}function Oi({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:W,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&&W()}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,W,H,c]);function Y(w){if(w.key==="Escape"){W();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=wa(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(Hs,{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(xa,{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(ba,{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(Hs,{size:14}),e.jsx("span",{children:"Summary"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:B,children:[e.jsx(ga,{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(ja,{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(Ma,{size:14}):e.jsx(va,{size:14})})]})}function Ui({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:W,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(ka,{size:15})}),h&&e.jsx(Bi,{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(qa,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Undo","aria-label":"Undo",onClick:U,children:e.jsx(ci,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Redo","aria-label":"Redo",onClick:W,children:e.jsx(li,{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(Ws,{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(sn,{size:13}):e.jsx(Ws,{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(tn,{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(ti,{size:14})})]})})}const Hi={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 Hi[n]??"text"}function Vi(t,s){return t?s==="markdown"?Gi(t):s==="json"?$e(t,/("(?:\\.|[^"\\])*"(?=\s*:)|"(?:\\.|[^"\\])*"|[-]?\b\d+(?:\.\d+)?\b|\btrue\b|\bfalse\b|\bnull\b|[{}[\]:,])/g):s==="css"?$e(t,/(\/\*.*?\*\/|#[\da-fA-F]{3,8}\b|--[\w-]+|[.#]?[\w-]+(?=\s*:)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b\d+(?:\.\d+)?(?:px|rem|em|%|vh|vw)?\b|[{}():;,])/g):s==="html"?$e(t,/(<!--.*?-->|<\/?[\w-]+|[\w:-]+(?==)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[<>/=])/g):s==="shell"?$e(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"?$e(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):$e(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 Gi(t){return/^\s{0,3}#{1,6}\s/.test(t)?[{text:t,kind:"keyword"}]:/^\s*[-*+]\s/.test(t)?[{text:t,kind:"property"}]:$e(t,/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)]+\)|https?:\/\/\S+)/g)}function Ki(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 $e(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:Ki(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:Vi(s,t).map((n,a)=>e.jsx("span",{className:`syntax-token ${n.kind}`,children:n.text},`${a}-${n.text}`))})}const qi=`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WorkspaceMonacoEditor-6QNGzQUi.js","./index-Ure41UF0.js","./index-UUM3pwfd.css","./WorkspaceMonacoEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as Ee,j as e,F as lt,bd as zs,r as l,au as Fe,n as I,be as $t,aS as Ft,aN as Oe,bf as da,bg as ua,aq as fa,bh as pa,ar as ha,B as tn,b as ma,X as Is,P as xa,a1 as ba,a6 as ga,a0 as ja,$ as va,E as ka,a3 as Ws,bi as wa,bj as ts,bk as ya,bl as ss,bm as Sa,a as Na,_ as Ca,bn as Qt,bo as Ra,bp as ns,aZ as Ne,bq as $a,br as Bs,bs as Fa,bt as Ea,bu as Os,bv as Aa,bw as Pa}from"./index-Ure41UF0.js";import{T as La,F as Da,A as Ta,a as _a,M as Ma,b as za,u as Us,I as Ia}from"./MarkdownText-DTBS9xe7.js";import{C as sn}from"./circle-alert-BUHAQ7Du.js";import{R as as}from"./refresh-cw-CeHT_tXT.js";import{t as Wa,a as Ba,m as Oa,s as Ua,d as Ha,f as Va,b as Ga}from"./training-model-data-B7-1Bxil.js";import{F as Ka}from"./square-pen-LHr8bFfZ.js";import{F as yt}from"./folder-open-D7a4t258.js";import{I as Hs}from"./info-dTkimobU.js";import{S as qa}from"./save-CmJ92Odx.js";import{C as Xa}from"./chevron-up-UF_r7JHT.js";const Za=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],Qa=Ee("text-align-start",Za);const Ya=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Ja=Ee("chevrons-up",Ya);const ei=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ti=Ee("columns-2",ei);const si=[["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"}]],ni=Ee("eye-off",si);const ai=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],ii=Ee("panel-top",ai);const ri=[["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"}]],li=Ee("redo-2",ri);const oi=[["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"}]],ci=Ee("undo-2",oi);function di({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 ${Fi(t?.run.state??null)}`,children:u})]}),e.jsx("div",{className:"goal-details-body",children:t?e.jsx(ui,{runtime:t}):s||n?e.jsx(pi,{goalRuntime:s,subagentRuntime:n,onRunSubagentLifecycleAction:a}):e.jsx($i,{})})]})}function ui({runtime:t}){const s=t.run,n=s.plan,a=zs(n?.metadata)??zs(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(fi,{run:s}),s.blockedReason?e.jsx(V,{title:"Blocked",children:e.jsxs("div",{className:"goal-details-alert",children:[e.jsx(sn,{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 fi({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 pi({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(hi,{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 hi({runtime:t,onRunSubagentLifecycleAction:s}){const[n,a]=l.useState(null),[i,u]=l.useState(null);Fe(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",ki(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",wi(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(xi,{pendingAction:n,run:f,onRun:c}):null]})]},f.id))})]}),t.finalResults.length>0?e.jsx(mi,{results:t.finalResults}):null]})}function mi({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: ",Ce(s.findings,3)]}):null,s.changedFiles.length>0?e.jsxs("small",{children:["Files: ",Ce(s.changedFiles,4)]}):null,s.testsRun.length>0?e.jsxs("small",{children:["Tests: ",Ce(s.testsRun,3)]}):null,s.validationAttempts.length>0?e.jsxs("small",{children:["Validation: ",Ce(s.validationAttempts,2)]}):null,s.refs.length>0?e.jsxs("small",{children:["Refs: ",Ce(s.refs.map(yi),4)]}):null,s.blockers.length>0?e.jsxs("small",{children:["Blockers: ",Ce(s.blockers,3)]}):null,s.workspaceRetention?e.jsxs("small",{children:["Workspace: ",Ni(s.workspaceRetention)]}):null,s.importantMessages.length>0?e.jsxs("small",{children:["Messages: ",Ce(s.importantMessages.map(Si),2)]}):null]},s.runId))})})}function xi({pendingAction:t,run:s,onRun:n}){const a=bi(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...":gi(i)},i)})})}function bi(t){const s=[],n=ji(t),a=vi(t);return n&&s.push("cleanup"),a&&s.push("archive"),s}function gi(t){return t==="cleanup"?"Clean":t==="archive"?"Archive":"Clean + archive"}function ji(t){if(!nn(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=an(a?.status);return i!=="removed"&&i!=="deleted"&&i!=="retained"&&i!=="skipped"}function vi(t){if(!t.childSessionId||!nn(t))return!1;const s=rt(rt(t.metadata)?.childSessionArchive),n=an(s?.status);return n!=="archived"&&n!=="already_archived"}function nn(t){return t.status==="completed"||t.status==="failed"||t.status==="cancelled"}function ki(t){const s=t.latestMeaningfulUpdate;return s?`${St(s.roleId)} ${s.status}: ${s.message}`:"No structured update"}function wi(t,s){if(t<=0&&s<=0)return"0 tokens";const n=`${s} ${s===1?"request":"requests"}`;return`${Ci(t)} tokens · ${n}`}function St(t){return t.slice(0,1).toUpperCase()+t.slice(1).replace(/[-_]+/g," ")}function yi(t){return`${t.kind}: ${t.label}`}function Si(t){return`${Z(t.kind)}: ${t.body}`}function Ni(t){const s=t.expiresAt?`until ${Ri(t.expiresAt)}`:"for inspection",n=t.trigger?` · ${Z(t.trigger)}`:"";return`retained ${s}${n}`}function Ce(t,s){const n=t.slice(0,s),a=t.length-n.length;return a>0?`${n.join(", ")} +${a}`:n.join(", ")}function Ci(t){if(t<1e3)return String(t);if(t>=1e6){const n=t/1e6;return`${Vs(n,n<10?2:1)}M`}const s=t/1e3;return`${Vs(s,s<10?1:0)}k`}function Ri(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Vs(t,s){return t.toFixed(s).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")}function $i(){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 an(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 Fi(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 Ei({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);Fe(o,{prefix:"Sandbox"}),Fe(S,{prefix:"Sandbox integrations"});const N=n?.integrationLeases??[],E=l.useMemo(()=>i.filter(j=>j.status==="active"),[i]),_=l.useMemo(()=>Pi(n),[n]),W=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 I.sandbox(s,t),R=await I.integrationConnections(s,Gs(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([I.integrationConnections(s,Gs(n)),I.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 I.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 I.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(()=>{W()},[W]),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:()=>{W()},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:Ks(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:rn(n.updatedAt)})]}),_?e.jsxs("div",{children:[e.jsx("dt",{children:"Receipt"}),e.jsxs("dd",{children:[Ks(_.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"," / ",Ti(j)," / ",Ai(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(La,{size:14})}),e.jsxs("div",{className:"sandbox-workspace-chip-row",children:[j.capabilities.slice(0,5).map(R=>e.jsx("span",{children:Di(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=Li(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:_i(j)}),e.jsx("small",{children:Mi(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(da,{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 Gs(t){return{status:"active"}}function Ai(t){return t.proxyUrl?"runtime proxy available":"metadata only, no runtime proxy"}function Pi(t){return t?.receipts?.at(-1)??null}function Li(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 Di(t,s){const n=$t(t);return(n?Ft(n):null)?.capabilities.find(i=>i.id===s)?.label??s}function Ti(t){return t.expiresAt?`expires ${rn(t.expiresAt)}`:"active"}function _i(t){const s=t.providerAccountName?.trim();return s?`${ae(t.provider)} / ${s}`:ae(t.provider)}function Mi(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 Ks(t){return t.length>10?`${t.slice(0,8)}...`:t}function rn(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 zi({summary:t}){const s=Wa(t.taskset),n=t.taskset.learningSignals.demonstrations.filter(c=>c.approved).length,a=t.taskset.tasks.filter(c=>c.split==="frozen_eval").length,i=t.plan?.recipe.method==="sft"||t.plan?.recipe.method==="grpo"?t.plan.recipe:null,u=Ba(t.taskset,t.plan);return e.jsxs("div",{className:"training-sidebar-summary",children:[e.jsxs("header",{children:[e.jsx("h2",{children:Oa(t.taskset.name)}),e.jsx("span",{children:t.job?Ua(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?Ha(t.plan.destinationId):"Not selected"}),e.jsx(O,{label:"Started",value:Va(t.job?.startedAt??null)}),e.jsx(O,{label:"Duration",value:Ga(t.job?.startedAt??null,t.job?.completedAt??null)})]})]}),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 Ii(t){const s=qs("","","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=qs(h,c,m),u.childMap.set(o,x),u.children.push(x)),u=x}}return ln(s.children)}function qs(t,s,n){return{name:t,path:s,type:n,children:[],childMap:new Map}}function ln(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:ln(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(ua,{size:14}):e.jsx(fa,{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(pa,{size:14}):e.jsx(ha,{size:14})})]})}function Wi({changedByPath:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=l.useMemo(()=>Ii(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(on,{changedByPath:t,expandedFolderPaths:s,node:o,rootPath:n,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h},`${o.type}:${o.path}`))})]})}function on({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(Ka,{size:14}),e.jsx("span",{children:a.name})]}),x&&a.children.map(N=>e.jsx(on,{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(Da,{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 Xs({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(Wi,{changedByPath:o,expandedFolderPaths:s,rootPath:x,repoFiles:S,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h})})}function Bi({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(Ta,{size:14}),label:"Enable word wrap",onClick:_,onClose:f}),e.jsx(ce,{checked:t,icon:e.jsx(Ja,{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(ii,{size:14}),label:"Show editor controls",onClick:x,onClose:f}),e.jsx(ce,{checked:i,icon:e.jsx(tn,{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(Qa,{size:14}),label:"Enable word diffs",onClick:E,onClose:f}),e.jsx(ce,{checked:n,icon:e.jsx(ni,{size:14}),label:"Hide white space",onClick:S,onClose:f}),e.jsx(ce,{icon:e.jsx(_a,{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(ma,{size:14})]})}function Oi({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:W,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&&W()}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,W,H,c]);function Y(w){if(w.key==="Escape"){W();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=wa(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(Hs,{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(xa,{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(ba,{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(Hs,{size:14}),e.jsx("span",{children:"Summary"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:B,children:[e.jsx(ga,{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(ja,{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(Ma,{size:14}):e.jsx(va,{size:14})})]})}function Ui({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:W,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(ka,{size:15})}),h&&e.jsx(Bi,{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(qa,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Undo","aria-label":"Undo",onClick:U,children:e.jsx(ci,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Redo","aria-label":"Redo",onClick:W,children:e.jsx(li,{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(Ws,{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(sn,{size:13}):e.jsx(Ws,{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(tn,{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(ti,{size:14})})]})})}const Hi={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 Hi[n]??"text"}function Vi(t,s){return t?s==="markdown"?Gi(t):s==="json"?$e(t,/("(?:\\.|[^"\\])*"(?=\s*:)|"(?:\\.|[^"\\])*"|[-]?\b\d+(?:\.\d+)?\b|\btrue\b|\bfalse\b|\bnull\b|[{}[\]:,])/g):s==="css"?$e(t,/(\/\*.*?\*\/|#[\da-fA-F]{3,8}\b|--[\w-]+|[.#]?[\w-]+(?=\s*:)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b\d+(?:\.\d+)?(?:px|rem|em|%|vh|vw)?\b|[{}():;,])/g):s==="html"?$e(t,/(<!--.*?-->|<\/?[\w-]+|[\w:-]+(?==)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[<>/=])/g):s==="shell"?$e(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"?$e(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):$e(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 Gi(t){return/^\s{0,3}#{1,6}\s/.test(t)?[{text:t,kind:"keyword"}]:/^\s*[-*+]\s/.test(t)?[{text:t,kind:"property"}]:$e(t,/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)]+\)|https?:\/\/\S+)/g)}function Ki(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 $e(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:Ki(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:Vi(s,t).map((n,a)=>e.jsx("span",{className:`syntax-token ${n.kind}`,children:n.text},`${a}-${n.text}`))})}const qi=`
|
|
3
3
|
|
|
4
|
-
[file truncated]`,Xi=l.lazy(()=>Ca(()=>import("./WorkspaceMonacoEditor-
|
|
4
|
+
[file truncated]`,Xi=l.lazy(()=>Ca(()=>import("./WorkspaceMonacoEditor-6QNGzQUi.js").then(t=>t.jc),__vite__mapDeps([0,1,2,3]),import.meta.url)),Jt=6,Zi=18,Re=22,Zs=44,Qi=160,Qs=12;function Ct({path:t,workspaceName:s,workspaceRootPath:n,onSelectPath:a}){const i=ss(t,n),u=Sa(i),c=u?Yi(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(Na,{size:13}),a&&m&&!S?e.jsx("button",{type:"button",onClick:()=>a(k),children:o}):e.jsx("span",{children:o})]},`${x}-${o}`)})]})}function Yi(t){const s=/^[A-Za-z]:\//.exec(t);return s?s[0].slice(0,-1):"/"}function Ji({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:W,saveError:G,saving:U=!1,splitView:B=!1,wordDiffs:j=!1,wordWrap:R,workspaceName:T,workspaceRootPath:M}){Fe(u,{prefix:"File preview"}),Fe(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(qi),re=W&&z&&ts(c.path),le=z&&ya(c.path)&&ar(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(tr,{collapsed:t,file:c,hideWhiteSpace:f,onSelectBreadcrumbPath:k,wordDiffs:j,wordWrap:R,headerActions:h,workspaceName:T,workspaceRootPath:M}):e.jsx(er,{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(za,{content:A})}):le?e.jsx(sr,{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(Xi,{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 er({collapsed:t=!1,file:s,hideWhiteSpace:n=!1,wordWrap:a,workspaceName:i,workspaceRootPath:u,onSelectBreadcrumbPath:c,headerActions:f}){const h=l.useMemo(()=>dn(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(cn,{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 tr({collapsed:t,file:s,hideWhiteSpace:n,wordDiffs:a,wordWrap:i,workspaceName:u,workspaceRootPath:c,onSelectBreadcrumbPath:f,headerActions:h}){const m=l.useMemo(()=>dn(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(Xa,{size:14})]})]}),t?e.jsx("div",{className:"workspace-diff-code-empty",children:"Diff collapsed"}):e.jsx(cn,{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 sr({file:t,contentBase64:s}){const n=l.useMemo(()=>{const a=ir(s);if(!a)return null;const i=new Blob([new Uint8Array(a)],{type:nr(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:"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 nr(t){return/\.docx$/i.test(t)?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"application/msword"}function ar(t){return t.length>0&&/^[A-Za-z0-9+/=\s]+$/.test(t)}function ir(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 cn({ariaLabel:t,className:s,emptyMessage:n,rows:a,renderRow:i,wordWrap:u}){const c=!u&&a.length>Qi,{endIndex:f,offsetTop:h,scrollRef:m,startIndex:o,totalHeight:x}=rr(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 rr(t,s){const n=l.useRef(null),[a,i]=l.useState({height:Re*Zs,scrollTop:0}),u=l.useCallback(()=>{const m=n.current;m&&i({height:m.clientHeight||Re*Zs,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*Re};const c=Math.ceil(a.height/Re),f=Math.max(0,Math.floor(a.scrollTop/Re)-Qs);return{endIndex:Math.min(t,f+c+Qs*2),offsetTop:f*Re,scrollRef:n,startIndex:f,totalHeight:t*Re}}function dn(t,s){if(!t.trim())return[];const n=[];let a=0,i=0,u=null,c=null,f=!1,h=[];function m(){n.push(...lr(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 W=Math.max(E-u,_-c,0);W>0&&n.push({kind:"spacer",label:un(W)})}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 lr(t){if(t.length<Zi)return t;const s=t.length-Jt*2;return s<=0?t:[...t.slice(0,Jt),{kind:"spacer",label:un(s)},...t.slice(-Jt)]}function un(t){return`${t} unmodified ${t===1?"line":"lines"}`}const Rt=`
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Mt,a$ as Ye,r as m,b0 as qt,b1 as Ut,j as t,X as ut,b2 as we,b3 as Lt,b4 as Ne,G as Ft,a3 as at,S as Ot,a4 as Bt,aF as Dt,au as Gt,b5 as Tt,b6 as st,n as F,aD as kt,Z as Ht,C as Vt,a6 as Xt,b as Zt}from"./index-B8xSSlBW.js";import{G as Ze}from"./git-branch-D6gtbKJu.js";import{I as Jt}from"./info-z2hv9cD1.js";import{F as Kt,M as Qt}from"./monitor-DCUsiZyp.js";import{S as Yt,a as Wt}from"./square-BUG8bwGr.js";import{P as $e}from"./play-DCKc0E80.js";import{G as en}from"./git-commit-horizontal-C_GYw-SZ.js";import{R as Je}from"./refresh-cw-D6okuGLV.js";import{U as rt}from"./upload-DXI5er5D.js";const tn=[["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"}]],nn=Mt("hammer",tn);function an(e){const n=te(e?.data),a=te(n.preview);return(typeof a.url=="string"?a.url.trim():"")||null}function sn(){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 mt(e){const n=rn(e),a=ln(te(e?.resources)),i=te(te(e?.inputs).schema),g=te(i.properties),u=new Set(bt(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",H=te(c.items),z=pn(c,U),v=c.format==="file"||U.enabled===!0||I==="array"&&H.format==="file",M=typeof c.title=="string"&&c.title.trim()?c.title.trim():xn(p);if(v){x.push({name:p,label:M,required:u.has(p),multiple:I==="array"||U.multiple===!0,accept:gn(U,c),targetPath:bn(U,p),targetNames:z});continue}(I==="string"||I==="number"||I==="integer"||I==="boolean")&&l.push({name:p,label:M,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:cn(e),resources:a,volumes:on(e,x),schedules:dn(e)}}function Oe(e,n){const a=n.trim();return e.filter(i=>!i.targetNames||i.targetNames.length===0?!0:i.targetNames.includes(a))}function rn(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 ln(e){return{cpu:Ke(e.cpu)??1,memoryGb:Ke(e.memoryGb)??1,diskGb:Ke(e.diskGb)??8}}function on(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 cn(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 dn(e){return e?.schedules?.length?e.schedules.flatMap(n=>{const a=typeof n.name=="string"?n.name.trim():"",i=un(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:mn(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 un(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 mn(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 pt(e,n){return e.flatMap(a=>{const i=(n[a.name]??"").trim();return i?[{name:a.name,secretRef:i}]:[]})}function gt(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 pn(e,n){const a=e["x-openpond-targets"]??e.xOpenPondTargets??n.targets??n.actions,i=bt(a).map(g=>g.trim()).filter(Boolean);return i.length>0?[...new Set(i)]:null}function gn(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 bn(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 Ke(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 fn(e,n){return[n,...e.slice(1)]}function bt(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}function xn(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 hn({busy:e,defaultRepoUrl:n,projectName:a,commitBeforeCreate:i,templateManifest:g,uploadBeforeCreate:u,onClose:l,onSubmit:x}){const p=m.useMemo(()=>mt(g),[g]),N=p.entrypoints[0]??null,[c,U]=m.useState(n),[I,H]=m.useState(N?.name??""),[z,v]=m.useState(N?.command??""),[M,V]=m.useState(N?.timeoutSeconds?String(N.timeoutSeconds):""),[X,b]=m.useState(`Update ${a}`),[j,w]=m.useState("0.05"),[_,O]=m.useState(()=>Object.fromEntries(p.scalarInputs.map(r=>[r.name,r.defaultValue]))),[B,ae]=m.useState(()=>Object.fromEntries(p.envInputs.map(r=>[r.name,""]))),[Q,fe]=m.useState({}),J=p.volumes[0]??null,[Y,o]=m.useState(p.volumes.length>0||p.fileInputs.length>0),[P,A]=m.useState(J?.name??"volume"),[R,$]=m.useState(J?.mountPath??"/workspace/volumes/volume"),[Z,ce]=m.useState(String(J?.storageGb??8)),[Pe,de]=m.useState(!(J?.deleteOnSandboxDelete??!1)),[q,ze]=m.useState(p.schedules),Me=p.entrypoints.find(r=>r.name===I)??N,se=Me?.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(Z),le=Number(M),ke=!M.trim()||Number.isInteger(le)&&le>0&&le<=86400,oe=!ue||Number.isInteger(D)&&D>=qt&&D<=Ut&&se.some(r=>r.port===D),Ie=Number.isFinite(he)&&he>0,ne=!Y||Number.isInteger(ie)&&ie>0,G=q.every(r=>!r.enabled||!!r.scheduleExpression.trim()),W=Oe(p.scalarInputs,I),je=Oe(p.fileInputs,I),qe=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||(Q[r.name]?.length??0)>0)&&qe&&G&&oe;function He(r){H(r);const f=p.entrypoints.find(E=>E.name===r);if(!f)return;v(f.command),V(f.timeoutSeconds?String(f.timeoutSeconds):"");const y=f.ports[0]??null;me(y?String(y.port):""),xe(!!y)}function _e(r,f){O(y=>({...y,[r]:f}))}function pe(r,f){ae(y=>({...y,[r]:f}))}function Ve(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:gt(W,_),env:pt(p.envInputs,B),timeoutSeconds:M.trim()&&Number.isInteger(le)?le:Me?.timeoutSeconds??null,uploads:je.flatMap(f=>{const y=Q[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?fn(p.volumes,{...P.trim()?{name:P.trim()}:{},...R.trim()?{mountPath:R.trim()}:{},...Number.isInteger(ie)&&ie>0?{storageGb:ie}:{},deleteOnSandboxDelete:!Pe}):[],schedules:q.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(ut,{size:15})}),t.jsxs("div",{className:"sandbox-start-dialog-heading",children:[t.jsx("div",{className:"git-dialog-icon",children:t.jsx(we,{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=>He(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:M,onChange:r=>V(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=>Ve(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=>A(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:Z,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,q.length>0?t.jsxs("div",{className:"sandbox-start-schedules",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Schedules"}),q.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=>w(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:qe?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx(Lt,{size:14}),"Start"]})]})]})})}function jn({busy:e,projectName:n,templateManifest:a,onClose:i,onSubmit:g}){const u=m.useMemo(()=>mt(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,H]=m.useState(()=>Object.fromEntries(u.scalarInputs.map(o=>[o.name,o.defaultValue]))),[z,v]=m.useState(()=>Object.fromEntries(u.envInputs.map(o=>[o.name,""]))),[M,V]=m.useState({}),X=Oe(u.scalarInputs,c),b=Oe(u.fileInputs,c),j=p==="sandbox"?u.envInputs:[],w=X.every(o=>!o.required||!!(I[o.name]??"").trim()),_=b.every(o=>!o.required||(M[o.name]?.length??0)>0),O=j.every(o=>!o.required||!!(z[o.name]??"").trim()),B=j.filter(o=>o.required&&!(z[o.name]??"").trim()),ae=!!c&&w&&_&&O;function Q(o,P){H(A=>({...A,[o]:P}))}function fe(o,P){v(A=>({...A,[o]:P}))}function J(o,P,A){const R=Array.from(A.target.files??[]);V($=>({...$,[o]:P?R:R.slice(0,1)}))}function Y(o){o.preventDefault(),!(!ae||e)&&g({mode:p,target:c,params:gt(X,I),env:p==="sandbox"?pt(j,z):[],uploads:b.flatMap(P=>{const A=M[P.name]??[];return A.length>0?[{inputName:P.name,label:P.label,targetPath:P.targetPath,multiple:P.multiple,files:A}]:[]})})}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(ut,{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=>Q(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=>Q(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=>J(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]??"",A=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":A,disabled:e,placeholder:"openpond://secret/...",value:P,onChange:$=>fe(o.name,$.target.value)}),t.jsx("small",{id:R,children:A?"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:O?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx($e,{size:14}),"Run"]})]})]})})}function ft(e,n){const a=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"agent";return n==="cron"?`name: ${a}
|
|
1
|
+
import{c as Mt,a$ as Ye,r as m,b0 as qt,b1 as Ut,j as t,X as ut,b2 as we,b3 as Lt,b4 as Ne,G as Ft,a3 as at,S as Ot,a4 as Bt,aF as Dt,au as Gt,b5 as Tt,b6 as st,n as F,aD as kt,Z as Ht,C as Vt,a6 as Xt,b as Zt}from"./index-Ure41UF0.js";import{G as Ze}from"./git-branch-CaVUghsI.js";import{I as Jt}from"./info-dTkimobU.js";import{F as Kt,M as Qt}from"./monitor-POfnZCWw.js";import{S as Yt,a as Wt}from"./square-B00f_944.js";import{P as $e}from"./play-CjWTsI9z.js";import{G as en}from"./git-commit-horizontal-oiDAVV_Y.js";import{R as Je}from"./refresh-cw-CeHT_tXT.js";import{U as rt}from"./upload-DK0-5jXz.js";const tn=[["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"}]],nn=Mt("hammer",tn);function an(e){const n=te(e?.data),a=te(n.preview);return(typeof a.url=="string"?a.url.trim():"")||null}function sn(){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 mt(e){const n=rn(e),a=ln(te(e?.resources)),i=te(te(e?.inputs).schema),g=te(i.properties),u=new Set(bt(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",H=te(c.items),z=pn(c,U),v=c.format==="file"||U.enabled===!0||I==="array"&&H.format==="file",M=typeof c.title=="string"&&c.title.trim()?c.title.trim():xn(p);if(v){x.push({name:p,label:M,required:u.has(p),multiple:I==="array"||U.multiple===!0,accept:gn(U,c),targetPath:bn(U,p),targetNames:z});continue}(I==="string"||I==="number"||I==="integer"||I==="boolean")&&l.push({name:p,label:M,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:cn(e),resources:a,volumes:on(e,x),schedules:dn(e)}}function Oe(e,n){const a=n.trim();return e.filter(i=>!i.targetNames||i.targetNames.length===0?!0:i.targetNames.includes(a))}function rn(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 ln(e){return{cpu:Ke(e.cpu)??1,memoryGb:Ke(e.memoryGb)??1,diskGb:Ke(e.diskGb)??8}}function on(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 cn(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 dn(e){return e?.schedules?.length?e.schedules.flatMap(n=>{const a=typeof n.name=="string"?n.name.trim():"",i=un(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:mn(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 un(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 mn(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 pt(e,n){return e.flatMap(a=>{const i=(n[a.name]??"").trim();return i?[{name:a.name,secretRef:i}]:[]})}function gt(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 pn(e,n){const a=e["x-openpond-targets"]??e.xOpenPondTargets??n.targets??n.actions,i=bt(a).map(g=>g.trim()).filter(Boolean);return i.length>0?[...new Set(i)]:null}function gn(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 bn(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 Ke(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 fn(e,n){return[n,...e.slice(1)]}function bt(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}function xn(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 hn({busy:e,defaultRepoUrl:n,projectName:a,commitBeforeCreate:i,templateManifest:g,uploadBeforeCreate:u,onClose:l,onSubmit:x}){const p=m.useMemo(()=>mt(g),[g]),N=p.entrypoints[0]??null,[c,U]=m.useState(n),[I,H]=m.useState(N?.name??""),[z,v]=m.useState(N?.command??""),[M,V]=m.useState(N?.timeoutSeconds?String(N.timeoutSeconds):""),[X,b]=m.useState(`Update ${a}`),[j,w]=m.useState("0.05"),[_,O]=m.useState(()=>Object.fromEntries(p.scalarInputs.map(r=>[r.name,r.defaultValue]))),[B,ae]=m.useState(()=>Object.fromEntries(p.envInputs.map(r=>[r.name,""]))),[Q,fe]=m.useState({}),J=p.volumes[0]??null,[Y,o]=m.useState(p.volumes.length>0||p.fileInputs.length>0),[P,A]=m.useState(J?.name??"volume"),[R,$]=m.useState(J?.mountPath??"/workspace/volumes/volume"),[Z,ce]=m.useState(String(J?.storageGb??8)),[Pe,de]=m.useState(!(J?.deleteOnSandboxDelete??!1)),[q,ze]=m.useState(p.schedules),Me=p.entrypoints.find(r=>r.name===I)??N,se=Me?.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(Z),le=Number(M),ke=!M.trim()||Number.isInteger(le)&&le>0&&le<=86400,oe=!ue||Number.isInteger(D)&&D>=qt&&D<=Ut&&se.some(r=>r.port===D),Ie=Number.isFinite(he)&&he>0,ne=!Y||Number.isInteger(ie)&&ie>0,G=q.every(r=>!r.enabled||!!r.scheduleExpression.trim()),W=Oe(p.scalarInputs,I),je=Oe(p.fileInputs,I),qe=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||(Q[r.name]?.length??0)>0)&&qe&&G&&oe;function He(r){H(r);const f=p.entrypoints.find(E=>E.name===r);if(!f)return;v(f.command),V(f.timeoutSeconds?String(f.timeoutSeconds):"");const y=f.ports[0]??null;me(y?String(y.port):""),xe(!!y)}function _e(r,f){O(y=>({...y,[r]:f}))}function pe(r,f){ae(y=>({...y,[r]:f}))}function Ve(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:gt(W,_),env:pt(p.envInputs,B),timeoutSeconds:M.trim()&&Number.isInteger(le)?le:Me?.timeoutSeconds??null,uploads:je.flatMap(f=>{const y=Q[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?fn(p.volumes,{...P.trim()?{name:P.trim()}:{},...R.trim()?{mountPath:R.trim()}:{},...Number.isInteger(ie)&&ie>0?{storageGb:ie}:{},deleteOnSandboxDelete:!Pe}):[],schedules:q.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(ut,{size:15})}),t.jsxs("div",{className:"sandbox-start-dialog-heading",children:[t.jsx("div",{className:"git-dialog-icon",children:t.jsx(we,{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=>He(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:M,onChange:r=>V(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=>Ve(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=>A(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:Z,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,q.length>0?t.jsxs("div",{className:"sandbox-start-schedules",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Schedules"}),q.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=>w(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:qe?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx(Lt,{size:14}),"Start"]})]})]})})}function jn({busy:e,projectName:n,templateManifest:a,onClose:i,onSubmit:g}){const u=m.useMemo(()=>mt(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,H]=m.useState(()=>Object.fromEntries(u.scalarInputs.map(o=>[o.name,o.defaultValue]))),[z,v]=m.useState(()=>Object.fromEntries(u.envInputs.map(o=>[o.name,""]))),[M,V]=m.useState({}),X=Oe(u.scalarInputs,c),b=Oe(u.fileInputs,c),j=p==="sandbox"?u.envInputs:[],w=X.every(o=>!o.required||!!(I[o.name]??"").trim()),_=b.every(o=>!o.required||(M[o.name]?.length??0)>0),O=j.every(o=>!o.required||!!(z[o.name]??"").trim()),B=j.filter(o=>o.required&&!(z[o.name]??"").trim()),ae=!!c&&w&&_&&O;function Q(o,P){H(A=>({...A,[o]:P}))}function fe(o,P){v(A=>({...A,[o]:P}))}function J(o,P,A){const R=Array.from(A.target.files??[]);V($=>({...$,[o]:P?R:R.slice(0,1)}))}function Y(o){o.preventDefault(),!(!ae||e)&&g({mode:p,target:c,params:gt(X,I),env:p==="sandbox"?pt(j,z):[],uploads:b.flatMap(P=>{const A=M[P.name]??[];return A.length>0?[{inputName:P.name,label:P.label,targetPath:P.targetPath,multiple:P.multiple,files:A}]:[]})})}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(ut,{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=>Q(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=>Q(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=>J(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]??"",A=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":A,disabled:e,placeholder:"openpond://secret/...",value:P,onChange:$=>fe(o.name,$.target.value)}),t.jsx("small",{id:R,children:A?"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:O?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx($e,{size:14}),"Run"]})]})]})})}function ft(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,G as z,X as _}from"./index-
|
|
1
|
+
import{j as e,G as z,X as _}from"./index-Ure41UF0.js";/* empty css */import{C as D}from"./cloud-upload-Cc_ZQEAm.js";import{G as j}from"./git-branch-CaVUghsI.js";import{G as h}from"./git-commit-horizontal-oiDAVV_Y.js";import{U as G}from"./upload-DK0-5jXz.js";function F({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(G,{size:14}),label:"Commit & push",disabled:t||!u,onSelect:()=>r("commit_push")}),b&&e.jsx(d,{active:a==="commit_publish",icon:e.jsx(D,{size:14}),label:"Commit & publish",disabled:t,onSelect:()=>r("commit_publish")}),e.jsx(d,{active:a==="commit_pr",icon:e.jsx(z,{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 H({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(_,{size:16})})}export{H as BranchDialog,F as CommitDialog};
|