openpond 0.2.14 → 0.2.15

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.
Files changed (116) hide show
  1. package/dist/app-server.d.ts +22 -0
  2. package/dist/app-server.js +1 -1
  3. package/dist/chunks/{actions-command-Q5HXY5XD.js → actions-command-33SJXJKC.js} +1 -1
  4. package/dist/chunks/{app-layer-S6H572UM.js → app-layer-SSLVAUNI.js} +1 -1
  5. package/dist/chunks/app-server-runtime-QUC4HPQU.js +2 -0
  6. package/dist/chunks/{apps-K5HMFAPI.js → apps-JEKTEGSW.js} +1 -1
  7. package/dist/chunks/{chunk-ZZWAUD7I.js → chunk-4E5ETWKU.js} +318 -313
  8. package/dist/chunks/{chunk-BVYAP3M6.js → chunk-7I73OREC.js} +1 -1
  9. package/dist/chunks/{chunk-I4FOBNHQ.js → chunk-A2PIGBPD.js} +15 -15
  10. package/dist/chunks/chunk-DWROB2J6.js +19 -0
  11. package/dist/chunks/chunk-FHBQ6OWG.js +26 -0
  12. package/dist/chunks/{chunk-NYPLOXEP.js → chunk-JTQDNX2J.js} +1 -1
  13. package/dist/chunks/{chunk-ECH6PXVK.js → chunk-K4ZKAHLG.js} +1 -1
  14. package/dist/chunks/{chunk-3GLSX322.js → chunk-QLZ67Y6C.js} +2 -2
  15. package/dist/chunks/{chunk-OW4KET6I.js → chunk-TWA56GFU.js} +1 -1
  16. package/dist/chunks/{chunk-R33VLNFY.js → chunk-UN3A7GEU.js} +1 -1
  17. package/dist/chunks/{chunk-3V5FPSOK.js → chunk-UOQHYTCK.js} +1 -1
  18. package/dist/chunks/{chunk-ZMRT4B4H.js → chunk-VRXXKDF2.js} +9 -9
  19. package/dist/chunks/{chunk-O7SI3RQJ.js → chunk-YNXFXNQM.js} +1 -1
  20. package/dist/chunks/{chunk-Q3KAKIVM.js → chunk-ZYG2PXY2.js} +1 -1
  21. package/dist/chunks/{cli-2BUMKLMW.js → cli-7YSRAC4Y.js} +1 -1
  22. package/dist/chunks/{configuration-command-Q7XVBZ2E.js → configuration-command-DH4ZZUKL.js} +1 -1
  23. package/dist/chunks/{core-commands-6GZ7T4SK.js → core-commands-TUUSA6WB.js} +1 -1
  24. package/dist/chunks/{desktop-test-EKPOPWTL.js → desktop-test-S3RME4QT.js} +1 -1
  25. package/dist/chunks/extension-D64BYPFY.js +6 -0
  26. package/dist/chunks/{help-MTWG7AXZ.js → help-AOVE3SSY.js} +1 -1
  27. package/dist/chunks/{opchat-4QGK6MRL.js → opchat-KC2FL5TT.js} +1 -1
  28. package/dist/chunks/{organizations-TTUM577J.js → organizations-AAES2P7W.js} +1 -1
  29. package/dist/chunks/{profile-C33CIJOV.js → profile-FRYWK2IE.js} +1 -1
  30. package/dist/chunks/{project-agent-5P3ALPRY.js → project-agent-WPW6DWK7.js} +1 -1
  31. package/dist/chunks/{sandbox-command-CEIXSDW2.js → sandbox-command-ZHKJZ3FJ.js} +1 -1
  32. package/dist/chunks/{sandbox-template-KTKWVKZ7.js → sandbox-template-SPVQIMG5.js} +1 -1
  33. package/dist/chunks/{src-SKYU7PDL.js → src-AADCZ2JW.js} +2 -2
  34. package/dist/chunks/{src-ZAF6VEWJ.js → src-LYFCDA5G.js} +1 -1
  35. package/dist/chunks/{teams-bot-O7IFQ3L6.js → teams-bot-LD3QORJI.js} +1 -1
  36. package/dist/chunks/{workspaces-MXYF6QTH.js → workspaces-P2WNCMXC.js} +1 -1
  37. package/dist/cli.js +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/web/assets/{App-BqgpZNh-.js → App-kwt-UxX_.js} +30 -30
  40. package/dist/web/assets/{AppDialog-BCzsyF8y.js → AppDialog-LXQo_7oW.js} +1 -1
  41. package/dist/web/assets/{AppTerminalPanel-Cqtaoc93.js → AppTerminalPanel-CUqrUrkA.js} +2 -2
  42. package/dist/web/assets/{AppsView-BHz8ruGV.js → AppsView-5J2RX301.js} +1 -1
  43. package/dist/web/assets/{BrowserSidebar-vrHh2y_s.js → BrowserSidebar-mZ8RjUOr.js} +1 -1
  44. package/dist/web/assets/{CartesianChart-C5PgQkxh.js → CartesianChart-7x3SO8Hj.js} +1 -1
  45. package/dist/web/assets/{CollaborationTabs-OSqxEZgD.js → CollaborationTabs-ByC9WJqu.js} +1 -1
  46. package/dist/web/assets/{CommandMenu-XMeH3T6m.js → CommandMenu-CqDb2Kb2.js} +1 -1
  47. package/dist/web/assets/{CommunityView-BPsy_BnG.js → CommunityView-BmxYkWqC.js} +1 -1
  48. package/dist/web/assets/{ComposerCreateImproveStrip-Bsh9eyj1.js → ComposerCreateImproveStrip-2Tyj9KOQ.js} +1 -1
  49. package/dist/web/assets/{GetStartedView-Ay67q9mX.js → GetStartedView-1WYkmevY.js} +1 -1
  50. package/dist/web/assets/HostedModelLearningReview-DHahsQJH.js +1 -0
  51. package/dist/web/assets/{HostedModelLearningSettings-MG_1VD7H.js → HostedModelLearningSettings-Brza5hSD.js} +1 -1
  52. package/dist/web/assets/{LabModelVersionDetailPage-CPkCZhBg.js → LabModelVersionDetailPage-C4WtQKER.js} +1 -1
  53. package/dist/web/assets/{LabSkillSidebar-Y06Ghxe7.js → LabSkillSidebar-D3g6E0Ap.js} +1 -1
  54. package/dist/web/assets/{LabsRoute-CBy4evwc.js → LabsRoute-BO0yEsCR.js} +4 -4
  55. package/dist/web/assets/{MainChatThread-CqG9WewR.js → MainChatThread-CKPR_rY0.js} +2 -2
  56. package/dist/web/assets/{MainPane-CQVCd0hz.js → MainPane-B8mDzSqi.js} +4 -4
  57. package/dist/web/assets/{MarkdownText-BSXFJB5s.js → MarkdownText-D6_UI4Ly.js} +1 -1
  58. package/dist/web/assets/{Messages-CcKLreir.js → Messages-DptbENmQ.js} +1 -1
  59. package/dist/web/assets/{NativeSkillSidebar-BF4T1Tuy.js → NativeSkillSidebar-CF1NTAR6.js} +1 -1
  60. package/dist/web/assets/{NewExperienceSwitcher-BH2-_iQt.js → NewExperienceSwitcher-CwlpLsXW.js} +1 -1
  61. package/dist/web/assets/{NewProjectDialog-BSkPgqLX.js → NewProjectDialog-Ls4K9a5S.js} +1 -1
  62. package/dist/web/assets/{OutputsPage-DBAfj1e_.js → OutputsPage-ClNuidPW.js} +1 -1
  63. package/dist/web/assets/{ProjectsPage-DOTViI5-.js → ProjectsPage-Sj83NsdP.js} +1 -1
  64. package/dist/web/assets/{RightChatPanelStack-D3wuMm3F.js → RightChatPanelStack-m5-cI0NL.js} +1 -1
  65. package/dist/web/assets/{RightSidebarHomePanel-DLP1LFoX.js → RightSidebarHomePanel-B--t--OJ.js} +1 -1
  66. package/dist/web/assets/{ScheduledWorkPage-BETU42Pi.js → ScheduledWorkPage-JVfMtGMs.js} +1 -1
  67. package/dist/web/assets/{SettingsView-D2eKwMH6.js → SettingsView-B7FnZ-b0.js} +6 -6
  68. package/dist/web/assets/{TeamChatView-ytGArG3p.js → TeamChatView-D8ilbncz.js} +1 -1
  69. package/dist/web/assets/{TerminalOverlay-FV-T6Vk6.js → TerminalOverlay-A6nSxm5C.js} +1 -1
  70. package/dist/web/assets/{TrainingCreationPanel-D7UhsNpa.js → TrainingCreationPanel-CwpnBbuN.js} +1 -1
  71. package/dist/web/assets/{TrainingDraftPanel-BZ4ZhYbm.js → TrainingDraftPanel-B_Gh_0yq.js} +1 -1
  72. package/dist/web/assets/{UsageSettingsSection-Ml9cMCUi.js → UsageSettingsSection-qTX3k9-f.js} +1 -1
  73. package/dist/web/assets/{WorkSidebarPanel-DZZK0_vI.js → WorkSidebarPanel-B-fDRRRs.js} +1 -1
  74. package/dist/web/assets/{WorkspaceDiffPanel-CSLiV2LC.js → WorkspaceDiffPanel-CfvvifJg.js} +3 -3
  75. package/dist/web/assets/{WorkspaceEnvironmentMenu-dqDA6sik.js → WorkspaceEnvironmentMenu-BL6WHWLO.js} +1 -1
  76. package/dist/web/assets/{WorkspaceGitDialogs-C9ptN_7-.js → WorkspaceGitDialogs-pyZQJL_2.js} +1 -1
  77. package/dist/web/assets/{WorkspaceMonacoEditor-BOa6xAaO.js → WorkspaceMonacoEditor-C2cNf0UO.js} +3 -3
  78. package/dist/web/assets/{arrow-up-right-Qq_YNPUt.js → arrow-up-right-BQv8RCGD.js} +1 -1
  79. package/dist/web/assets/{chat-file-links-z54bmvhH.js → chat-file-links-C3erG0P2.js} +1 -1
  80. package/dist/web/assets/chevron-up-D9MMQKU3.js +1 -0
  81. package/dist/web/assets/{clipboard-C_cLfHiu.js → clipboard-BSPYX7yq.js} +1 -1
  82. package/dist/web/assets/{cloud-upload-B1A_725d.js → cloud-upload-CJVhhG6P.js} +1 -1
  83. package/dist/web/assets/{cssMode-DKjB86V7.js → cssMode-RCJXPUO-.js} +1 -1
  84. package/dist/web/assets/{folder-open-BAqrqIkA.js → folder-open-2a5riVSG.js} +1 -1
  85. package/dist/web/assets/{folder-plus-Aw6rEy1D.js → folder-plus-DuVvIFve.js} +1 -1
  86. package/dist/web/assets/{git-commit-horizontal-75RSWQ3Q.js → git-commit-horizontal-BifoV1dR.js} +1 -1
  87. package/dist/web/assets/{htmlMode-CH03ACqd.js → htmlMode-DnEOXzjT.js} +1 -1
  88. package/dist/web/assets/{index-C0gdp_hv.js → index-B5RqBp_p.js} +2 -2
  89. package/dist/web/assets/{info-CXzXdZ1o.js → info-BWvLCbJ2.js} +1 -1
  90. package/dist/web/assets/{jsonMode-Bvmzl5ln.js → jsonMode-DQfml7E4.js} +1 -1
  91. package/dist/web/assets/{lspLanguageFeatures-BKXLyuIE.js → lspLanguageFeatures-WKs-7xHz.js} +1 -1
  92. package/dist/web/assets/{minimize-2-C-6SC3Bs.js → minimize-2-C-_iqAbt.js} +1 -1
  93. package/dist/web/assets/{monaco.contribution-BwSCuTR3.js → monaco.contribution-B29c98Aa.js} +2 -2
  94. package/dist/web/assets/{monaco.contribution-BON5T_eJ.js → monaco.contribution-B5y78DUP.js} +2 -2
  95. package/dist/web/assets/{monaco.contribution-Cv_QTWVQ.js → monaco.contribution-DCekL-SI.js} +2 -2
  96. package/dist/web/assets/{monaco.contribution-rtAnmt_x.js → monaco.contribution-Qc1u700n.js} +2 -2
  97. package/dist/web/assets/{play-BnkiBq8x.js → play-DsP3gpGK.js} +1 -1
  98. package/dist/web/assets/{python-Rd5MxRAN.js → python-CJ1QdM8L.js} +1 -1
  99. package/dist/web/assets/{refresh-cw-BISaiIBt.js → refresh-cw-DaASy_i0.js} +1 -1
  100. package/dist/web/assets/{save-BcVbYiGU.js → save-BBQ7L8VS.js} +1 -1
  101. package/dist/web/assets/{square-Bn32OIid.js → square-DTl9YrMp.js} +1 -1
  102. package/dist/web/assets/{toggleHighContrast-DDw4wPS9.js → toggleHighContrast-D-DNRZ-D.js} +1 -1
  103. package/dist/web/assets/{tsMode-Dt73U5ww.js → tsMode-CmWbxnjM.js} +1 -1
  104. package/dist/web/assets/{upload-AB1N3bCZ.js → upload-juEp2zRQ.js} +1 -1
  105. package/dist/web/assets/{useLocalAgentSchedules-D7QTyYKj.js → useLocalAgentSchedules-DF_bIseW.js} +1 -1
  106. package/dist/web/assets/{wifi-off-BAX1UWLx.js → wifi-off-DrkIaS1O.js} +1 -1
  107. package/dist/web/assets/{workers-DE3-vPyS.js → workers-LygfviY3.js} +1 -1
  108. package/dist/web/assets/{yaml-C0JBPZbg.js → yaml-BIpimtDQ.js} +1 -1
  109. package/dist/web/index.html +1 -1
  110. package/package.json +1 -1
  111. package/dist/chunks/app-server-runtime-BHZQNP3K.js +0 -2
  112. package/dist/chunks/chunk-3YH3S5U2.js +0 -26
  113. package/dist/chunks/chunk-BB6DJKXX.js +0 -19
  114. package/dist/chunks/extension-A2BWJMRQ.js +0 -6
  115. package/dist/web/assets/HostedModelLearningReview-C8PfSxcz.js +0 -1
  116. package/dist/web/assets/chevron-up-CIrVx_eP.js +0 -1
@@ -1,7 +1,7 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WorkspaceMonacoEditor-BOa6xAaO.js","./index-C0gdp_hv.js","./index-C5EoPZr0.css","./WorkspaceMonacoEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
2
- import{j as e,r as l,_ as fa}from"./index-C0gdp_hv.js";import{c as be,m as lt,bm as Ws,aO as nn,aB as Ee,v as W,bn as $t,b3 as Ft,aX as Oe,bo as pa,at as ha,bp as ma,au as xa,F as ba,B as an,h as ga,X as Is,P as ja,av as va,aq as ka,aW as wa,bl as ya,bq as Sa,a$ as Bs,br as Na,bs as ts,bt as Ca,bu as ss,bv as Ra,f as $a,w as rn,t as Fa,bw as Qt,bx as Ea,by as ns,bz as Ce,bA as Aa,bB as Os,bC as Pa,bD as La,bE as Us,bF as Da,bG as Ta}from"./App-BqgpZNh-.js";import{M as _a,u as Hs,I as Ma}from"./MarkdownText-BSXFJB5s.js";import{R as as}from"./refresh-cw-BISaiIBt.js";import{T as za,F as Wa,a as Ia}from"./chat-file-links-z54bmvhH.js";import{t as Ba,a as Oa,b as Ua,m as Ha,s as Va,d as Ga,f as Ka,c as qa}from"./training-model-data-CKOkpBBL.js";import{F as yt}from"./folder-open-BAqrqIkA.js";import{I as Vs}from"./info-CXzXdZ1o.js";import{M as Xa}from"./minimize-2-C-6SC3Bs.js";import{S as Za}from"./save-BcVbYiGU.js";import{C as Qa}from"./clipboard-C_cLfHiu.js";import{C as Ya}from"./chevron-up-CIrVx_eP.js";const Ja=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],ei=be("text-align-start",Ja);const ti=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],si=be("chevrons-up",ti);const ni=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ai=be("columns-2",ni);const ii=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ri=be("eye-off",ii);const li=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],oi=be("panel-top",li);const ci=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],di=be("plug",ci);const ui=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],fi=be("redo-2",ui);const pi=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],hi=be("undo-2",pi);function mi({createRuntime:t,goalRuntime:s,subagentRuntime:n=null,onRunSubagentLifecycleAction:a}){const i=t?"Create/Improve Details":"Goal Details",u=t?Z(t.run.state):n?.activeCount?n.label:s?.actionLabel??"No active goal";return e.jsxs("div",{className:"goal-details-view","aria-label":i,children:[e.jsxs("div",{className:"goal-details-header",children:[e.jsxs("div",{className:"goal-details-title",children:[e.jsx(lt,{size:15,"aria-hidden":"true"}),e.jsx("span",{children:i})]}),e.jsx("span",{className:`goal-details-state ${Di(t?.run.state??null)}`,children:u})]}),e.jsx("div",{className:"goal-details-body",children:t?e.jsx(xi,{runtime:t}):s||n?e.jsx(gi,{goalRuntime:s,subagentRuntime:n,onRunSubagentLifecycleAction:a}):e.jsx(Li,{})})]})}function xi({runtime:t}){const s=t.run,n=s.plan,a=Ws(n?.metadata)??Ws(s.metadata),i=s.questions,u=i.filter(o=>o.status==="pending"),c=s.sourceRefs,f=s.checkRefs,h=s.state,m=s.target.kind==="agent"?s.target.defaultActionKey:null;return e.jsxs(e.Fragment,{children:[e.jsx(V,{title:"Current Work",children:e.jsx(it,{rows:[["State",Z(h)],["Operation",s.operation],["Target",Z(s.target.kind)],["Name",s.target.displayName??s.target.id??"Pending"],["Target ID",s.target.id??"Pending"],["Default action",m??n?.defaultChatAction.key??"Pending"],["Adapter",Z(s.adapter.kind)],["Run",s.id],["Revision",String(s.revision)]]})}),e.jsx(V,{title:"Plan",children:n?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"goal-details-summary",children:n.summary}),e.jsx(it,{rows:[["Objective",n.objective],["Context",n.capturedContextSummary],["Status",Z(n.status)],["Plan ID",n.id],["Run ID",n.runId],["Approval",n.approvalId??"Pending"],["Approved",n.approvedAt??"Not approved"]]})]}):u.length?e.jsx("p",{className:"goal-details-summary",children:"Waiting for answers before the model finalizes the Create plan."}):e.jsx("p",{className:"goal-details-summary",children:"The model is preparing the Create plan."})}),a?e.jsxs(V,{title:"Action Shape",children:[e.jsx(it,{rows:[["Mode",a.label],["Default action",a.defaultActionKey??"None"],["Direct action",a.directActionHint??"None planned"],["Artifacts",a.artifactPolicy]]}),e.jsx("p",{className:"goal-details-note",children:a.detail})]}):null,i.length?e.jsx(V,{title:"Questions",children:e.jsx("div",{className:"goal-details-list",children:i.map(o=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.title}),e.jsx("span",{className:`goal-details-inline-state ${o.status}`,children:Z(o.status)})]}),e.jsx("p",{children:o.prompt}),o.answer?e.jsxs("small",{children:["Answer: ",o.answer.label??o.answer.value]}):o.options.length?e.jsxs("small",{children:["Options: ",o.options.map(x=>x.label).join(", ")]}):null]},o.id))})}):null,n?.requirements.length?e.jsx(V,{title:"Setup Requirements",children:e.jsx("div",{className:"goal-details-list",children:n.requirements.map(o=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.name}),e.jsx("span",{className:`goal-details-inline-state ${o.status}`,children:Z(o.status)})]}),e.jsxs("small",{children:[Z(o.kind),o.detail?`: ${o.detail}`:""]})]},`${o.kind}:${o.name}`))})}):null,n?.sourcePlan.length?e.jsx(V,{title:"Source Plan",children:e.jsx(wt,{refs:n.sourcePlan.map(o=>({id:`${o.operation}:${o.path}`,primary:o.path,secondary:`${Z(o.operation)}: ${o.reason}`}))})}):null,n?.checks.length?e.jsx(V,{title:"Checks",children:e.jsx(wt,{refs:n.checks.map(o=>({id:o.name,primary:o.name,secondary:`${o.required?"Required":"Optional"}: ${o.command}`}))})}):null,c.length||f.length?e.jsx(V,{title:"Run Refs",children:e.jsx(wt,{refs:[...c.map(o=>({id:`source:${o}`,primary:o,secondary:"Source ref"})),...f.map(o=>({id:`check:${o}`,primary:o,secondary:"Check ref"}))]})}):null,e.jsx(bi,{run:s}),s.blockedReason?e.jsx(V,{title:"Blocked",children:e.jsxs("div",{className:"goal-details-alert",children:[e.jsx(nn,{size:15}),e.jsx("span",{children:s.blockedReason})]})}):null,e.jsx(V,{title:"Raw State",children:e.jsxs("details",{className:"goal-details-raw",children:[e.jsx("summary",{children:"Show structured payload"}),e.jsx("pre",{children:JSON.stringify(s,null,2)})]})})]})}function bi({run:t}){const s=[...t.context.attachments.map(i=>({id:`attachment:${i.id??i.name}`,primary:i.name,secondary:i.ref??i.mediaType??"Attachment"})),...t.context.apps.map(i=>({id:`app:${i.id}`,primary:i.name,secondary:i.required?"Required app context":"Optional app context"})),...t.context.tools.map(i=>({id:`tool:${i.name}`,primary:i.name,secondary:i.outputSummary??i.inputSummary??"Tool context"})),...t.context.targetRepoAssumptions.map(i=>({id:`target:${i}`,primary:i,secondary:"Target assumption"}))],n=t.workflowCapture,a=n?[...n.files.map(i=>({id:`workflow-file:${i}`,primary:i,secondary:"Captured file"})),...n.outputArtifacts.map(i=>({id:`workflow-artifact:${i}`,primary:i,secondary:"Output artifact"})),...n.traceRefs.map(i=>({id:`workflow-trace:${i}`,primary:i,secondary:"Trace"}))]:[];return!s.length&&!a.length?null:e.jsx(V,{title:"Context",children:e.jsx(wt,{refs:[...s,...a]})})}function gi({goalRuntime:t,subagentRuntime:s,onRunSubagentLifecycleAction:n}){return e.jsxs(e.Fragment,{children:[t?e.jsxs(V,{title:"Goal",children:[e.jsx("p",{className:"goal-details-summary",children:t.objective}),e.jsx(it,{rows:[["Status",t.actionLabel],["Runtime",t.timeLabel],["Detail",t.detail]]})]}):null,s?e.jsx(ji,{runtime:s,onRunSubagentLifecycleAction:n}):null,e.jsx(V,{title:"Raw State",children:e.jsxs("details",{className:"goal-details-raw",children:[e.jsx("summary",{children:"Show structured payload"}),e.jsx("pre",{children:JSON.stringify({goalRuntime:t,subagentRuntime:s},null,2)})]})})]})}function ji({runtime:t,onRunSubagentLifecycleAction:s}){const[n,a]=l.useState(null),[i,u]=l.useState(null);Ee(i);const c=async(f,h)=>{if(!s)return;const m=`${f}:${h}`;a(m),u(null);try{await s({runId:f,action:h})}catch(o){u(o instanceof Error?o.message:String(o))}finally{a(o=>o===m?null:o)}};return e.jsxs(e.Fragment,{children:[e.jsxs(V,{title:"Subagents",children:[e.jsx(it,{rows:[["Latest update",Ci(t)],["Active",String(t.activeCount)],["Completed",String(t.completedCount)],["Failed",String(t.failedCount)],["Cancelled",String(t.cancelledCount)],["Paused",String(t.needsResumeCount)],["Terminal",String(t.terminalCount)],["Usage",Ri(t.usage.totalTokens,t.usage.requestCount)],["Evidence",String(t.evidenceRefs.length)],["Checks",String(t.testsRunCount)]]}),t.blockers.length>0?e.jsx("ul",{className:"goal-details-list compact",children:t.blockers.slice(0,4).map(f=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${f.status}`,children:f.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(f.roleId)}),e.jsx("p",{children:f.message})]})]},`${f.runId}:${f.message}`))}):null,e.jsx("ul",{className:"goal-details-list",children:t.runs.slice(0,8).map(f=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${f.status}`,children:f.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(f.roleId)}),e.jsx("p",{children:f.objective}),f.report?.summary?e.jsx("small",{children:f.report.summary}):null,s?e.jsx(ki,{pendingAction:n,run:f,onRun:c}):null]})]},f.id))})]}),t.finalResults.length>0?e.jsx(vi,{results:t.finalResults}):null]})}function vi({results:t}){return e.jsx(V,{title:"Child Results",children:e.jsx("ol",{className:"goal-details-task-graph",children:t.slice(0,6).map(s=>e.jsxs("li",{className:"goal-details-task-node",children:[e.jsxs("div",{className:"goal-details-task-node-header",children:[e.jsx("span",{className:`goal-details-inline-state ${s.status}`,children:s.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(s.roleId)}),e.jsx("small",{children:s.objective})]})]}),e.jsx("p",{children:s.summary}),e.jsxs("div",{className:"goal-details-task-node-meta",children:[e.jsxs("span",{children:[s.refs.length," refs"]}),e.jsxs("span",{children:[s.testsRun.length+s.validationAttempts.length," checks"]}),e.jsxs("span",{children:[s.blockers.length," blockers"]}),e.jsx("span",{children:s.confidence?`${Z(s.confidence)} confidence`:"Confidence unknown"})]}),s.findings.length>0?e.jsxs("small",{children:["Findings: ",Re(s.findings,3)]}):null,s.changedFiles.length>0?e.jsxs("small",{children:["Files: ",Re(s.changedFiles,4)]}):null,s.testsRun.length>0?e.jsxs("small",{children:["Tests: ",Re(s.testsRun,3)]}):null,s.validationAttempts.length>0?e.jsxs("small",{children:["Validation: ",Re(s.validationAttempts,2)]}):null,s.refs.length>0?e.jsxs("small",{children:["Refs: ",Re(s.refs.map($i),4)]}):null,s.blockers.length>0?e.jsxs("small",{children:["Blockers: ",Re(s.blockers,3)]}):null,s.workspaceRetention?e.jsxs("small",{children:["Workspace: ",Ei(s.workspaceRetention)]}):null,s.importantMessages.length>0?e.jsxs("small",{children:["Messages: ",Re(s.importantMessages.map(Fi),2)]}):null]},s.runId))})})}function ki({pendingAction:t,run:s,onRun:n}){const a=wi(s);return a.length===0?null:e.jsx("div",{className:"goal-details-actions",children:a.map(i=>{const u=`${s.id}:${i}`,c=t===u;return e.jsx("button",{type:"button",disabled:!!t,onClick:()=>{n(s.id,i)},children:c?"Working...":yi(i)},i)})})}function wi(t){const s=[],n=Si(t),a=Ni(t);return n&&s.push("cleanup"),a&&s.push("archive"),s}function yi(t){return t==="cleanup"?"Clean":t==="archive"?"Archive":"Clean + archive"}function Si(t){if(!ln(t))return!1;const s=rt(t.metadata);if(!s?.subagentWorkspace&&!s?.workspaceHandoff)return!1;const n=rt(s.lifecycleCleanup),a=rt(n?.workspaceCleanup),i=on(a?.status);return i!=="removed"&&i!=="deleted"&&i!=="retained"&&i!=="skipped"}function Ni(t){if(!t.childSessionId||!ln(t))return!1;const s=rt(rt(t.metadata)?.childSessionArchive),n=on(s?.status);return n!=="archived"&&n!=="already_archived"}function ln(t){return t.status==="completed"||t.status==="failed"||t.status==="cancelled"}function Ci(t){const s=t.latestMeaningfulUpdate;return s?`${St(s.roleId)} ${s.status}: ${s.message}`:"No structured update"}function Ri(t,s){if(t<=0&&s<=0)return"0 tokens";const n=`${s} ${s===1?"request":"requests"}`;return`${Ai(t)} tokens · ${n}`}function St(t){return t.slice(0,1).toUpperCase()+t.slice(1).replace(/[-_]+/g," ")}function $i(t){return`${t.kind}: ${t.label}`}function Fi(t){return`${Z(t.kind)}: ${t.body}`}function Ei(t){const s=t.expiresAt?`until ${Pi(t.expiresAt)}`:"for inspection",n=t.trigger?` · ${Z(t.trigger)}`:"";return`retained ${s}${n}`}function Re(t,s){const n=t.slice(0,s),a=t.length-n.length;return a>0?`${n.join(", ")} +${a}`:n.join(", ")}function Ai(t){if(t<1e3)return String(t);if(t>=1e6){const n=t/1e6;return`${Gs(n,n<10?2:1)}M`}const s=t/1e3;return`${Gs(s,s<10?1:0)}k`}function Pi(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Gs(t,s){return t.toFixed(s).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")}function Li(){return e.jsxs("div",{className:"goal-details-empty",children:[e.jsx(lt,{size:18}),e.jsx("span",{children:"No active Goal or Create workflow."})]})}function V({children:t,title:s}){return e.jsxs("section",{className:"goal-details-section",children:[e.jsx("h2",{children:s}),t]})}function it({rows:t}){return e.jsx("dl",{className:"goal-details-grid",children:t.map(([s,n])=>e.jsxs("div",{children:[e.jsx("dt",{children:s}),e.jsx("dd",{children:n})]},s))})}function wt({refs:t}){return e.jsx("ul",{className:"goal-details-ref-list",children:t.map(s=>e.jsxs("li",{children:[e.jsx("code",{title:s.primary,children:s.primary}),e.jsx("span",{children:s.secondary})]},s.id))})}function rt(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function on(t){return typeof t=="string"&&t.trim()?t.trim():null}function Z(t){return t.split(/[_-]/g).filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function Di(t){return t==="ready_local"||t==="published_hosted"?"success":t==="blocked"||t==="failed"||t==="cancelled"?"danger":t==="awaiting_questions"||t==="awaiting_plan_approval"?"warning":"active"}function Ti({sandboxId:t,connection:s}){const[n,a]=l.useState(null),[i,u]=l.useState([]),[c,f]=l.useState(null),[h,m]=l.useState(null),[o,x]=l.useState(null),[S,k]=l.useState(null);Ee(o,{prefix:"Sandbox"}),Ee(S,{prefix:"Sandbox integrations"});const N=n?.integrationLeases??[],E=l.useMemo(()=>i.filter(j=>j.status==="active"),[i]),_=l.useMemo(()=>Mi(n),[n]),I=l.useCallback(async()=>{if(!s){x("OpenPond App server is not connected.");return}if(!t){a(null),u([]),x(null);return}f("summary"),x(null);try{const j=await W.sandbox(s,t),R=await W.integrationConnections(s,Ks(j.sandbox));a(j.sandbox),u(R.connections),k(null)}catch(j){x(j instanceof Error?j.message:String(j))}finally{f(null)}},[s,t]),G=l.useCallback(async()=>{if(!(!s||!n)){m("load"),k(null);try{const[j,R]=await Promise.all([W.integrationConnections(s,Ks(n)),W.sandboxIntegrationLeases(s,n.id)]);u(j.connections),a(R.sandbox)}catch(j){k(j instanceof Error?j.message:String(j))}finally{m(null)}}},[s,n]),U=l.useCallback(async j=>{if(!s||!n)return;const R=$t(j.provider),T=R?Ft(R):null,M=T?.leasePolicy.allowedCapabilityIds??[];if(!R||!T?.leasePolicy.leaseable||M.length===0){k(`${ae(j.provider)} cannot be attached to this sandbox.`);return}m(`attach:${j.id}`),k(null);try{const A=await W.attachSandboxIntegrationConnection(s,n.id,{connectionId:j.id,provider:j.provider,capabilities:M,...j.scopes.length>0?{scopes:j.scopes}:{},...T.leasePolicy.defaultTtlSeconds?{ttlSeconds:T.leasePolicy.defaultTtlSeconds}:{},required:!1});a(A.sandbox)}catch(A){k(A instanceof Error?A.message:String(A))}finally{m(null)}},[s,n]),B=l.useCallback(async j=>{if(!(!s||!n)){m(`remove:${j}`),k(null);try{const R=await W.removeSandboxIntegrationLease(s,n.id,j);a(R.sandbox)}catch(R){k(R instanceof Error?R.message:String(R))}finally{m(null)}}},[s,n]);return l.useEffect(()=>{I()},[I]),t?e.jsxs("div",{className:"sandbox-summary-tab",children:[e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Sandbox"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[n?e.jsx("span",{children:n.state}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh summary","aria-label":"Refresh summary",disabled:c!==null,onClick:()=>{I()},children:c==="summary"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(as,{size:14})})]})]}),n?e.jsxs("dl",{className:"sandbox-workspace-kv",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Sandbox"}),e.jsx("dd",{children:qs(n.id)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Spend"}),e.jsxs("dd",{children:[Yt(n.reservation.capturedUsd)," / ",Yt(n.budget.maxUsd)]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Reservation"}),e.jsx("dd",{children:n.reservation.status})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Idle cleanup"}),e.jsx("dd",{children:n.quotas?.idleTimeoutSeconds?`${Math.round(n.quotas.idleTimeoutSeconds/60)} min`:"-"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Updated"}),e.jsx("dd",{children:cn(n.updatedAt)})]}),_?e.jsxs("div",{children:[e.jsx("dt",{children:"Receipt"}),e.jsxs("dd",{children:[qs(_.id)," / ",Yt(_.totalUsd)]})]}):null]}):e.jsxs("div",{className:"sandbox-workspace-loading",children:[c==="summary"?e.jsx(Oe,{className:"spinning",size:16}):null,e.jsx("span",{children:c==="summary"?"Loading sandbox":"Sandbox unavailable"})]})]}),e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Integrations"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[e.jsx("span",{children:N.length}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh integrations","aria-label":"Refresh integrations",disabled:h!==null||!n,onClick:()=>{G()},children:h==="load"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(as,{size:14})})]})]}),N.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:N.map(j=>e.jsxs("div",{className:"sandbox-workspace-integration-row",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:ae(j.provider)}),e.jsxs("small",{children:[j.required?"required":"optional"," / ",Ii(j)," / ",_i(j)]})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:`Revoke ${ae(j.provider)} lease`,"aria-label":`Revoke ${ae(j.provider)} lease`,disabled:h!==null,onClick:()=>{B(j.leaseId)},children:h===`remove:${j.leaseId}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(za,{size:14})}),e.jsxs("div",{className:"sandbox-workspace-chip-row",children:[j.capabilities.slice(0,5).map(R=>e.jsx("span",{children:Wi(j.provider,R)},R)),j.capabilities.length>5?e.jsxs("span",{children:["+",j.capabilities.length-5]}):null]})]},j.leaseId))}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No active integration leases."}),E.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:E.map(j=>{const R=N.some(A=>A.provider===j.provider),M=zi(j)?.leasePolicy.allowedCapabilityIds.length??0;return e.jsxs("div",{className:"sandbox-workspace-integration-row compact",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:Bi(j)}),e.jsx("small",{children:Oi(j,M)})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:R?`${ae(j.provider)} already attached`:`Attach ${ae(j.provider)}`,"aria-label":R?`${ae(j.provider)} already attached`:`Attach ${ae(j.provider)}`,disabled:R||h!==null||M===0,onClick:()=>{U(j)},children:h===`attach:${j.id}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(di,{size:14})})]},j.id)})}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No connected accounts available."})]})]}):e.jsx("div",{className:"sandbox-summary-tab",children:e.jsx("p",{className:"sandbox-workspace-empty",children:"No sandbox is attached yet."})})}function Ks(t){return{status:"active"}}function _i(t){return t.proxyUrl?"runtime proxy available":"metadata only, no runtime proxy"}function Mi(t){return t?.receipts?.at(-1)??null}function zi(t){const s=$t(t.provider);return s?Ft(s):null}function ae(t){const s=$t(t),n=s?Ft(s):null;return n?n.label:t==="microsoft_teams"?"Microsoft Teams":t?t.replace(/_/g," "):"Integration"}function Wi(t,s){const n=$t(t);return(n?Ft(n):null)?.capabilities.find(i=>i.id===s)?.label??s}function Ii(t){return t.expiresAt?`expires ${cn(t.expiresAt)}`:"active"}function Bi(t){const s=t.providerAccountName?.trim();return s?`${ae(t.provider)} / ${s}`:ae(t.provider)}function Oi(t,s){const n=[];return t.providerWorkspaceName&&n.push(t.providerWorkspaceName),n.push(`${s} lease ${s===1?"capability":"capabilities"}`),t.scopes.length>0&&n.push(`${t.scopes.length} ${t.scopes.length===1?"scope":"scopes"}`),n.join(" / ")}function qs(t){return t.length>10?`${t.slice(0,8)}...`:t}function cn(t){if(!t)return"-";const s=new Date(t);return Number.isNaN(s.valueOf())?"-":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(s)}function Yt(t){const s=Number(t??0);return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:s>=10?2:4}).format(Number.isFinite(s)?s:0)}function Ui({summary:t}){const s=Ba(t.taskset),n=t.taskset.learningSignals.demonstrations.filter(f=>f.approved).length,a=t.taskset.tasks.filter(f=>f.split==="frozen_eval").length,i=t.plan?.recipe.method==="sft"||t.plan?.recipe.method==="grpo"?t.plan.recipe:null,u=Oa(t.taskset,t.plan),c=t.job?Ua(t.job.status,t.job.completedAt,t.job.updatedAt):null;return e.jsxs("div",{className:"training-sidebar-summary",children:[e.jsxs("header",{children:[e.jsx("h2",{children:Ha(t.taskset.name)}),e.jsx("span",{children:t.job?Va(t.job.status):t.taskset.readiness?.ready?"Ready to train":"Needs review"})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Run"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Primary recommendation",value:s.toUpperCase()}),e.jsx(O,{label:"Training stage",value:u}),e.jsx(O,{label:"Base model",value:i?.baseModel.id??"Not selected"}),e.jsx(O,{label:"Compute",value:t.plan?Ga(t.plan.destinationId):"Not selected"}),e.jsx(O,{label:"Started",value:Ka(t.job?.startedAt??null)}),e.jsx(O,{label:"Duration",value:qa(t.job?.startedAt??null,c)})]})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Data"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Training examples",value:String(n)}),e.jsx(O,{label:"Test examples",value:String(a)}),e.jsx(O,{label:"Dataset sources",value:String(t.taskset.sourceRefs.length)})]})]}),i?e.jsxs("section",{children:[e.jsx("h3",{children:"Recipe"}),e.jsxs("dl",{children:[i.method==="grpo"?e.jsx(O,{label:"RL loss",value:i.loss.method==="gspo-token"?"GSPO-token":i.loss.method.toUpperCase()}):null,e.jsx(O,{label:"LoRA rank",value:String(i.lora.rank)}),e.jsx(O,{label:"Learning rate",value:String(i.optimizer.learningRate)}),e.jsx(O,{label:"Optimizer steps",value:String(i.optimizer.maxSteps)}),e.jsx(O,{label:i.method==="grpo"?"Prompt length":"Sequence length",value:String(i.method==="grpo"?i.dataset.maxPromptTokens:i.dataset.maxSequenceLength)})]})]}):null,e.jsxs("section",{children:[e.jsx("h3",{children:"Result"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Adapter",value:t.lineage?`${u} ready`:"Not created"}),e.jsx(O,{label:"Evaluation",value:t.lineage?.frozenEvaluationArtifactId?"Completed":"Not completed"}),e.jsx(O,{label:"Artifacts",value:String(t.artifacts.length)})]})]})]})}function O({label:t,value:s}){return e.jsxs("div",{children:[e.jsx("dt",{children:t}),e.jsx("dd",{children:s})]})}function Hi(t){const s=Xs("","","folder");for(const n of t){const a=n.endsWith("/"),i=n.split("/").filter(Boolean);if(i.length===0)continue;let u=s,c="";for(let f=0;f<i.length;f+=1){const h=i[f];c=c?`${c}/${h}`:h;const m=!a&&f===i.length-1?"file":"folder",o=`${m}:${h}`;let x=u.childMap.get(o);x||(x=Xs(h,c,m),u.childMap.set(o,x),u.children.push(x)),u=x}}return dn(s.children)}function Xs(t,s,n){return{name:t,path:s,type:n,children:[],childMap:new Map}}function dn(t){return t.sort((s,n)=>s.type!==n.type?s.type==="folder"?-1:1:s.name.localeCompare(n.name)).map(s=>({name:s.name,path:s.path,type:s.type,children:dn(s.children)}))}function is({className:t,currentStatus:s,onSetStatus:n}){const a=s==="pinned",i=s==="saved_for_later";return e.jsxs("span",{className:`workspace-file-bookmark-actions ${t??"workspace-file-heading-actions"}`,children:[e.jsx("button",{type:"button",className:a?"active":void 0,"data-tooltip":a?"Unpin file":"Pin file","aria-label":a?"Unpin file":"Pin file","aria-pressed":a,onClick:()=>n(a?"none":"pinned"),children:a?e.jsx(pa,{size:14}):e.jsx(ha,{size:14})}),e.jsx("button",{type:"button",className:i?"active":void 0,"data-tooltip":i?"Remove from Save for later":"Save file for later","aria-label":i?"Remove from Save for later":"Save file for later","aria-pressed":i,onClick:()=>n(i?"none":"saved_for_later"),children:i?e.jsx(ma,{size:14}):e.jsx(xa,{size:14})})]})}function Vi({changedByPath:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=l.useMemo(()=>Hi(a),[a]);return e.jsxs("div",{className:"workspace-file-tree-view",children:[e.jsxs("div",{className:"workspace-file-tree-header",children:[e.jsx(yt,{size:14}),e.jsx("strong",{title:n??void 0,children:n?n.split("/").at(-1):"Files"}),e.jsx("span",{children:a.length})]}),e.jsx("div",{className:"workspace-file-tree",children:m.map(o=>e.jsx(un,{changedByPath:t,expandedFolderPaths:s,node:o,rootPath:n,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h},`${o.type}:${o.path}`))})]})}function un({changedByPath:t,depth:s=0,expandedFolderPaths:n,node:a,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:f,onSetFileBookmarkStatus:h,onToggleFolder:m}){const o=i?`${i}/${a.path}`:a.path,x=a.type==="folder"&&n.has(o),S=t.get(o),k=2+s*11;return a.type==="folder"?e.jsxs("div",{className:"workspace-file-tree-node",children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row folder","aria-expanded":x,style:{paddingLeft:k},onClick:()=>m(o),children:[x?e.jsx(yt,{size:14}):e.jsx(ba,{size:14}),e.jsx("span",{children:a.name})]}),x&&a.children.map(N=>e.jsx(un,{changedByPath:t,depth:s+1,expandedFolderPaths:n,node:N,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:f,onSetFileBookmarkStatus:h,onToggleFolder:m},`${N.type}:${N.path}`))]}):e.jsxs("div",{className:`workspace-file-tree-row file ${S?"changed":""} ${u===o?"selected":""}`,style:{paddingLeft:k},children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row-main",title:o,onClick:()=>f(o),children:[e.jsx(Wa,{size:13}),e.jsx("span",{children:a.name}),S&&e.jsxs("small",{children:[e.jsxs("span",{className:"diff-addition",children:["+",S.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",S.deletions]})]})]}),h?e.jsx(is,{className:"workspace-file-tree-bookmark-actions",currentStatus:c?.(o)??null,onSetStatus:N=>h(o,N)}):null]})}function Zs({diff:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=t?.files??[],o=l.useMemo(()=>new Map(m.map(k=>[k.path,k])),[m]),x=n?.replace(/^\/+|\/+$/g,"")||null,S=l.useMemo(()=>{if(!x)return a;const k=`${x}/`;return a.filter(N=>N.startsWith(k)).map(N=>N.slice(k.length)).filter(Boolean)},[x,a]);return e.jsx("div",{className:"workspace-diff-files-view",children:e.jsx(Vi,{changedByPath:o,expandedFolderPaths:s,rootPath:x,repoFiles:S,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h})})}function Gi({collapsed:t,editorControlsVisible:s,hideWhiteSpace:n,loadFullFiles:a,renderMarkdown:i,wordDiffs:u,wordWrap:c,onClose:f,onCopyGitApply:h,onRefresh:m,onToggleCollapsed:o,onToggleEditorControlsVisible:x,onToggleHideWhiteSpace:S,onToggleLoadFullFiles:k,onToggleRenderMarkdown:N,onToggleWordDiffs:E,onToggleWordWrap:_}){return e.jsxs("div",{className:"workspace-diff-options-menu",role:"menu",children:[e.jsx(ce,{icon:e.jsx(as,{size:14}),label:"Refresh",onClick:m,onClose:f}),e.jsx(ce,{checked:c,icon:e.jsx(Ia,{size:14}),label:"Enable word wrap",onClick:_,onClose:f}),e.jsx(ce,{checked:t,icon:e.jsx(si,{size:14}),label:"Collapse all diffs",onClick:o,onClose:f}),e.jsx("div",{className:"workspace-diff-menu-divider"}),e.jsx(ce,{checked:s,icon:e.jsx(oi,{size:14}),label:"Show editor controls",onClick:x,onClose:f}),e.jsx(ce,{checked:i,icon:e.jsx(an,{size:14}),label:"Render Markdown",onClick:N,onClose:f}),e.jsx(ce,{checked:!a,icon:e.jsx(lt,{size:14}),label:"Show diffs first",onClick:k,onClose:f}),e.jsx(ce,{checked:u,icon:e.jsx(ei,{size:14}),label:"Enable word diffs",onClick:E,onClose:f}),e.jsx(ce,{checked:n,icon:e.jsx(ri,{size:14}),label:"Hide white space",onClick:S,onClose:f}),e.jsx(ce,{icon:e.jsx(Qa,{size:14}),label:"Copy git apply command",onClick:h,onClose:f})]})}function ce({checked:t,icon:s,label:n,onClick:a,onClose:i}){return e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{a?.(),i()},children:[s,e.jsx("span",{children:n}),t&&e.jsx(ga,{size:14})]})}function Ki({addMenuOpen:t,expanded:s,filteredFiles:n,dirtyFilePaths:a,openFiles:i,goalDetailsAvailable:u,searchOpen:c,searchQuery:f,selectedPath:h,sideChatTabs:m=[],summaryAvailable:o,sourceStatus:x,sourceSwitcher:S,visibleTab:k,getFileBookmarkStatus:N,onCloseFileTab:E,onCloseSideChat:_,onCloseSearch:I,onOpenFile:G,onOpenBrowser:U,onOpenSearch:B,onOpenSideChat:j,onSearchQueryChange:R,onSetFileBookmarkStatus:T,onSelectFile:M,onSelectFiles:A,onSelectGoal:Q,onSelectSummary:q,onSelectSideChat:z,onToggleAddMenu:H,onToggleExpanded:re}){const le=l.useRef(null);l.useEffect(()=>{if(!t&&!c)return;function w(){t&&H(),c&&I()}function F(de){le.current?.contains(de.target)||w()}function D(de){de.key==="Escape"&&w()}return document.addEventListener("pointerdown",F),document.addEventListener("keydown",D),()=>{document.removeEventListener("pointerdown",F),document.removeEventListener("keydown",D)}},[t,I,H,c]);function Y(w){if(w.key==="Escape"){I();return}w.key==="Enter"&&n[0]&&G(n[0])}function J(w){if(!["ArrowRight","ArrowLeft","Home","End"].includes(w.key))return;const F=w.target;if(!(F instanceof HTMLButtonElement)||F.getAttribute("role")!=="tab")return;const D=Array.from(w.currentTarget.querySelectorAll('button[role="tab"]')),de=D.indexOf(F);if(de<0||D.length===0)return;w.preventDefault();const Et=Na(de,D.length,w.key),Ae=D[Et];if(!Ae)return;Ae.focus(),Ae.click();const X=Ae.id;X&&window.requestAnimationFrame(()=>document.getElementById(X)?.focus())}return e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsxs("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",onKeyDown:J,children:[u?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="goal"?"active":""}`,role:"tab","aria-selected":k==="goal",onClick:Q,children:[e.jsx(lt,{size:14}),e.jsx("span",{children:"Goal"})]}):null,o&&q?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="summary"?"active":""}`,role:"tab","aria-selected":k==="summary",onClick:q,children:[e.jsx(Vs,{size:14}),e.jsx("span",{children:"Summary"})]}):null,e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="files"?"active":""}`,role:"tab",id:"right-sidebar-files-tab","aria-controls":"right-sidebar-files-panel","aria-selected":k==="files",tabIndex:k==="files"?0:-1,onClick:A,children:[e.jsx(yt,{size:14}),e.jsx("span",{children:"Files"})]}),i.map(w=>e.jsxs("div",{className:`workspace-diff-tab file ${k==="file"&&h===w.path?"active":""}`,children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab","aria-selected":k==="file"&&h===w.path,title:w.path,onClick:()=>M(w.path),children:[e.jsx(lt,{className:"workspace-diff-tab-icon",size:13}),a.has(w.path)&&e.jsx("span",{className:"workspace-diff-tab-dirty","aria-hidden":"true"}),e.jsx("span",{children:w.path.split("/").pop()})]}),T?e.jsx(is,{className:"workspace-diff-tab-bookmark-actions",currentStatus:N?.(w.path)??null,onSetStatus:F=>T(w.path,F)}):null,e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${w.path}`,onClick:F=>E(w.path,F),children:e.jsx(Is,{size:12})})]},w.path)),m.map(w=>e.jsxs("div",{className:"workspace-diff-tab right-chat-tab",children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab",id:`right-chat-tab-${w.id}`,"aria-controls":`right-chat-panel-${w.id}`,"aria-selected":!1,tabIndex:-1,title:w.title,onClick:()=>z?.(w.id),children:[w.running?e.jsx("span",{className:"right-chat-status-dot","aria-label":"Running"}):null,e.jsx("span",{children:w.title})]}),_?e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${w.title}`,"aria-label":`Close ${w.title}`,onClick:F=>{F.stopPropagation(),_(w.id)},children:e.jsx(Is,{size:12})}):null]},w.id)),e.jsxs("div",{className:"workspace-diff-add-anchor",ref:le,children:[e.jsx("button",{type:"button",className:`workspace-diff-add-tab ${t||c?"active":""}`,title:"Add","aria-label":"Add to right sidebar",onClick:H,children:e.jsx(ja,{size:15})}),t&&e.jsxs("div",{className:"workspace-diff-add-menu",role:"menu",children:[j?e.jsxs("button",{type:"button",role:"menuitem",onClick:j,children:[e.jsx(va,{size:14}),e.jsx("span",{children:"New task"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:A,children:[e.jsx(yt,{size:14}),e.jsx("span",{children:"Files"}),e.jsx("kbd",{})]}),o&&q?e.jsxs("button",{type:"button",role:"menuitem",onClick:q,children:[e.jsx(Vs,{size:14}),e.jsx("span",{children:"Summary"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:B,children:[e.jsx(ka,{size:14}),e.jsx("span",{children:"Open file"}),e.jsx("kbd",{children:"Ctrl+P"})]}),U?e.jsxs("button",{type:"button",role:"menuitem",onClick:U,children:[e.jsx(wa,{size:14}),e.jsx("span",{children:"Browser"}),e.jsx("kbd",{children:"Ctrl+I"})]}):null]}),c&&e.jsxs("div",{className:"workspace-file-search-popover",children:[e.jsx("input",{autoFocus:!0,placeholder:"Search files",value:f,onChange:w=>R(w.target.value),onKeyDown:Y}),e.jsx("span",{children:"Files"}),e.jsx("div",{className:"workspace-file-search-results",children:n.length===0?e.jsx("small",{children:"Type to search for files"}):n.map(w=>e.jsx("button",{type:"button",onClick:()=>G(w),children:w},w))})]})]})]}),S||x?e.jsxs("div",{className:"workspace-diff-source-bar","aria-label":"Workspace source",children:[S?e.jsx("div",{className:"workspace-diff-source-toggle",role:"group","aria-label":"File source",children:S.options.map(w=>e.jsx("button",{type:"button",className:S.value===w.value?"active":"","aria-pressed":S.value===w.value,onClick:()=>S.onChange(w.value),children:w.label},w.value))}):null,x?e.jsx("span",{className:`workspace-diff-source-status ${x.tone}`,children:x.label}):null]}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:s?"Restore files panel":"Expand files panel","aria-label":s?"Restore files panel":"Expand files panel",onClick:re,children:s?e.jsx(Xa,{size:14}):e.jsx(ya,{size:14})})]})}function qi({canCheckActiveFile:t,canSaveActiveFile:s,collapsed:n,editorControlsVisible:a,editorDiagnosticStatus:i,editorDiagnosticsChecking:u,hideWhiteSpace:c,loadFullFiles:f,menuOpen:h,renderMarkdown:m,showEditorCommandBar:o,showRenderMarkdownToggle:x,splitView:S,wordDiffs:k,wordWrap:N,onCopyGitApply:E,onEditorCheck:_,onEditorRedo:I,onEditorSave:G,onEditorUndo:U,onRefresh:B,onToggleCollapsed:j,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:T,onToggleLoadFullFiles:M,onToggleMenu:A,onToggleRenderMarkdown:Q,onToggleSplitView:q,onToggleWordDiffs:z,onToggleWordWrap:H}){return e.jsx("div",{className:"workspace-diff-toolbar",children:e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsxs("div",{className:"workspace-diff-menu-anchor",children:[e.jsx("button",{type:"button",className:"diff-icon-button",title:"Diff options","aria-haspopup":"menu","aria-expanded":h,onClick:()=>A(),children:e.jsx(Sa,{size:15})}),h&&e.jsx(Gi,{collapsed:n,editorControlsVisible:a,hideWhiteSpace:c,loadFullFiles:f,renderMarkdown:m,wordDiffs:k,wordWrap:N,onClose:()=>A(!1),onCopyGitApply:E,onRefresh:B,onToggleCollapsed:j,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:T,onToggleLoadFullFiles:M,onToggleRenderMarkdown:Q,onToggleWordDiffs:z,onToggleWordWrap:H})]}),o&&e.jsxs("div",{className:"workspace-editor-command-bar","aria-label":"Editor controls",children:[e.jsx("button",{type:"button",className:"diff-icon-button",title:"Save file","aria-label":"Save file",disabled:!s,onClick:G,children:e.jsx(Za,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Undo","aria-label":"Undo",onClick:U,children:e.jsx(hi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Redo","aria-label":"Redo",onClick:I,children:e.jsx(fi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Check file","aria-label":"Check file",disabled:!t,onClick:_,children:u?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(Bs,{size:14})}),i&&e.jsxs("span",{className:`workspace-editor-diagnostic-chip ${i.severity}`,children:[i.severity==="error"||i.severity==="warning"||i.severity==="unavailable"?e.jsx(nn,{size:13}):e.jsx(Bs,{size:13}),e.jsx("span",{children:i.label})]})]}),x&&e.jsx("button",{type:"button",className:`diff-icon-button ${m?"active":""}`,title:m?"Show Markdown source":"Render Markdown","aria-label":m?"Show Markdown source":"Render Markdown","aria-pressed":m,onClick:Q,children:e.jsx(an,{size:14})}),e.jsx("button",{type:"button",className:`diff-icon-button ${S?"active":""}`,title:S?"Show unified diff":"Show split diff","aria-label":S?"Show unified diff":"Show split diff","aria-pressed":S,onClick:q,children:e.jsx(ai,{size:14})})]})})}const Xi={cjs:"typescript",css:"css",html:"html",js:"typescript",json:"json",jsx:"typescript",md:"markdown",mjs:"typescript",py:"python",sh:"shell",ts:"typescript",tsx:"typescript",yaml:"yaml",yml:"yaml"};function rs(t){const s=t.split("/").pop()?.toLowerCase()??"";if(s==="dockerfile")return"shell";if(s==="readme"||s==="readme.md")return"markdown";const n=s.includes(".")?s.split(".").pop()??"":"";return Xi[n]??"text"}function Zi(t,s){return t?s==="markdown"?Qi(t):s==="json"?Fe(t,/("(?:\\.|[^"\\])*"(?=\s*:)|"(?:\\.|[^"\\])*"|[-]?\b\d+(?:\.\d+)?\b|\btrue\b|\bfalse\b|\bnull\b|[{}[\]:,])/g):s==="css"?Fe(t,/(\/\*.*?\*\/|#[\da-fA-F]{3,8}\b|--[\w-]+|[.#]?[\w-]+(?=\s*:)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b\d+(?:\.\d+)?(?:px|rem|em|%|vh|vw)?\b|[{}():;,])/g):s==="html"?Fe(t,/(<!--.*?-->|<\/?[\w-]+|[\w:-]+(?==)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[<>/=])/g):s==="shell"?Fe(t,/(#.*$|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:cd|cp|export|git|npm|pnpm|bun|yarn|rm|mkdir|test|if|then|fi|for|do|done|echo)\b|\$[\w_]+|&&|\|\||[|&;=])/g):s==="python"?Fe(t,/(#.*$|"""[\s\S]*?"""|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:class|def|return|if|elif|else|for|while|try|except|finally|with|as|import|from|None|True|False|async|await|lambda|yield)\b|\b[A-Z][\w]*\b|\b\d+(?:\.\d+)?\b|[+\-*/%=<>!&|.:,()[\]{}]+)/g):Fe(t,/(\/\/.*$|\/\*.*?\*\/|`(?:\\.|[^`\\])*`|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:abstract|as|async|await|boolean|break|case|catch|class|const|continue|default|else|enum|export|extends|false|finally|for|from|function|if|import|in|interface|let|new|null|number|of|return|string|switch|throw|true|try|type|undefined|void|while)\b|\b[A-Z][\w]*\b|\b\d+(?:\.\d+)?\b|[+\-*/%=<>!&|?:.,()[\]{}]+)/g):[{text:" ",kind:"plain"}]}function Qi(t){return/^\s{0,3}#{1,6}\s/.test(t)?[{text:t,kind:"keyword"}]:/^\s*[-*+]\s/.test(t)?[{text:t,kind:"property"}]:Fe(t,/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)]+\)|https?:\/\/\S+)/g)}function Yi(t){return/^(\/\/|#|\/\*|<!--)/.test(t)?"comment":/^["'`]/.test(t)?"string":/^[-]?\d/.test(t)||/^#[\da-fA-F]{3,8}\b/.test(t)?"number":/^\b[A-Z]/.test(t)?"type":/^[.#]?[\w-]+$/.test(t)&&t.includes("-")?"property":/^(?:[{}()[\],.:;<>/=+\-*&|!?%]+)$/.test(t)?"operator":/^(?:--|\$)/.test(t)?"property":"keyword"}function Fe(t,s){const n=[];let a=0;for(const i of t.matchAll(s)){const u=i.index??0;u>a&&n.push({text:t.slice(a,u),kind:"plain"});const c=i[0];if(n.push({text:c,kind:Yi(c)}),a=u+c.length,/^(\/\/|#|<!--)/.test(c))break}return a<t.length&&n.push({text:t.slice(a),kind:"plain"}),n.length>0?n:[{text:t,kind:"plain"}]}function Nt({language:t,text:s}){return e.jsx(e.Fragment,{children:Zi(s,t).map((n,a)=>e.jsx("span",{className:`syntax-token ${n.kind}`,children:n.text},`${a}-${n.text}`))})}const Ji=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WorkspaceMonacoEditor-C2cNf0UO.js","./index-B5RqBp_p.js","./index-C5EoPZr0.css","./WorkspaceMonacoEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as l,_ as fa}from"./index-B5RqBp_p.js";import{c as be,m as lt,bm as Ws,aO as nn,aB as Ee,v as W,bn as $t,b3 as Ft,aX as Oe,bo as pa,at as ha,bp as ma,au as xa,F as ba,B as an,h as ga,X as Is,P as ja,av as va,aq as ka,aW as wa,bl as ya,bq as Sa,a$ as Bs,br as Na,bs as ts,bt as Ca,bu as ss,bv as Ra,f as $a,w as rn,t as Fa,bw as Qt,bx as Ea,by as ns,bz as Ce,bA as Aa,bB as Os,bC as Pa,bD as La,bE as Us,bF as Da,bG as Ta}from"./App-kwt-UxX_.js";import{M as _a,u as Hs,I as Ma}from"./MarkdownText-D6_UI4Ly.js";import{R as as}from"./refresh-cw-DaASy_i0.js";import{T as za,F as Wa,a as Ia}from"./chat-file-links-C3erG0P2.js";import{t as Ba,a as Oa,b as Ua,m as Ha,s as Va,d as Ga,f as Ka,c as qa}from"./training-model-data-CKOkpBBL.js";import{F as yt}from"./folder-open-2a5riVSG.js";import{I as Vs}from"./info-BWvLCbJ2.js";import{M as Xa}from"./minimize-2-C-_iqAbt.js";import{S as Za}from"./save-BBQ7L8VS.js";import{C as Qa}from"./clipboard-BSPYX7yq.js";import{C as Ya}from"./chevron-up-D9MMQKU3.js";const Ja=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],ei=be("text-align-start",Ja);const ti=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],si=be("chevrons-up",ti);const ni=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ai=be("columns-2",ni);const ii=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ri=be("eye-off",ii);const li=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],oi=be("panel-top",li);const ci=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],di=be("plug",ci);const ui=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],fi=be("redo-2",ui);const pi=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],hi=be("undo-2",pi);function mi({createRuntime:t,goalRuntime:s,subagentRuntime:n=null,onRunSubagentLifecycleAction:a}){const i=t?"Create/Improve Details":"Goal Details",u=t?Z(t.run.state):n?.activeCount?n.label:s?.actionLabel??"No active goal";return e.jsxs("div",{className:"goal-details-view","aria-label":i,children:[e.jsxs("div",{className:"goal-details-header",children:[e.jsxs("div",{className:"goal-details-title",children:[e.jsx(lt,{size:15,"aria-hidden":"true"}),e.jsx("span",{children:i})]}),e.jsx("span",{className:`goal-details-state ${Di(t?.run.state??null)}`,children:u})]}),e.jsx("div",{className:"goal-details-body",children:t?e.jsx(xi,{runtime:t}):s||n?e.jsx(gi,{goalRuntime:s,subagentRuntime:n,onRunSubagentLifecycleAction:a}):e.jsx(Li,{})})]})}function xi({runtime:t}){const s=t.run,n=s.plan,a=Ws(n?.metadata)??Ws(s.metadata),i=s.questions,u=i.filter(o=>o.status==="pending"),c=s.sourceRefs,f=s.checkRefs,h=s.state,m=s.target.kind==="agent"?s.target.defaultActionKey:null;return e.jsxs(e.Fragment,{children:[e.jsx(V,{title:"Current Work",children:e.jsx(it,{rows:[["State",Z(h)],["Operation",s.operation],["Target",Z(s.target.kind)],["Name",s.target.displayName??s.target.id??"Pending"],["Target ID",s.target.id??"Pending"],["Default action",m??n?.defaultChatAction.key??"Pending"],["Adapter",Z(s.adapter.kind)],["Run",s.id],["Revision",String(s.revision)]]})}),e.jsx(V,{title:"Plan",children:n?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"goal-details-summary",children:n.summary}),e.jsx(it,{rows:[["Objective",n.objective],["Context",n.capturedContextSummary],["Status",Z(n.status)],["Plan ID",n.id],["Run ID",n.runId],["Approval",n.approvalId??"Pending"],["Approved",n.approvedAt??"Not approved"]]})]}):u.length?e.jsx("p",{className:"goal-details-summary",children:"Waiting for answers before the model finalizes the Create plan."}):e.jsx("p",{className:"goal-details-summary",children:"The model is preparing the Create plan."})}),a?e.jsxs(V,{title:"Action Shape",children:[e.jsx(it,{rows:[["Mode",a.label],["Default action",a.defaultActionKey??"None"],["Direct action",a.directActionHint??"None planned"],["Artifacts",a.artifactPolicy]]}),e.jsx("p",{className:"goal-details-note",children:a.detail})]}):null,i.length?e.jsx(V,{title:"Questions",children:e.jsx("div",{className:"goal-details-list",children:i.map(o=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.title}),e.jsx("span",{className:`goal-details-inline-state ${o.status}`,children:Z(o.status)})]}),e.jsx("p",{children:o.prompt}),o.answer?e.jsxs("small",{children:["Answer: ",o.answer.label??o.answer.value]}):o.options.length?e.jsxs("small",{children:["Options: ",o.options.map(x=>x.label).join(", ")]}):null]},o.id))})}):null,n?.requirements.length?e.jsx(V,{title:"Setup Requirements",children:e.jsx("div",{className:"goal-details-list",children:n.requirements.map(o=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.name}),e.jsx("span",{className:`goal-details-inline-state ${o.status}`,children:Z(o.status)})]}),e.jsxs("small",{children:[Z(o.kind),o.detail?`: ${o.detail}`:""]})]},`${o.kind}:${o.name}`))})}):null,n?.sourcePlan.length?e.jsx(V,{title:"Source Plan",children:e.jsx(wt,{refs:n.sourcePlan.map(o=>({id:`${o.operation}:${o.path}`,primary:o.path,secondary:`${Z(o.operation)}: ${o.reason}`}))})}):null,n?.checks.length?e.jsx(V,{title:"Checks",children:e.jsx(wt,{refs:n.checks.map(o=>({id:o.name,primary:o.name,secondary:`${o.required?"Required":"Optional"}: ${o.command}`}))})}):null,c.length||f.length?e.jsx(V,{title:"Run Refs",children:e.jsx(wt,{refs:[...c.map(o=>({id:`source:${o}`,primary:o,secondary:"Source ref"})),...f.map(o=>({id:`check:${o}`,primary:o,secondary:"Check ref"}))]})}):null,e.jsx(bi,{run:s}),s.blockedReason?e.jsx(V,{title:"Blocked",children:e.jsxs("div",{className:"goal-details-alert",children:[e.jsx(nn,{size:15}),e.jsx("span",{children:s.blockedReason})]})}):null,e.jsx(V,{title:"Raw State",children:e.jsxs("details",{className:"goal-details-raw",children:[e.jsx("summary",{children:"Show structured payload"}),e.jsx("pre",{children:JSON.stringify(s,null,2)})]})})]})}function bi({run:t}){const s=[...t.context.attachments.map(i=>({id:`attachment:${i.id??i.name}`,primary:i.name,secondary:i.ref??i.mediaType??"Attachment"})),...t.context.apps.map(i=>({id:`app:${i.id}`,primary:i.name,secondary:i.required?"Required app context":"Optional app context"})),...t.context.tools.map(i=>({id:`tool:${i.name}`,primary:i.name,secondary:i.outputSummary??i.inputSummary??"Tool context"})),...t.context.targetRepoAssumptions.map(i=>({id:`target:${i}`,primary:i,secondary:"Target assumption"}))],n=t.workflowCapture,a=n?[...n.files.map(i=>({id:`workflow-file:${i}`,primary:i,secondary:"Captured file"})),...n.outputArtifacts.map(i=>({id:`workflow-artifact:${i}`,primary:i,secondary:"Output artifact"})),...n.traceRefs.map(i=>({id:`workflow-trace:${i}`,primary:i,secondary:"Trace"}))]:[];return!s.length&&!a.length?null:e.jsx(V,{title:"Context",children:e.jsx(wt,{refs:[...s,...a]})})}function gi({goalRuntime:t,subagentRuntime:s,onRunSubagentLifecycleAction:n}){return e.jsxs(e.Fragment,{children:[t?e.jsxs(V,{title:"Goal",children:[e.jsx("p",{className:"goal-details-summary",children:t.objective}),e.jsx(it,{rows:[["Status",t.actionLabel],["Runtime",t.timeLabel],["Detail",t.detail]]})]}):null,s?e.jsx(ji,{runtime:s,onRunSubagentLifecycleAction:n}):null,e.jsx(V,{title:"Raw State",children:e.jsxs("details",{className:"goal-details-raw",children:[e.jsx("summary",{children:"Show structured payload"}),e.jsx("pre",{children:JSON.stringify({goalRuntime:t,subagentRuntime:s},null,2)})]})})]})}function ji({runtime:t,onRunSubagentLifecycleAction:s}){const[n,a]=l.useState(null),[i,u]=l.useState(null);Ee(i);const c=async(f,h)=>{if(!s)return;const m=`${f}:${h}`;a(m),u(null);try{await s({runId:f,action:h})}catch(o){u(o instanceof Error?o.message:String(o))}finally{a(o=>o===m?null:o)}};return e.jsxs(e.Fragment,{children:[e.jsxs(V,{title:"Subagents",children:[e.jsx(it,{rows:[["Latest update",Ci(t)],["Active",String(t.activeCount)],["Completed",String(t.completedCount)],["Failed",String(t.failedCount)],["Cancelled",String(t.cancelledCount)],["Paused",String(t.needsResumeCount)],["Terminal",String(t.terminalCount)],["Usage",Ri(t.usage.totalTokens,t.usage.requestCount)],["Evidence",String(t.evidenceRefs.length)],["Checks",String(t.testsRunCount)]]}),t.blockers.length>0?e.jsx("ul",{className:"goal-details-list compact",children:t.blockers.slice(0,4).map(f=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${f.status}`,children:f.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(f.roleId)}),e.jsx("p",{children:f.message})]})]},`${f.runId}:${f.message}`))}):null,e.jsx("ul",{className:"goal-details-list",children:t.runs.slice(0,8).map(f=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${f.status}`,children:f.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(f.roleId)}),e.jsx("p",{children:f.objective}),f.report?.summary?e.jsx("small",{children:f.report.summary}):null,s?e.jsx(ki,{pendingAction:n,run:f,onRun:c}):null]})]},f.id))})]}),t.finalResults.length>0?e.jsx(vi,{results:t.finalResults}):null]})}function vi({results:t}){return e.jsx(V,{title:"Child Results",children:e.jsx("ol",{className:"goal-details-task-graph",children:t.slice(0,6).map(s=>e.jsxs("li",{className:"goal-details-task-node",children:[e.jsxs("div",{className:"goal-details-task-node-header",children:[e.jsx("span",{className:`goal-details-inline-state ${s.status}`,children:s.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(s.roleId)}),e.jsx("small",{children:s.objective})]})]}),e.jsx("p",{children:s.summary}),e.jsxs("div",{className:"goal-details-task-node-meta",children:[e.jsxs("span",{children:[s.refs.length," refs"]}),e.jsxs("span",{children:[s.testsRun.length+s.validationAttempts.length," checks"]}),e.jsxs("span",{children:[s.blockers.length," blockers"]}),e.jsx("span",{children:s.confidence?`${Z(s.confidence)} confidence`:"Confidence unknown"})]}),s.findings.length>0?e.jsxs("small",{children:["Findings: ",Re(s.findings,3)]}):null,s.changedFiles.length>0?e.jsxs("small",{children:["Files: ",Re(s.changedFiles,4)]}):null,s.testsRun.length>0?e.jsxs("small",{children:["Tests: ",Re(s.testsRun,3)]}):null,s.validationAttempts.length>0?e.jsxs("small",{children:["Validation: ",Re(s.validationAttempts,2)]}):null,s.refs.length>0?e.jsxs("small",{children:["Refs: ",Re(s.refs.map($i),4)]}):null,s.blockers.length>0?e.jsxs("small",{children:["Blockers: ",Re(s.blockers,3)]}):null,s.workspaceRetention?e.jsxs("small",{children:["Workspace: ",Ei(s.workspaceRetention)]}):null,s.importantMessages.length>0?e.jsxs("small",{children:["Messages: ",Re(s.importantMessages.map(Fi),2)]}):null]},s.runId))})})}function ki({pendingAction:t,run:s,onRun:n}){const a=wi(s);return a.length===0?null:e.jsx("div",{className:"goal-details-actions",children:a.map(i=>{const u=`${s.id}:${i}`,c=t===u;return e.jsx("button",{type:"button",disabled:!!t,onClick:()=>{n(s.id,i)},children:c?"Working...":yi(i)},i)})})}function wi(t){const s=[],n=Si(t),a=Ni(t);return n&&s.push("cleanup"),a&&s.push("archive"),s}function yi(t){return t==="cleanup"?"Clean":t==="archive"?"Archive":"Clean + archive"}function Si(t){if(!ln(t))return!1;const s=rt(t.metadata);if(!s?.subagentWorkspace&&!s?.workspaceHandoff)return!1;const n=rt(s.lifecycleCleanup),a=rt(n?.workspaceCleanup),i=on(a?.status);return i!=="removed"&&i!=="deleted"&&i!=="retained"&&i!=="skipped"}function Ni(t){if(!t.childSessionId||!ln(t))return!1;const s=rt(rt(t.metadata)?.childSessionArchive),n=on(s?.status);return n!=="archived"&&n!=="already_archived"}function ln(t){return t.status==="completed"||t.status==="failed"||t.status==="cancelled"}function Ci(t){const s=t.latestMeaningfulUpdate;return s?`${St(s.roleId)} ${s.status}: ${s.message}`:"No structured update"}function Ri(t,s){if(t<=0&&s<=0)return"0 tokens";const n=`${s} ${s===1?"request":"requests"}`;return`${Ai(t)} tokens · ${n}`}function St(t){return t.slice(0,1).toUpperCase()+t.slice(1).replace(/[-_]+/g," ")}function $i(t){return`${t.kind}: ${t.label}`}function Fi(t){return`${Z(t.kind)}: ${t.body}`}function Ei(t){const s=t.expiresAt?`until ${Pi(t.expiresAt)}`:"for inspection",n=t.trigger?` · ${Z(t.trigger)}`:"";return`retained ${s}${n}`}function Re(t,s){const n=t.slice(0,s),a=t.length-n.length;return a>0?`${n.join(", ")} +${a}`:n.join(", ")}function Ai(t){if(t<1e3)return String(t);if(t>=1e6){const n=t/1e6;return`${Gs(n,n<10?2:1)}M`}const s=t/1e3;return`${Gs(s,s<10?1:0)}k`}function Pi(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Gs(t,s){return t.toFixed(s).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")}function Li(){return e.jsxs("div",{className:"goal-details-empty",children:[e.jsx(lt,{size:18}),e.jsx("span",{children:"No active Goal or Create workflow."})]})}function V({children:t,title:s}){return e.jsxs("section",{className:"goal-details-section",children:[e.jsx("h2",{children:s}),t]})}function it({rows:t}){return e.jsx("dl",{className:"goal-details-grid",children:t.map(([s,n])=>e.jsxs("div",{children:[e.jsx("dt",{children:s}),e.jsx("dd",{children:n})]},s))})}function wt({refs:t}){return e.jsx("ul",{className:"goal-details-ref-list",children:t.map(s=>e.jsxs("li",{children:[e.jsx("code",{title:s.primary,children:s.primary}),e.jsx("span",{children:s.secondary})]},s.id))})}function rt(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function on(t){return typeof t=="string"&&t.trim()?t.trim():null}function Z(t){return t.split(/[_-]/g).filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function Di(t){return t==="ready_local"||t==="published_hosted"?"success":t==="blocked"||t==="failed"||t==="cancelled"?"danger":t==="awaiting_questions"||t==="awaiting_plan_approval"?"warning":"active"}function Ti({sandboxId:t,connection:s}){const[n,a]=l.useState(null),[i,u]=l.useState([]),[c,f]=l.useState(null),[h,m]=l.useState(null),[o,x]=l.useState(null),[S,k]=l.useState(null);Ee(o,{prefix:"Sandbox"}),Ee(S,{prefix:"Sandbox integrations"});const N=n?.integrationLeases??[],E=l.useMemo(()=>i.filter(j=>j.status==="active"),[i]),_=l.useMemo(()=>Mi(n),[n]),I=l.useCallback(async()=>{if(!s){x("OpenPond App server is not connected.");return}if(!t){a(null),u([]),x(null);return}f("summary"),x(null);try{const j=await W.sandbox(s,t),R=await W.integrationConnections(s,Ks(j.sandbox));a(j.sandbox),u(R.connections),k(null)}catch(j){x(j instanceof Error?j.message:String(j))}finally{f(null)}},[s,t]),G=l.useCallback(async()=>{if(!(!s||!n)){m("load"),k(null);try{const[j,R]=await Promise.all([W.integrationConnections(s,Ks(n)),W.sandboxIntegrationLeases(s,n.id)]);u(j.connections),a(R.sandbox)}catch(j){k(j instanceof Error?j.message:String(j))}finally{m(null)}}},[s,n]),U=l.useCallback(async j=>{if(!s||!n)return;const R=$t(j.provider),T=R?Ft(R):null,M=T?.leasePolicy.allowedCapabilityIds??[];if(!R||!T?.leasePolicy.leaseable||M.length===0){k(`${ae(j.provider)} cannot be attached to this sandbox.`);return}m(`attach:${j.id}`),k(null);try{const A=await W.attachSandboxIntegrationConnection(s,n.id,{connectionId:j.id,provider:j.provider,capabilities:M,...j.scopes.length>0?{scopes:j.scopes}:{},...T.leasePolicy.defaultTtlSeconds?{ttlSeconds:T.leasePolicy.defaultTtlSeconds}:{},required:!1});a(A.sandbox)}catch(A){k(A instanceof Error?A.message:String(A))}finally{m(null)}},[s,n]),B=l.useCallback(async j=>{if(!(!s||!n)){m(`remove:${j}`),k(null);try{const R=await W.removeSandboxIntegrationLease(s,n.id,j);a(R.sandbox)}catch(R){k(R instanceof Error?R.message:String(R))}finally{m(null)}}},[s,n]);return l.useEffect(()=>{I()},[I]),t?e.jsxs("div",{className:"sandbox-summary-tab",children:[e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Sandbox"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[n?e.jsx("span",{children:n.state}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh summary","aria-label":"Refresh summary",disabled:c!==null,onClick:()=>{I()},children:c==="summary"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(as,{size:14})})]})]}),n?e.jsxs("dl",{className:"sandbox-workspace-kv",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Sandbox"}),e.jsx("dd",{children:qs(n.id)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Spend"}),e.jsxs("dd",{children:[Yt(n.reservation.capturedUsd)," / ",Yt(n.budget.maxUsd)]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Reservation"}),e.jsx("dd",{children:n.reservation.status})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Idle cleanup"}),e.jsx("dd",{children:n.quotas?.idleTimeoutSeconds?`${Math.round(n.quotas.idleTimeoutSeconds/60)} min`:"-"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Updated"}),e.jsx("dd",{children:cn(n.updatedAt)})]}),_?e.jsxs("div",{children:[e.jsx("dt",{children:"Receipt"}),e.jsxs("dd",{children:[qs(_.id)," / ",Yt(_.totalUsd)]})]}):null]}):e.jsxs("div",{className:"sandbox-workspace-loading",children:[c==="summary"?e.jsx(Oe,{className:"spinning",size:16}):null,e.jsx("span",{children:c==="summary"?"Loading sandbox":"Sandbox unavailable"})]})]}),e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Integrations"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[e.jsx("span",{children:N.length}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh integrations","aria-label":"Refresh integrations",disabled:h!==null||!n,onClick:()=>{G()},children:h==="load"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(as,{size:14})})]})]}),N.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:N.map(j=>e.jsxs("div",{className:"sandbox-workspace-integration-row",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:ae(j.provider)}),e.jsxs("small",{children:[j.required?"required":"optional"," / ",Ii(j)," / ",_i(j)]})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:`Revoke ${ae(j.provider)} lease`,"aria-label":`Revoke ${ae(j.provider)} lease`,disabled:h!==null,onClick:()=>{B(j.leaseId)},children:h===`remove:${j.leaseId}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(za,{size:14})}),e.jsxs("div",{className:"sandbox-workspace-chip-row",children:[j.capabilities.slice(0,5).map(R=>e.jsx("span",{children:Wi(j.provider,R)},R)),j.capabilities.length>5?e.jsxs("span",{children:["+",j.capabilities.length-5]}):null]})]},j.leaseId))}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No active integration leases."}),E.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:E.map(j=>{const R=N.some(A=>A.provider===j.provider),M=zi(j)?.leasePolicy.allowedCapabilityIds.length??0;return e.jsxs("div",{className:"sandbox-workspace-integration-row compact",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:Bi(j)}),e.jsx("small",{children:Oi(j,M)})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:R?`${ae(j.provider)} already attached`:`Attach ${ae(j.provider)}`,"aria-label":R?`${ae(j.provider)} already attached`:`Attach ${ae(j.provider)}`,disabled:R||h!==null||M===0,onClick:()=>{U(j)},children:h===`attach:${j.id}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(di,{size:14})})]},j.id)})}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No connected accounts available."})]})]}):e.jsx("div",{className:"sandbox-summary-tab",children:e.jsx("p",{className:"sandbox-workspace-empty",children:"No sandbox is attached yet."})})}function Ks(t){return{status:"active"}}function _i(t){return t.proxyUrl?"runtime proxy available":"metadata only, no runtime proxy"}function Mi(t){return t?.receipts?.at(-1)??null}function zi(t){const s=$t(t.provider);return s?Ft(s):null}function ae(t){const s=$t(t),n=s?Ft(s):null;return n?n.label:t==="microsoft_teams"?"Microsoft Teams":t?t.replace(/_/g," "):"Integration"}function Wi(t,s){const n=$t(t);return(n?Ft(n):null)?.capabilities.find(i=>i.id===s)?.label??s}function Ii(t){return t.expiresAt?`expires ${cn(t.expiresAt)}`:"active"}function Bi(t){const s=t.providerAccountName?.trim();return s?`${ae(t.provider)} / ${s}`:ae(t.provider)}function Oi(t,s){const n=[];return t.providerWorkspaceName&&n.push(t.providerWorkspaceName),n.push(`${s} lease ${s===1?"capability":"capabilities"}`),t.scopes.length>0&&n.push(`${t.scopes.length} ${t.scopes.length===1?"scope":"scopes"}`),n.join(" / ")}function qs(t){return t.length>10?`${t.slice(0,8)}...`:t}function cn(t){if(!t)return"-";const s=new Date(t);return Number.isNaN(s.valueOf())?"-":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(s)}function Yt(t){const s=Number(t??0);return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:s>=10?2:4}).format(Number.isFinite(s)?s:0)}function Ui({summary:t}){const s=Ba(t.taskset),n=t.taskset.learningSignals.demonstrations.filter(f=>f.approved).length,a=t.taskset.tasks.filter(f=>f.split==="frozen_eval").length,i=t.plan?.recipe.method==="sft"||t.plan?.recipe.method==="grpo"?t.plan.recipe:null,u=Oa(t.taskset,t.plan),c=t.job?Ua(t.job.status,t.job.completedAt,t.job.updatedAt):null;return e.jsxs("div",{className:"training-sidebar-summary",children:[e.jsxs("header",{children:[e.jsx("h2",{children:Ha(t.taskset.name)}),e.jsx("span",{children:t.job?Va(t.job.status):t.taskset.readiness?.ready?"Ready to train":"Needs review"})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Run"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Primary recommendation",value:s.toUpperCase()}),e.jsx(O,{label:"Training stage",value:u}),e.jsx(O,{label:"Base model",value:i?.baseModel.id??"Not selected"}),e.jsx(O,{label:"Compute",value:t.plan?Ga(t.plan.destinationId):"Not selected"}),e.jsx(O,{label:"Started",value:Ka(t.job?.startedAt??null)}),e.jsx(O,{label:"Duration",value:qa(t.job?.startedAt??null,c)})]})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Data"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Training examples",value:String(n)}),e.jsx(O,{label:"Test examples",value:String(a)}),e.jsx(O,{label:"Dataset sources",value:String(t.taskset.sourceRefs.length)})]})]}),i?e.jsxs("section",{children:[e.jsx("h3",{children:"Recipe"}),e.jsxs("dl",{children:[i.method==="grpo"?e.jsx(O,{label:"RL loss",value:i.loss.method==="gspo-token"?"GSPO-token":i.loss.method.toUpperCase()}):null,e.jsx(O,{label:"LoRA rank",value:String(i.lora.rank)}),e.jsx(O,{label:"Learning rate",value:String(i.optimizer.learningRate)}),e.jsx(O,{label:"Optimizer steps",value:String(i.optimizer.maxSteps)}),e.jsx(O,{label:i.method==="grpo"?"Prompt length":"Sequence length",value:String(i.method==="grpo"?i.dataset.maxPromptTokens:i.dataset.maxSequenceLength)})]})]}):null,e.jsxs("section",{children:[e.jsx("h3",{children:"Result"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Adapter",value:t.lineage?`${u} ready`:"Not created"}),e.jsx(O,{label:"Evaluation",value:t.lineage?.frozenEvaluationArtifactId?"Completed":"Not completed"}),e.jsx(O,{label:"Artifacts",value:String(t.artifacts.length)})]})]})]})}function O({label:t,value:s}){return e.jsxs("div",{children:[e.jsx("dt",{children:t}),e.jsx("dd",{children:s})]})}function Hi(t){const s=Xs("","","folder");for(const n of t){const a=n.endsWith("/"),i=n.split("/").filter(Boolean);if(i.length===0)continue;let u=s,c="";for(let f=0;f<i.length;f+=1){const h=i[f];c=c?`${c}/${h}`:h;const m=!a&&f===i.length-1?"file":"folder",o=`${m}:${h}`;let x=u.childMap.get(o);x||(x=Xs(h,c,m),u.childMap.set(o,x),u.children.push(x)),u=x}}return dn(s.children)}function Xs(t,s,n){return{name:t,path:s,type:n,children:[],childMap:new Map}}function dn(t){return t.sort((s,n)=>s.type!==n.type?s.type==="folder"?-1:1:s.name.localeCompare(n.name)).map(s=>({name:s.name,path:s.path,type:s.type,children:dn(s.children)}))}function is({className:t,currentStatus:s,onSetStatus:n}){const a=s==="pinned",i=s==="saved_for_later";return e.jsxs("span",{className:`workspace-file-bookmark-actions ${t??"workspace-file-heading-actions"}`,children:[e.jsx("button",{type:"button",className:a?"active":void 0,"data-tooltip":a?"Unpin file":"Pin file","aria-label":a?"Unpin file":"Pin file","aria-pressed":a,onClick:()=>n(a?"none":"pinned"),children:a?e.jsx(pa,{size:14}):e.jsx(ha,{size:14})}),e.jsx("button",{type:"button",className:i?"active":void 0,"data-tooltip":i?"Remove from Save for later":"Save file for later","aria-label":i?"Remove from Save for later":"Save file for later","aria-pressed":i,onClick:()=>n(i?"none":"saved_for_later"),children:i?e.jsx(ma,{size:14}):e.jsx(xa,{size:14})})]})}function Vi({changedByPath:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=l.useMemo(()=>Hi(a),[a]);return e.jsxs("div",{className:"workspace-file-tree-view",children:[e.jsxs("div",{className:"workspace-file-tree-header",children:[e.jsx(yt,{size:14}),e.jsx("strong",{title:n??void 0,children:n?n.split("/").at(-1):"Files"}),e.jsx("span",{children:a.length})]}),e.jsx("div",{className:"workspace-file-tree",children:m.map(o=>e.jsx(un,{changedByPath:t,expandedFolderPaths:s,node:o,rootPath:n,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h},`${o.type}:${o.path}`))})]})}function un({changedByPath:t,depth:s=0,expandedFolderPaths:n,node:a,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:f,onSetFileBookmarkStatus:h,onToggleFolder:m}){const o=i?`${i}/${a.path}`:a.path,x=a.type==="folder"&&n.has(o),S=t.get(o),k=2+s*11;return a.type==="folder"?e.jsxs("div",{className:"workspace-file-tree-node",children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row folder","aria-expanded":x,style:{paddingLeft:k},onClick:()=>m(o),children:[x?e.jsx(yt,{size:14}):e.jsx(ba,{size:14}),e.jsx("span",{children:a.name})]}),x&&a.children.map(N=>e.jsx(un,{changedByPath:t,depth:s+1,expandedFolderPaths:n,node:N,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:f,onSetFileBookmarkStatus:h,onToggleFolder:m},`${N.type}:${N.path}`))]}):e.jsxs("div",{className:`workspace-file-tree-row file ${S?"changed":""} ${u===o?"selected":""}`,style:{paddingLeft:k},children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row-main",title:o,onClick:()=>f(o),children:[e.jsx(Wa,{size:13}),e.jsx("span",{children:a.name}),S&&e.jsxs("small",{children:[e.jsxs("span",{className:"diff-addition",children:["+",S.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",S.deletions]})]})]}),h?e.jsx(is,{className:"workspace-file-tree-bookmark-actions",currentStatus:c?.(o)??null,onSetStatus:N=>h(o,N)}):null]})}function Zs({diff:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=t?.files??[],o=l.useMemo(()=>new Map(m.map(k=>[k.path,k])),[m]),x=n?.replace(/^\/+|\/+$/g,"")||null,S=l.useMemo(()=>{if(!x)return a;const k=`${x}/`;return a.filter(N=>N.startsWith(k)).map(N=>N.slice(k.length)).filter(Boolean)},[x,a]);return e.jsx("div",{className:"workspace-diff-files-view",children:e.jsx(Vi,{changedByPath:o,expandedFolderPaths:s,rootPath:x,repoFiles:S,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h})})}function Gi({collapsed:t,editorControlsVisible:s,hideWhiteSpace:n,loadFullFiles:a,renderMarkdown:i,wordDiffs:u,wordWrap:c,onClose:f,onCopyGitApply:h,onRefresh:m,onToggleCollapsed:o,onToggleEditorControlsVisible:x,onToggleHideWhiteSpace:S,onToggleLoadFullFiles:k,onToggleRenderMarkdown:N,onToggleWordDiffs:E,onToggleWordWrap:_}){return e.jsxs("div",{className:"workspace-diff-options-menu",role:"menu",children:[e.jsx(ce,{icon:e.jsx(as,{size:14}),label:"Refresh",onClick:m,onClose:f}),e.jsx(ce,{checked:c,icon:e.jsx(Ia,{size:14}),label:"Enable word wrap",onClick:_,onClose:f}),e.jsx(ce,{checked:t,icon:e.jsx(si,{size:14}),label:"Collapse all diffs",onClick:o,onClose:f}),e.jsx("div",{className:"workspace-diff-menu-divider"}),e.jsx(ce,{checked:s,icon:e.jsx(oi,{size:14}),label:"Show editor controls",onClick:x,onClose:f}),e.jsx(ce,{checked:i,icon:e.jsx(an,{size:14}),label:"Render Markdown",onClick:N,onClose:f}),e.jsx(ce,{checked:!a,icon:e.jsx(lt,{size:14}),label:"Show diffs first",onClick:k,onClose:f}),e.jsx(ce,{checked:u,icon:e.jsx(ei,{size:14}),label:"Enable word diffs",onClick:E,onClose:f}),e.jsx(ce,{checked:n,icon:e.jsx(ri,{size:14}),label:"Hide white space",onClick:S,onClose:f}),e.jsx(ce,{icon:e.jsx(Qa,{size:14}),label:"Copy git apply command",onClick:h,onClose:f})]})}function ce({checked:t,icon:s,label:n,onClick:a,onClose:i}){return e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{a?.(),i()},children:[s,e.jsx("span",{children:n}),t&&e.jsx(ga,{size:14})]})}function Ki({addMenuOpen:t,expanded:s,filteredFiles:n,dirtyFilePaths:a,openFiles:i,goalDetailsAvailable:u,searchOpen:c,searchQuery:f,selectedPath:h,sideChatTabs:m=[],summaryAvailable:o,sourceStatus:x,sourceSwitcher:S,visibleTab:k,getFileBookmarkStatus:N,onCloseFileTab:E,onCloseSideChat:_,onCloseSearch:I,onOpenFile:G,onOpenBrowser:U,onOpenSearch:B,onOpenSideChat:j,onSearchQueryChange:R,onSetFileBookmarkStatus:T,onSelectFile:M,onSelectFiles:A,onSelectGoal:Q,onSelectSummary:q,onSelectSideChat:z,onToggleAddMenu:H,onToggleExpanded:re}){const le=l.useRef(null);l.useEffect(()=>{if(!t&&!c)return;function w(){t&&H(),c&&I()}function F(de){le.current?.contains(de.target)||w()}function D(de){de.key==="Escape"&&w()}return document.addEventListener("pointerdown",F),document.addEventListener("keydown",D),()=>{document.removeEventListener("pointerdown",F),document.removeEventListener("keydown",D)}},[t,I,H,c]);function Y(w){if(w.key==="Escape"){I();return}w.key==="Enter"&&n[0]&&G(n[0])}function J(w){if(!["ArrowRight","ArrowLeft","Home","End"].includes(w.key))return;const F=w.target;if(!(F instanceof HTMLButtonElement)||F.getAttribute("role")!=="tab")return;const D=Array.from(w.currentTarget.querySelectorAll('button[role="tab"]')),de=D.indexOf(F);if(de<0||D.length===0)return;w.preventDefault();const Et=Na(de,D.length,w.key),Ae=D[Et];if(!Ae)return;Ae.focus(),Ae.click();const X=Ae.id;X&&window.requestAnimationFrame(()=>document.getElementById(X)?.focus())}return e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsxs("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",onKeyDown:J,children:[u?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="goal"?"active":""}`,role:"tab","aria-selected":k==="goal",onClick:Q,children:[e.jsx(lt,{size:14}),e.jsx("span",{children:"Goal"})]}):null,o&&q?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="summary"?"active":""}`,role:"tab","aria-selected":k==="summary",onClick:q,children:[e.jsx(Vs,{size:14}),e.jsx("span",{children:"Summary"})]}):null,e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="files"?"active":""}`,role:"tab",id:"right-sidebar-files-tab","aria-controls":"right-sidebar-files-panel","aria-selected":k==="files",tabIndex:k==="files"?0:-1,onClick:A,children:[e.jsx(yt,{size:14}),e.jsx("span",{children:"Files"})]}),i.map(w=>e.jsxs("div",{className:`workspace-diff-tab file ${k==="file"&&h===w.path?"active":""}`,children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab","aria-selected":k==="file"&&h===w.path,title:w.path,onClick:()=>M(w.path),children:[e.jsx(lt,{className:"workspace-diff-tab-icon",size:13}),a.has(w.path)&&e.jsx("span",{className:"workspace-diff-tab-dirty","aria-hidden":"true"}),e.jsx("span",{children:w.path.split("/").pop()})]}),T?e.jsx(is,{className:"workspace-diff-tab-bookmark-actions",currentStatus:N?.(w.path)??null,onSetStatus:F=>T(w.path,F)}):null,e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${w.path}`,onClick:F=>E(w.path,F),children:e.jsx(Is,{size:12})})]},w.path)),m.map(w=>e.jsxs("div",{className:"workspace-diff-tab right-chat-tab",children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab",id:`right-chat-tab-${w.id}`,"aria-controls":`right-chat-panel-${w.id}`,"aria-selected":!1,tabIndex:-1,title:w.title,onClick:()=>z?.(w.id),children:[w.running?e.jsx("span",{className:"right-chat-status-dot","aria-label":"Running"}):null,e.jsx("span",{children:w.title})]}),_?e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${w.title}`,"aria-label":`Close ${w.title}`,onClick:F=>{F.stopPropagation(),_(w.id)},children:e.jsx(Is,{size:12})}):null]},w.id)),e.jsxs("div",{className:"workspace-diff-add-anchor",ref:le,children:[e.jsx("button",{type:"button",className:`workspace-diff-add-tab ${t||c?"active":""}`,title:"Add","aria-label":"Add to right sidebar",onClick:H,children:e.jsx(ja,{size:15})}),t&&e.jsxs("div",{className:"workspace-diff-add-menu",role:"menu",children:[j?e.jsxs("button",{type:"button",role:"menuitem",onClick:j,children:[e.jsx(va,{size:14}),e.jsx("span",{children:"New task"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:A,children:[e.jsx(yt,{size:14}),e.jsx("span",{children:"Files"}),e.jsx("kbd",{})]}),o&&q?e.jsxs("button",{type:"button",role:"menuitem",onClick:q,children:[e.jsx(Vs,{size:14}),e.jsx("span",{children:"Summary"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:B,children:[e.jsx(ka,{size:14}),e.jsx("span",{children:"Open file"}),e.jsx("kbd",{children:"Ctrl+P"})]}),U?e.jsxs("button",{type:"button",role:"menuitem",onClick:U,children:[e.jsx(wa,{size:14}),e.jsx("span",{children:"Browser"}),e.jsx("kbd",{children:"Ctrl+I"})]}):null]}),c&&e.jsxs("div",{className:"workspace-file-search-popover",children:[e.jsx("input",{autoFocus:!0,placeholder:"Search files",value:f,onChange:w=>R(w.target.value),onKeyDown:Y}),e.jsx("span",{children:"Files"}),e.jsx("div",{className:"workspace-file-search-results",children:n.length===0?e.jsx("small",{children:"Type to search for files"}):n.map(w=>e.jsx("button",{type:"button",onClick:()=>G(w),children:w},w))})]})]})]}),S||x?e.jsxs("div",{className:"workspace-diff-source-bar","aria-label":"Workspace source",children:[S?e.jsx("div",{className:"workspace-diff-source-toggle",role:"group","aria-label":"File source",children:S.options.map(w=>e.jsx("button",{type:"button",className:S.value===w.value?"active":"","aria-pressed":S.value===w.value,onClick:()=>S.onChange(w.value),children:w.label},w.value))}):null,x?e.jsx("span",{className:`workspace-diff-source-status ${x.tone}`,children:x.label}):null]}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:s?"Restore files panel":"Expand files panel","aria-label":s?"Restore files panel":"Expand files panel",onClick:re,children:s?e.jsx(Xa,{size:14}):e.jsx(ya,{size:14})})]})}function qi({canCheckActiveFile:t,canSaveActiveFile:s,collapsed:n,editorControlsVisible:a,editorDiagnosticStatus:i,editorDiagnosticsChecking:u,hideWhiteSpace:c,loadFullFiles:f,menuOpen:h,renderMarkdown:m,showEditorCommandBar:o,showRenderMarkdownToggle:x,splitView:S,wordDiffs:k,wordWrap:N,onCopyGitApply:E,onEditorCheck:_,onEditorRedo:I,onEditorSave:G,onEditorUndo:U,onRefresh:B,onToggleCollapsed:j,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:T,onToggleLoadFullFiles:M,onToggleMenu:A,onToggleRenderMarkdown:Q,onToggleSplitView:q,onToggleWordDiffs:z,onToggleWordWrap:H}){return e.jsx("div",{className:"workspace-diff-toolbar",children:e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsxs("div",{className:"workspace-diff-menu-anchor",children:[e.jsx("button",{type:"button",className:"diff-icon-button",title:"Diff options","aria-haspopup":"menu","aria-expanded":h,onClick:()=>A(),children:e.jsx(Sa,{size:15})}),h&&e.jsx(Gi,{collapsed:n,editorControlsVisible:a,hideWhiteSpace:c,loadFullFiles:f,renderMarkdown:m,wordDiffs:k,wordWrap:N,onClose:()=>A(!1),onCopyGitApply:E,onRefresh:B,onToggleCollapsed:j,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:T,onToggleLoadFullFiles:M,onToggleRenderMarkdown:Q,onToggleWordDiffs:z,onToggleWordWrap:H})]}),o&&e.jsxs("div",{className:"workspace-editor-command-bar","aria-label":"Editor controls",children:[e.jsx("button",{type:"button",className:"diff-icon-button",title:"Save file","aria-label":"Save file",disabled:!s,onClick:G,children:e.jsx(Za,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Undo","aria-label":"Undo",onClick:U,children:e.jsx(hi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Redo","aria-label":"Redo",onClick:I,children:e.jsx(fi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Check file","aria-label":"Check file",disabled:!t,onClick:_,children:u?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(Bs,{size:14})}),i&&e.jsxs("span",{className:`workspace-editor-diagnostic-chip ${i.severity}`,children:[i.severity==="error"||i.severity==="warning"||i.severity==="unavailable"?e.jsx(nn,{size:13}):e.jsx(Bs,{size:13}),e.jsx("span",{children:i.label})]})]}),x&&e.jsx("button",{type:"button",className:`diff-icon-button ${m?"active":""}`,title:m?"Show Markdown source":"Render Markdown","aria-label":m?"Show Markdown source":"Render Markdown","aria-pressed":m,onClick:Q,children:e.jsx(an,{size:14})}),e.jsx("button",{type:"button",className:`diff-icon-button ${S?"active":""}`,title:S?"Show unified diff":"Show split diff","aria-label":S?"Show unified diff":"Show split diff","aria-pressed":S,onClick:q,children:e.jsx(ai,{size:14})})]})})}const Xi={cjs:"typescript",css:"css",html:"html",js:"typescript",json:"json",jsx:"typescript",md:"markdown",mjs:"typescript",py:"python",sh:"shell",ts:"typescript",tsx:"typescript",yaml:"yaml",yml:"yaml"};function rs(t){const s=t.split("/").pop()?.toLowerCase()??"";if(s==="dockerfile")return"shell";if(s==="readme"||s==="readme.md")return"markdown";const n=s.includes(".")?s.split(".").pop()??"":"";return Xi[n]??"text"}function Zi(t,s){return t?s==="markdown"?Qi(t):s==="json"?Fe(t,/("(?:\\.|[^"\\])*"(?=\s*:)|"(?:\\.|[^"\\])*"|[-]?\b\d+(?:\.\d+)?\b|\btrue\b|\bfalse\b|\bnull\b|[{}[\]:,])/g):s==="css"?Fe(t,/(\/\*.*?\*\/|#[\da-fA-F]{3,8}\b|--[\w-]+|[.#]?[\w-]+(?=\s*:)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b\d+(?:\.\d+)?(?:px|rem|em|%|vh|vw)?\b|[{}():;,])/g):s==="html"?Fe(t,/(<!--.*?-->|<\/?[\w-]+|[\w:-]+(?==)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[<>/=])/g):s==="shell"?Fe(t,/(#.*$|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:cd|cp|export|git|npm|pnpm|bun|yarn|rm|mkdir|test|if|then|fi|for|do|done|echo)\b|\$[\w_]+|&&|\|\||[|&;=])/g):s==="python"?Fe(t,/(#.*$|"""[\s\S]*?"""|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:class|def|return|if|elif|else|for|while|try|except|finally|with|as|import|from|None|True|False|async|await|lambda|yield)\b|\b[A-Z][\w]*\b|\b\d+(?:\.\d+)?\b|[+\-*/%=<>!&|.:,()[\]{}]+)/g):Fe(t,/(\/\/.*$|\/\*.*?\*\/|`(?:\\.|[^`\\])*`|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b(?:abstract|as|async|await|boolean|break|case|catch|class|const|continue|default|else|enum|export|extends|false|finally|for|from|function|if|import|in|interface|let|new|null|number|of|return|string|switch|throw|true|try|type|undefined|void|while)\b|\b[A-Z][\w]*\b|\b\d+(?:\.\d+)?\b|[+\-*/%=<>!&|?:.,()[\]{}]+)/g):[{text:" ",kind:"plain"}]}function Qi(t){return/^\s{0,3}#{1,6}\s/.test(t)?[{text:t,kind:"keyword"}]:/^\s*[-*+]\s/.test(t)?[{text:t,kind:"property"}]:Fe(t,/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)]+\)|https?:\/\/\S+)/g)}function Yi(t){return/^(\/\/|#|\/\*|<!--)/.test(t)?"comment":/^["'`]/.test(t)?"string":/^[-]?\d/.test(t)||/^#[\da-fA-F]{3,8}\b/.test(t)?"number":/^\b[A-Z]/.test(t)?"type":/^[.#]?[\w-]+$/.test(t)&&t.includes("-")?"property":/^(?:[{}()[\],.:;<>/=+\-*&|!?%]+)$/.test(t)?"operator":/^(?:--|\$)/.test(t)?"property":"keyword"}function Fe(t,s){const n=[];let a=0;for(const i of t.matchAll(s)){const u=i.index??0;u>a&&n.push({text:t.slice(a,u),kind:"plain"});const c=i[0];if(n.push({text:c,kind:Yi(c)}),a=u+c.length,/^(\/\/|#|<!--)/.test(c))break}return a<t.length&&n.push({text:t.slice(a),kind:"plain"}),n.length>0?n:[{text:t,kind:"plain"}]}function Nt({language:t,text:s}){return e.jsx(e.Fragment,{children:Zi(s,t).map((n,a)=>e.jsx("span",{className:`syntax-token ${n.kind}`,children:n.text},`${a}-${n.text}`))})}const Ji=`
3
3
 
4
- [file truncated]`,er=l.lazy(()=>fa(()=>import("./WorkspaceMonacoEditor-BOa6xAaO.js").then(t=>t.jc),__vite__mapDeps([0,1,2,3]),import.meta.url)),Jt=6,tr=18,$e=22,Qs=44,sr=160,Ys=12;function Ct({path:t,workspaceName:s,workspaceRootPath:n,onSelectPath:a}){const i=ss(t,n),u=Ra(i),c=u?nr(i):s?.trim()||"Workspace",h=(u&&c!=="/"&&i.startsWith(`${c}/`)?i.slice(c.length+1):i).split("/").filter(Boolean),m=!!(a&&!u);return e.jsxs("span",{className:"workspace-file-breadcrumbs",title:u?i:`${c} > ${i}`,children:[a&&!u?e.jsx("button",{type:"button",onClick:()=>a(null),children:c}):e.jsx("span",{children:c}),h.map((o,x)=>{const S=x===h.length-1,k=h.slice(0,x+1).join("/");return e.jsxs("span",{className:"workspace-file-breadcrumb-segment",children:[e.jsx($a,{size:13}),a&&m&&!S?e.jsx("button",{type:"button",onClick:()=>a(k),children:o}):e.jsx("span",{children:o})]},`${x}-${o}`)})]})}function nr(t){const s=/^[A-Za-z]:\//.exec(t);return s?s[0].slice(0,-1):"/"}function ar({collapsed:t=!1,diagnostics:s=[],draftContent:n,editable:a=!1,editorRef:i,error:u,file:c,hideWhiteSpace:f=!1,headerActions:h,imageSrc:m,loading:o,loadFullFiles:x,onOpenImage:S,onSelectBreadcrumbPath:k,onDraftContentChange:N,onLspAction:E,onSave:_,renderMarkdown:I,saveError:G,saving:U=!1,splitView:B=!1,wordDiffs:j=!1,wordWrap:R,workspaceName:T,workspaceRootPath:M}){Ee(u,{prefix:"File preview"}),Ee(G,{prefix:"Save failed"});const A=n??c.content??"",Q=l.useMemo(()=>A.split(`
4
+ [file truncated]`,er=l.lazy(()=>fa(()=>import("./WorkspaceMonacoEditor-C2cNf0UO.js").then(t=>t.jc),__vite__mapDeps([0,1,2,3]),import.meta.url)),Jt=6,tr=18,$e=22,Qs=44,sr=160,Ys=12;function Ct({path:t,workspaceName:s,workspaceRootPath:n,onSelectPath:a}){const i=ss(t,n),u=Ra(i),c=u?nr(i):s?.trim()||"Workspace",h=(u&&c!=="/"&&i.startsWith(`${c}/`)?i.slice(c.length+1):i).split("/").filter(Boolean),m=!!(a&&!u);return e.jsxs("span",{className:"workspace-file-breadcrumbs",title:u?i:`${c} > ${i}`,children:[a&&!u?e.jsx("button",{type:"button",onClick:()=>a(null),children:c}):e.jsx("span",{children:c}),h.map((o,x)=>{const S=x===h.length-1,k=h.slice(0,x+1).join("/");return e.jsxs("span",{className:"workspace-file-breadcrumb-segment",children:[e.jsx($a,{size:13}),a&&m&&!S?e.jsx("button",{type:"button",onClick:()=>a(k),children:o}):e.jsx("span",{children:o})]},`${x}-${o}`)})]})}function nr(t){const s=/^[A-Za-z]:\//.exec(t);return s?s[0].slice(0,-1):"/"}function ar({collapsed:t=!1,diagnostics:s=[],draftContent:n,editable:a=!1,editorRef:i,error:u,file:c,hideWhiteSpace:f=!1,headerActions:h,imageSrc:m,loading:o,loadFullFiles:x,onOpenImage:S,onSelectBreadcrumbPath:k,onDraftContentChange:N,onLspAction:E,onSave:_,renderMarkdown:I,saveError:G,saving:U=!1,splitView:B=!1,wordDiffs:j=!1,wordWrap:R,workspaceName:T,workspaceRootPath:M}){Ee(u,{prefix:"File preview"}),Ee(G,{prefix:"Save failed"});const A=n??c.content??"",Q=l.useMemo(()=>A.split(`
5
5
  `).slice(0,800),[A]),q=rs(c.path),z=n!=null||c.content!=null,H=A.endsWith(Ji),re=I&&z&&ts(c.path),le=z&&Ca(c.path)&&cr(A);return m?e.jsxs("div",{className:"workspace-file-preview",children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:c.path,workspaceName:T,workspaceRootPath:M,onSelectPath:k}),e.jsxs("span",{className:"diff-addition",children:["+",c.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",c.deletions]})]}),h]}),e.jsx("div",{className:"workspace-file-image-stage",children:e.jsx("button",{type:"button",className:"workspace-file-image-button","aria-label":`Open image preview for ${c.path}`,onClick:S,children:e.jsx("img",{alt:c.path,decoding:"async",src:m})})})]}):!x&&c.patch||!z&&c.patch?B?e.jsx(rr,{collapsed:t,file:c,hideWhiteSpace:f,onSelectBreadcrumbPath:k,wordDiffs:j,wordWrap:R,headerActions:h,workspaceName:T,workspaceRootPath:M}):e.jsx(ir,{collapsed:t,file:c,hideWhiteSpace:f,wordWrap:R,workspaceName:T,workspaceRootPath:M,onSelectBreadcrumbPath:k,headerActions:h}):e.jsxs("div",{className:`workspace-file-preview ${R?"wrap":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:c.path,workspaceName:T,workspaceRootPath:M,onSelectPath:k}),e.jsxs("span",{className:"diff-addition",children:["+",c.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",c.deletions]})]}),e.jsxs("span",{className:"workspace-file-heading-end",children:[U?e.jsx("span",{className:"workspace-file-save-state",children:"Saving"}):null,h]})]}),z?re?e.jsx("div",{className:"workspace-markdown-preview",children:e.jsx(_a,{content:A})}):le?e.jsx(lr,{file:c,contentBase64:A}):a&&!H?e.jsx(l.Suspense,{fallback:e.jsx("div",{className:"workspace-diff-code-empty",children:"Loading editor"}),children:e.jsx(er,{diagnostics:s,filePath:c.path,onChange:Y=>N?.(Y),onLspAction:E,onSave:()=>_?.(),ref:i,value:A,wordWrap:R})}):e.jsx("div",{className:"workspace-file-code",children:Q.map((Y,J)=>e.jsxs("div",{className:"workspace-file-code-row",children:[e.jsx("span",{children:J+1}),e.jsx("code",{children:e.jsx(Nt,{language:q,text:Y||" "})})]},`${J}-${Y}`))}):e.jsx("div",{className:"workspace-diff-code-empty",children:o?"Loading file content":"No file content available."})]})}function ir({collapsed:t=!1,file:s,hideWhiteSpace:n=!1,wordWrap:a,workspaceName:i,workspaceRootPath:u,onSelectBreadcrumbPath:c,headerActions:f}){const h=l.useMemo(()=>pn(s.patch,n),[s.patch,n]),m=rs(s.path);return e.jsxs("div",{className:`workspace-diff-preview ${a?"wrap":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:s.path,workspaceName:i??null,workspaceRootPath:u,onSelectPath:c}),e.jsxs("span",{className:"diff-addition",children:["+",s.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",s.deletions]})]}),f]}),t?e.jsx("div",{className:"workspace-diff-code-empty",children:"Diff collapsed"}):e.jsx(fn,{ariaLabel:`${s.path} diff`,className:"workspace-diff-code",emptyMessage:"No patch available.",rows:h,renderRow:(o,x)=>o.kind==="spacer"?e.jsx("div",{className:"workspace-diff-spacer",role:"row",children:o.label},`${o.label}-${x}`):e.jsxs("div",{className:`workspace-diff-code-row ${o.kind}`,role:"row",children:[e.jsx("span",{className:"workspace-diff-line-number",role:"cell",children:o.newLine||o.oldLine}),e.jsx("code",{role:"cell",children:e.jsx(Nt,{language:m,text:o.newContent||o.oldContent||" "})})]},`${o.oldLine}-${o.newLine}-${x}`),wordWrap:a})]})}function rr({collapsed:t,file:s,hideWhiteSpace:n,wordDiffs:a,wordWrap:i,workspaceName:u,workspaceRootPath:c,onSelectBreadcrumbPath:f,headerActions:h}){const m=l.useMemo(()=>pn(s.patch,n),[s.patch,n]),o=rs(s.path);return e.jsxs("div",{className:`workspace-diff-preview split ${i?"wrap":""} ${a?"word-diffs":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:s.path,workspaceName:u,workspaceRootPath:c,onSelectPath:f}),e.jsxs("span",{className:"diff-addition",children:["+",s.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",s.deletions]})]}),e.jsxs("span",{className:"workspace-file-heading-end",children:[h,e.jsx(Ya,{size:14})]})]}),t?e.jsx("div",{className:"workspace-diff-code-empty",children:"Diff collapsed"}):e.jsx(fn,{ariaLabel:`${s.path} split diff`,className:"workspace-split-code",emptyMessage:"No patch available.",rows:m,renderRow:(x,S)=>x.kind==="spacer"?e.jsx("div",{className:"workspace-diff-spacer split",role:"row",children:x.label},`${x.label}-${S}`):e.jsxs("div",{className:`workspace-split-row ${x.kind}`,role:"row",children:[e.jsx("span",{className:"workspace-diff-line-number old",role:"cell",children:x.oldLine}),e.jsx("code",{className:"old",role:"cell",children:e.jsx(Nt,{language:o,text:x.oldContent||" "})}),e.jsx("span",{className:"workspace-diff-line-number new",role:"cell",children:x.newLine}),e.jsx("code",{className:"new",role:"cell",children:e.jsx(Nt,{language:o,text:x.newContent||" "})})]},`${x.oldLine}-${x.newLine}-${S}`),wordWrap:i})]})}function lr({file:t,contentBase64:s}){const n=l.useMemo(()=>{const a=dr(s);if(!a)return null;const i=new Blob([new Uint8Array(a)],{type:or(t.path)});return URL.createObjectURL(i)},[s,t.path]);return l.useEffect(()=>()=>{n&&URL.revokeObjectURL(n)},[n]),n?e.jsxs("div",{className:"workspace-document-preview",children:[e.jsxs("div",{className:"workspace-document-preview-card",children:[e.jsx("strong",{children:t.path.split("/").pop()}),e.jsx("span",{children:/\.pdf$/i.test(t.path)?"PDF document":"Word document"}),e.jsx("a",{href:n,download:t.path.split("/").pop()||"document",children:"Download document"})]}),e.jsx("iframe",{src:n,title:`${t.path} preview`})]}):e.jsx("div",{className:"workspace-diff-code-empty",children:"Document preview unavailable."})}function or(t){return/\.pdf$/i.test(t)?"application/pdf":/\.docx$/i.test(t)?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"application/msword"}function cr(t){return t.length>0&&/^[A-Za-z0-9+/=\s]+$/.test(t)}function dr(t){try{const s=atob(t.replace(/\s/g,"")),n=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)n[a]=s.charCodeAt(a);return n}catch{return null}}function fn({ariaLabel:t,className:s,emptyMessage:n,rows:a,renderRow:i,wordWrap:u}){const c=!u&&a.length>sr,{endIndex:f,offsetTop:h,scrollRef:m,startIndex:o,totalHeight:x}=ur(a.length,c);return a.length===0?e.jsx("div",{className:s,role:"table","aria-label":t,children:e.jsx("div",{className:"workspace-diff-code-empty",children:n})}):c?e.jsx("div",{className:`${s} virtualized`,ref:m,role:"table","aria-label":t,"aria-rowcount":a.length,children:e.jsx("div",{className:"workspace-diff-virtual-spacer",style:{height:x},children:e.jsx("div",{className:"workspace-diff-virtual-window",style:{transform:`translateY(${h}px)`},children:a.slice(o,f).map((S,k)=>i(S,o+k))})})}):e.jsx("div",{className:s,role:"table","aria-label":t,children:a.map(i)})}function ur(t,s){const n=l.useRef(null),[a,i]=l.useState({height:$e*Qs,scrollTop:0}),u=l.useCallback(()=>{const m=n.current;m&&i({height:m.clientHeight||$e*Qs,scrollTop:m.scrollTop})},[]);if(l.useEffect(()=>{if(!s)return;const m=n.current;if(!m)return;u();let o=0;const x=()=>{if(typeof window>"u"){u();return}window.cancelAnimationFrame(o),o=window.requestAnimationFrame(u)};m.addEventListener("scroll",x,{passive:!0});const S=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>x());return S?.observe(m),()=>{m.removeEventListener("scroll",x),S?.disconnect(),typeof window<"u"&&window.cancelAnimationFrame(o)}},[s,u]),!s)return{endIndex:t,offsetTop:0,scrollRef:n,startIndex:0,totalHeight:t*$e};const c=Math.ceil(a.height/$e),f=Math.max(0,Math.floor(a.scrollTop/$e)-Ys);return{endIndex:Math.min(t,f+c+Ys*2),offsetTop:f*$e,scrollRef:n,startIndex:f,totalHeight:t*$e}}function pn(t,s){if(!t.trim())return[];const n=[];let a=0,i=0,u=null,c=null,f=!1,h=[];function m(){n.push(...fr(h)),h=[]}function o(){f&&(m(),u=a,c=i,f=!1)}for(const x of t.split(`
6
6
  `)){const S=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(x);if(S){o();const E=Number(S[1]),_=Number(S[2]);if(u!==null&&c!==null){const I=Math.max(E-u,_-c,0);I>0&&n.push({kind:"spacer",label:hn(I)})}a=E,i=_,f=!0;continue}if(x.startsWith("diff --git")||x.startsWith("index ")||x.startsWith("--- ")||x.startsWith("+++ ")||!f||x.startsWith("\\ No newline"))continue;const k=x.slice(1)||" ";if(s&&!k.trim())continue;if(x.startsWith("+")){m(),n.push({kind:"addition",oldLine:"",newLine:String(i||""),oldContent:"",newContent:k}),i+=1;continue}if(x.startsWith("-")){m(),n.push({kind:"deletion",oldLine:String(a||""),newLine:"",oldContent:k,newContent:""}),a+=1;continue}const N=x.startsWith(" ")?x.slice(1)||" ":x||" ";s&&!N.trim()||(h.push({kind:"context",oldLine:String(a||""),newLine:String(i||""),oldContent:N,newContent:N}),a+=1,i+=1)}return o(),n}function fr(t){if(t.length<tr)return t;const s=t.length-Jt*2;return s<=0?t:[...t.slice(0,Jt),{kind:"spacer",label:hn(s)},...t.slice(-Jt)]}function hn(t){return`${t} unmodified ${t===1?"line":"lines"}`}const Rt=`
7
7
 
@@ -1,4 +1,4 @@
1
- import{r as m,j as t}from"./index-C0gdp_hv.js";import{c as ut,bd as Ye,be as Mt,bf as Ut,X as mt,bg as Ae,aK as Lt,bh as Ne,aV as Ot,I as Ft,a$ as at,E as Bt,bi as Dt,aP as Gt,aB as Tt,bj as kt,bk as st,v as O,aJ as Vt,ba as Ht,S as Xt,bc as Je,C as Jt,aq as Kt,h as Qt}from"./App-BqgpZNh-.js";import{I as Zt}from"./info-CXzXdZ1o.js";import{P as $e}from"./play-BnkiBq8x.js";import{G as Yt}from"./git-commit-horizontal-75RSWQ3Q.js";import{R as Ke}from"./refresh-cw-BISaiIBt.js";import{S as Wt}from"./square-Bn32OIid.js";import{U as rt}from"./upload-AB1N3bCZ.js";const en=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],tn=ut("hammer",en);const nn=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],an=ut("monitor",nn);function sn(e){const n=te(e?.data),a=te(n.preview);return(typeof a.url=="string"?a.url.trim():"")||null}function rn(){const e=window.open("","_blank");return e?(e.document.write('<!doctype html><title>Opening sandbox preview</title><body style="margin:0;background:#05070a;color:#f5f5f4;font:14px system-ui,sans-serif;display:grid;place-items:center;height:100vh;">Opening sandbox preview...</body>'),e.document.close(),e):null}function ye(e,n){if(!n){e?.close();return}if(e){e.opener=null,e.location.href=n;return}window.open(n,"_blank","noopener,noreferrer")}function pt(e){const n=ln(e),a=on(te(e?.resources)),i=te(te(e?.inputs).schema),g=te(i.properties),u=new Set(ft(i.required)),l=[],x=[];for(const[p,N]of Object.entries(g)){const c=te(N),U=te(c["x-openpond-upload"]??c.xOpenPondUpload),I=typeof c.type=="string"?c.type:"string",V=te(c.items),z=gn(c,U),v=c.format==="file"||U.enabled===!0||I==="array"&&V.format==="file",q=typeof c.title=="string"&&c.title.trim()?c.title.trim():hn(p);if(v){x.push({name:p,label:q,required:u.has(p),multiple:I==="array"||U.multiple===!0,accept:bn(U,c),targetPath:fn(U,p),targetNames:z});continue}(I==="string"||I==="number"||I==="integer"||I==="boolean")&&l.push({name:p,label:q,required:u.has(p),type:I,defaultValue:typeof c.default=="string"||typeof c.default=="number"||typeof c.default=="boolean"?String(c.default):"",targetNames:z})}return{entrypoints:n,scalarInputs:l,fileInputs:x,envInputs:dn(e),resources:a,volumes:cn(e,x),schedules:un(e)}}function Fe(e,n){const a=n.trim();return e.filter(i=>!i.targetNames||i.targetNames.length===0?!0:i.targetNames.includes(a))}function ln(e){return e?Ye(e).flatMap(n=>{if(n.kind==="action")return[];const a=n.name.trim(),i=n.command.trim(),g=Be(n.timeoutSeconds),u=n.ports.flatMap(l=>{const x=Be(l.port);return x?[{port:x,label:typeof l.label=="string"&&l.label.trim()?l.label.trim():"web",access:l.access==="public"?"public":"private",path:typeof l.path=="string"&&l.path.trim()?l.path.trim():"/"}]:[]});return a&&i?[{name:a,command:i,timeoutSeconds:g,ports:u}]:[]}):[]}function on(e){return{cpu:Qe(e.cpu)??1,memoryGb:Qe(e.memoryGb)??1,diskGb:Qe(e.diskGb)??8}}function cn(e,n){const a=Array.isArray(e?.volumes)?e.volumes:[];if(a.length>0)return a.map((u,l)=>{const x=l===0?"volume":`volume-${l+1}`,p=typeof u.name=="string"&&u.name.trim()?u.name.trim():x;return{name:p,mountPath:typeof u.mountPath=="string"&&u.mountPath.trim()?u.mountPath.trim():`/workspace/volumes/${p}`,...Be(u.storageGb)?{storageGb:Be(u.storageGb)??void 0}:{},deleteOnSandboxDelete:u.deleteOnSandboxDelete===!0}});const i=n.find(u=>u.targetPath.startsWith("volumes/"));if(!i)return[];const[,g="volume"]=i.targetPath.split("/");return[{name:g,mountPath:`/workspace/volumes/${g}`,storageGb:8,deleteOnSandboxDelete:!1}]}function dn(e){return(Array.isArray(e?.inputs.env)?e.inputs.env:[]).flatMap(a=>{const i=typeof a.name=="string"?a.name.trim():"";return i?[{name:i,required:a.required===!0,secret:a.secret!==!1,description:typeof a.description=="string"?a.description.trim():""}]:[]})}function un(e){return e?.schedules?.length?e.schedules.flatMap(n=>{const a=typeof n.name=="string"?n.name.trim():"",i=mn(n);if(!a||!i.scheduleExpression)return[];try{return[{name:a,...typeof n.description=="string"&&n.description.trim()?{description:n.description.trim()}:{},enabled:!1,...i,...typeof n.timezone=="string"&&n.timezone.trim()?{timezone:n.timezone.trim()}:{},...typeof n.startAt=="string"&&n.startAt.trim()?{startAt:n.startAt.trim()}:{},...typeof n.endAt=="string"&&n.endAt.trim()?{endAt:n.endAt.trim()}:{},...typeof n.maxRuns=="number"&&Number.isInteger(n.maxRuns)&&n.maxRuns>0?{maxRuns:n.maxRuns}:{},runtimePolicy:n.runtimePolicy,target:pn(e,n),...n.budget?{budget:n.budget}:{},...n.resources?{resources:n.resources}:{},...n.quotas?{quotas:n.quotas}:{},...n.lifecycle?{lifecycle:n.lifecycle}:{},...n.retentionPolicy?{retentionPolicy:n.retentionPolicy}:{},...n.env?{env:n.env}:{},...n.integrationLeases?{integrationLeases:n.integrationLeases}:{},metadata:{...te(n.metadata),manifestScheduleName:a,source:"openpond-app-sandbox-template-start"}}]}catch{return[]}}):[]}function mn(e){return e.scheduleExpression?{scheduleType:e.scheduleType??"cron",scheduleExpression:e.scheduleExpression}:e.rate?{scheduleType:"rate",scheduleExpression:/^rate\(/i.test(e.rate)?e.rate:`rate(${e.rate})`}:e.once?{scheduleType:"once",scheduleExpression:/^at\(/i.test(e.once)?e.once:`at(${e.once})`}:{scheduleType:"cron",scheduleExpression:e.cron??""}}function pn(e,n){const a=n.command??n.target?.command??null;if(a)return{kind:"command",command:a,requiresStart:n.requiresStart??n.target?.requiresStart??!1};const i=n.target?.kind??"action";if(i==="start")return{kind:"command",command:e.start.command,requiresStart:n.requiresStart??n.target?.requiresStart??e.start.requiresStart??!1};if(i==="service"){const l=n.target?.name??"",x=e.services.find(p=>p.name===l);if(!x)throw new Error("schedule_service_target_missing");return{kind:"command",command:x.command,requiresStart:n.requiresStart??n.target?.requiresStart??x.requiresStart??!1}}const g=n.actionName??n.action??n.target?.actionName??(n.target?.kind==="action"?n.target?.name:void 0),u=e.actions.find(l=>l.name===g);if(!u)throw new Error("schedule_action_target_missing");return{kind:"command",command:u.command,requiresStart:n.requiresStart??n.target?.requiresStart??u.requiresStart??!1}}function gt(e,n){return e.flatMap(a=>{const i=(n[a.name]??"").trim();return i?[{name:a.name,secretRef:i}]:[]})}function bt(e,n){const a={};for(const i of e){const g=n[i.name]??"";if(!(!g.trim()&&!i.required))if(i.type==="boolean")a[i.name]=g==="true";else if(i.type==="number"||i.type==="integer"){const u=Number(g);Number.isFinite(u)&&(a[i.name]=i.type==="integer"?Math.trunc(u):u)}else a[i.name]=g}return a}function gn(e,n){const a=e["x-openpond-targets"]??e.xOpenPondTargets??n.targets??n.actions,i=ft(a).map(g=>g.trim()).filter(Boolean);return i.length>0?[...new Set(i)]:null}function bn(e,n){return typeof e.accept=="string"?e.accept.trim():Array.isArray(e.accept)?e.accept.filter(a=>typeof a=="string").join(","):typeof n.accept=="string"?n.accept.trim():""}function fn(e,n){return(typeof e.targetPath=="string"&&e.targetPath.trim()?e.targetPath.trim():typeof e.path=="string"&&e.path.trim()?e.path.trim():`uploads/${n}`).replace(/^\/+/,"").replace(/^workspace\//,"").replace(/\/+$/,"")}function Qe(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:null}function Be(e){const n=Number(e);return Number.isInteger(n)&&n>0?n:null}function xn(e,n){return[n,...e.slice(1)]}function ft(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}function hn(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function te(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function jn({busy:e,defaultRepoUrl:n,projectName:a,commitBeforeCreate:i,templateManifest:g,uploadBeforeCreate:u,onClose:l,onSubmit:x}){const p=m.useMemo(()=>pt(g),[g]),N=p.entrypoints[0]??null,[c,U]=m.useState(n),[I,V]=m.useState(N?.name??""),[z,v]=m.useState(N?.command??""),[q,H]=m.useState(N?.timeoutSeconds?String(N.timeoutSeconds):""),[X,b]=m.useState(`Update ${a}`),[j,A]=m.useState("0.05"),[_,F]=m.useState(()=>Object.fromEntries(p.scalarInputs.map(r=>[r.name,r.defaultValue]))),[B,ae]=m.useState(()=>Object.fromEntries(p.envInputs.map(r=>[r.name,""]))),[Z,fe]=m.useState({}),K=p.volumes[0]??null,[Y,o]=m.useState(p.volumes.length>0||p.fileInputs.length>0),[P,w]=m.useState(K?.name??"volume"),[R,$]=m.useState(K?.mountPath??"/workspace/volumes/volume"),[J,ce]=m.useState(String(K?.storageGb??8)),[Pe,de]=m.useState(!(K?.deleteOnSandboxDelete??!1)),[M,ze]=m.useState(p.schedules),qe=p.entrypoints.find(r=>r.name===I)??N,se=qe?.ports??[],re=se[0]??null,[ue,xe]=m.useState(!!re),[Ce,me]=m.useState(re?String(re.port):""),D=Number(Ce),he=Number(j),ie=Number(J),le=Number(q),ke=!q.trim()||Number.isInteger(le)&&le>0&&le<=86400,oe=!ue||Number.isInteger(D)&&D>=Mt&&D<=Ut&&se.some(r=>r.port===D),Ie=Number.isFinite(he)&&he>0,ne=!Y||Number.isInteger(ie)&&ie>0,G=M.every(r=>!r.enabled||!!r.scheduleExpression.trim()),W=Fe(p.scalarInputs,I),je=Fe(p.fileInputs,I),Me=p.envInputs.every(r=>!r.required||!!(B[r.name]??"").trim()),ve=p.envInputs.filter(r=>r.required&&!(B[r.name]??"").trim()),Re=(u||!!c.trim())&&!!z.trim()&&Ie&&ke&&ne&&W.every(r=>!r.required||!!(_[r.name]??"").trim())&&je.every(r=>!r.required||(Z[r.name]?.length??0)>0)&&Me&&G&&oe;function Ve(r){V(r);const f=p.entrypoints.find(E=>E.name===r);if(!f)return;v(f.command),H(f.timeoutSeconds?String(f.timeoutSeconds):"");const y=f.ports[0]??null;me(y?String(y.port):""),xe(!!y)}function _e(r,f){F(y=>({...y,[r]:f}))}function pe(r,f){ae(y=>({...y,[r]:f}))}function He(r,f){const y=Array.from(f.target.files??[]);fe(E=>({...E,[r.name]:r.multiple?y:y.slice(0,1)}))}function ee(r,f){ze(y=>y.map((E,ge)=>ge===r?{...E,...f}:E))}function Ee(r){r.preventDefault(),!(!Re||e)&&x({repoUrl:c.trim(),command:z.trim(),entrypointName:I,commitMessage:X.trim(),budgetUsd:j.trim(),params:bt(W,_),env:gt(p.envInputs,B),timeoutSeconds:q.trim()&&Number.isInteger(le)?le:qe?.timeoutSeconds??null,uploads:je.flatMap(f=>{const y=Z[f.name]??[];return y.length>0?[{inputName:f.name,label:f.label,targetPath:f.targetPath,multiple:f.multiple,files:y}]:[]}),resources:p.resources,volumes:Y?xn(p.volumes,{...P.trim()?{name:P.trim()}:{},...R.trim()?{mountPath:R.trim()}:{},...Number.isInteger(ie)&&ie>0?{storageGb:ie}:{},deleteOnSandboxDelete:!Pe}):[],schedules:M.filter(f=>f.enabled),openPreview:ue,previewPort:ue?D:null,previewLabel:se.find(f=>f.port===D)?.label??"web",previewAccess:se.find(f=>f.port===D)?.access??"private"})}return t.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:t.jsxs("form",{className:"git-dialog run-once-dialog sandbox-start-dialog",role:"dialog","aria-modal":"true","aria-label":"Start sandbox",onSubmit:Ee,children:[t.jsx("button",{className:"git-dialog-close",disabled:e,type:"button",title:"Close","aria-label":"Close",onClick:l,children:t.jsx(mt,{size:15})}),t.jsxs("div",{className:"sandbox-start-dialog-heading",children:[t.jsx("div",{className:"git-dialog-icon",children:t.jsx(Ae,{size:18})}),t.jsx("h2",{children:"Start sandbox"}),t.jsxs("div",{className:"git-dialog-row",children:[t.jsx("span",{children:"Project"}),t.jsx("strong",{children:a})]})]}),t.jsxs("div",{className:"sandbox-start-dialog-body",children:[u?null:t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Repository"}),t.jsx("input",{disabled:e,value:c,onChange:r=>U(r.target.value)})]}),i?t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Commit message"}),t.jsx("input",{disabled:e,value:X,onChange:r=>b(r.target.value)})]}):null,p.entrypoints.length>0?t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Run target"}),t.jsx("select",{disabled:e,value:I,onChange:r=>Ve(r.target.value),children:p.entrypoints.map(r=>t.jsx("option",{value:r.name,children:r.name},r.name))})]}):null,t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Shell command"}),t.jsx("input",{disabled:e,value:z,onChange:r=>v(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Timeout seconds"}),t.jsx("input",{disabled:e,inputMode:"numeric",value:q,onChange:r=>H(r.target.value)})]}),W.map(r=>r.type==="boolean"?t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:(_[r.name]??"")==="true",disabled:e,type:"checkbox",onChange:f=>_e(r.name,f.target.checked?"true":"false")}),t.jsx("span",{}),r.label]},r.name):t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:r.label}),t.jsx("input",{disabled:e,inputMode:r.type==="number"||r.type==="integer"?"decimal":void 0,value:_[r.name]??"",onChange:f=>_e(r.name,f.target.value)})]},r.name)),je.map(r=>t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:r.label}),t.jsx("input",{accept:r.accept||void 0,disabled:e,multiple:r.multiple,type:"file",onChange:f=>He(r,f)})]},r.name)),p.envInputs.length>0?t.jsxs("div",{className:"sandbox-start-env-section",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Environment"}),ve.length>0?t.jsxs("p",{className:"sandbox-start-env-warning",role:"status",children:["Required sandbox secret ref missing: ",ve.map(r=>r.name).join(", ")]}):null,p.envInputs.map(r=>{const f=B[r.name]??"",y=r.required&&!f.trim(),E=`sandbox-env-${r.name}-description`;return t.jsxs("label",{className:"git-dialog-field",children:[t.jsxs("span",{children:[r.name,r.required?" *":""]}),t.jsx("input",{"aria-describedby":E,"aria-invalid":y,disabled:e,placeholder:"openpond://secret/...",value:f,onChange:ge=>pe(r.name,ge.target.value)}),t.jsx("small",{id:E,children:y?"Add a sandbox secret ref before starting.":r.description||"Sandbox secret ref only."})]},r.name)})]}):null,je.length>0||p.volumes.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:Y,disabled:e,type:"checkbox",onChange:r=>o(r.target.checked)}),t.jsx("span",{}),"Mount volume"]}),Y?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"run-once-dialog-grid",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Volume"}),t.jsx("input",{disabled:e,value:P,onChange:r=>w(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Storage GiB"}),t.jsx("input",{disabled:e,inputMode:"numeric",value:J,onChange:r=>ce(r.target.value)})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Mount path"}),t.jsx("input",{disabled:e,value:R,onChange:r=>$(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:Pe,disabled:e,type:"checkbox",onChange:r=>de(r.target.checked)}),t.jsx("span",{}),"Keep volume"]})]}):null]}):null,M.length>0?t.jsxs("div",{className:"sandbox-start-schedules",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Schedules"}),M.map((r,f)=>t.jsxs("div",{className:"sandbox-start-schedule-row",children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:r.enabled,disabled:e,type:"checkbox",onChange:y=>ee(f,{enabled:y.target.checked})}),t.jsx("span",{}),r.name]}),t.jsxs("div",{className:"run-once-dialog-grid",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Type"}),t.jsxs("select",{disabled:e||!r.enabled,value:r.scheduleType,onChange:y=>ee(f,{scheduleType:y.target.value}),children:[t.jsx("option",{value:"rate",children:"Rate"}),t.jsx("option",{value:"cron",children:"Cron"}),t.jsx("option",{value:"once",children:"Once"})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Max runs"}),t.jsx("input",{disabled:e||!r.enabled,inputMode:"numeric",value:r.maxRuns??"",onChange:y=>{const E=Number(y.target.value);ee(f,{maxRuns:Number.isInteger(E)&&E>0?E:null})}})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Expression"}),t.jsx("input",{disabled:e||!r.enabled,value:r.scheduleExpression,onChange:y=>ee(f,{scheduleExpression:y.target.value})})]})]},r.name))]}):null,t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Budget"}),t.jsx("input",{disabled:e,inputMode:"decimal",value:j,onChange:r=>A(r.target.value)})]}),se.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:ue,disabled:e,type:"checkbox",onChange:r=>xe(r.target.checked)}),t.jsx("span",{}),"Open preview"]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Preview port"}),t.jsx("select",{disabled:e||!ue,value:Ce,onChange:r=>me(r.target.value),children:se.map(r=>t.jsx("option",{value:r.port,children:r.label?`${r.label} (${r.port})`:r.port},r.port))})]})]}):null]}),t.jsxs("div",{className:"git-dialog-footer sandbox-start-dialog-footer",children:[t.jsx("button",{className:"git-dialog-secondary",disabled:e,type:"button",onClick:l,children:"Cancel"}),t.jsxs("button",{className:"git-dialog-primary",disabled:e||!Re,title:Me?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx(Lt,{size:14}),"Start"]})]})]})})}function vn({busy:e,projectName:n,templateManifest:a,onClose:i,onSubmit:g}){const u=m.useMemo(()=>pt(a),[a]),l=m.useMemo(()=>a?Ye(a).filter(o=>o.kind==="action"):[],[a]),x=l[0]??null,[p,N]=m.useState("sandbox"),[c,U]=m.useState(x?.name??""),[I,V]=m.useState(()=>Object.fromEntries(u.scalarInputs.map(o=>[o.name,o.defaultValue]))),[z,v]=m.useState(()=>Object.fromEntries(u.envInputs.map(o=>[o.name,""]))),[q,H]=m.useState({}),X=Fe(u.scalarInputs,c),b=Fe(u.fileInputs,c),j=p==="sandbox"?u.envInputs:[],A=X.every(o=>!o.required||!!(I[o.name]??"").trim()),_=b.every(o=>!o.required||(q[o.name]?.length??0)>0),F=j.every(o=>!o.required||!!(z[o.name]??"").trim()),B=j.filter(o=>o.required&&!(z[o.name]??"").trim()),ae=!!c&&A&&_&&F;function Z(o,P){V(w=>({...w,[o]:P}))}function fe(o,P){v(w=>({...w,[o]:P}))}function K(o,P,w){const R=Array.from(w.target.files??[]);H($=>({...$,[o]:P?R:R.slice(0,1)}))}function Y(o){o.preventDefault(),!(!ae||e)&&g({mode:p,target:c,params:bt(X,I),env:p==="sandbox"?gt(j,z):[],uploads:b.flatMap(P=>{const w=q[P.name]??[];return w.length>0?[{inputName:P.name,label:P.label,targetPath:P.targetPath,multiple:P.multiple,files:w}]:[]})})}return t.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:t.jsxs("form",{className:"git-dialog run-once-dialog sandbox-start-dialog",role:"dialog","aria-modal":"true","aria-label":"Run sandbox action",onSubmit:Y,children:[t.jsx("button",{className:"git-dialog-close",disabled:e,type:"button",title:"Close","aria-label":"Close",onClick:i,children:t.jsx(mt,{size:15})}),t.jsxs("div",{className:"sandbox-start-dialog-heading",children:[t.jsx("div",{className:"git-dialog-icon",children:t.jsx($e,{size:18})}),t.jsx("h2",{children:"Run action"}),t.jsxs("div",{className:"git-dialog-row",children:[t.jsx("span",{children:"Project"}),t.jsx("strong",{children:n})]})]}),t.jsxs("div",{className:"sandbox-start-dialog-body",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Action"}),t.jsx("select",{disabled:e||l.length===0,value:c,onChange:o=>U(o.target.value),children:l.map(o=>t.jsx("option",{value:o.name,children:o.name},o.name))})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Run on"}),t.jsxs("select",{disabled:e,value:p,onChange:o=>N(o.target.value==="local"?"local":"sandbox"),children:[t.jsx("option",{value:"sandbox",children:"Hosted sandbox (start/update)"}),t.jsx("option",{value:"local",children:"Local machine"})]})]}),X.map(o=>o.type==="boolean"?t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:(I[o.name]??"")==="true",disabled:e,type:"checkbox",onChange:P=>Z(o.name,P.target.checked?"true":"false")}),t.jsx("span",{}),o.label]},o.name):t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:o.label}),t.jsx("input",{disabled:e,inputMode:o.type==="number"||o.type==="integer"?"decimal":void 0,value:I[o.name]??"",onChange:P=>Z(o.name,P.target.value)})]},o.name)),b.map(o=>t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:o.label}),t.jsx("input",{accept:o.accept||void 0,disabled:e,multiple:o.multiple,type:"file",onChange:P=>K(o.name,o.multiple,P)})]},o.name)),j.length>0?t.jsxs("div",{className:"sandbox-start-env-section",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Environment"}),B.length>0?t.jsxs("p",{className:"sandbox-start-env-warning",role:"status",children:["Required sandbox secret ref missing: ",B.map(o=>o.name).join(", ")]}):null,j.map(o=>{const P=z[o.name]??"",w=o.required&&!P.trim(),R=`sandbox-action-env-${o.name}-description`;return t.jsxs("label",{className:"git-dialog-field",children:[t.jsxs("span",{children:[o.name,o.required?" *":""]}),t.jsx("input",{"aria-describedby":R,"aria-invalid":w,disabled:e,placeholder:"openpond://secret/...",value:P,onChange:$=>fe(o.name,$.target.value)}),t.jsx("small",{id:R,children:w?"Add a sandbox secret ref before running.":o.description||"Sandbox secret ref only."})]},o.name)})]}):null]}),t.jsxs("div",{className:"git-dialog-footer sandbox-start-dialog-footer",children:[t.jsx("button",{className:"git-dialog-secondary",disabled:e,type:"button",onClick:i,children:"Cancel"}),t.jsxs("button",{className:"git-dialog-primary",disabled:e||!ae,title:F?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx($e,{size:14}),"Run"]})]})]})})}function xt(e,n){const a=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"agent";return n==="cron"?`name: ${a}
1
+ import{r as m,j as t}from"./index-B5RqBp_p.js";import{c as ut,bd as Ye,be as Mt,bf as Ut,X as mt,bg as Ae,aK as Lt,bh as Ne,aV as Ot,I as Ft,a$ as at,E as Bt,bi as Dt,aP as Gt,aB as Tt,bj as kt,bk as st,v as O,aJ as Vt,ba as Ht,S as Xt,bc as Je,C as Jt,aq as Kt,h as Qt}from"./App-kwt-UxX_.js";import{I as Zt}from"./info-BWvLCbJ2.js";import{P as $e}from"./play-DsP3gpGK.js";import{G as Yt}from"./git-commit-horizontal-BifoV1dR.js";import{R as Ke}from"./refresh-cw-DaASy_i0.js";import{S as Wt}from"./square-DTl9YrMp.js";import{U as rt}from"./upload-juEp2zRQ.js";const en=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],tn=ut("hammer",en);const nn=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],an=ut("monitor",nn);function sn(e){const n=te(e?.data),a=te(n.preview);return(typeof a.url=="string"?a.url.trim():"")||null}function rn(){const e=window.open("","_blank");return e?(e.document.write('<!doctype html><title>Opening sandbox preview</title><body style="margin:0;background:#05070a;color:#f5f5f4;font:14px system-ui,sans-serif;display:grid;place-items:center;height:100vh;">Opening sandbox preview...</body>'),e.document.close(),e):null}function ye(e,n){if(!n){e?.close();return}if(e){e.opener=null,e.location.href=n;return}window.open(n,"_blank","noopener,noreferrer")}function pt(e){const n=ln(e),a=on(te(e?.resources)),i=te(te(e?.inputs).schema),g=te(i.properties),u=new Set(ft(i.required)),l=[],x=[];for(const[p,N]of Object.entries(g)){const c=te(N),U=te(c["x-openpond-upload"]??c.xOpenPondUpload),I=typeof c.type=="string"?c.type:"string",V=te(c.items),z=gn(c,U),v=c.format==="file"||U.enabled===!0||I==="array"&&V.format==="file",q=typeof c.title=="string"&&c.title.trim()?c.title.trim():hn(p);if(v){x.push({name:p,label:q,required:u.has(p),multiple:I==="array"||U.multiple===!0,accept:bn(U,c),targetPath:fn(U,p),targetNames:z});continue}(I==="string"||I==="number"||I==="integer"||I==="boolean")&&l.push({name:p,label:q,required:u.has(p),type:I,defaultValue:typeof c.default=="string"||typeof c.default=="number"||typeof c.default=="boolean"?String(c.default):"",targetNames:z})}return{entrypoints:n,scalarInputs:l,fileInputs:x,envInputs:dn(e),resources:a,volumes:cn(e,x),schedules:un(e)}}function Fe(e,n){const a=n.trim();return e.filter(i=>!i.targetNames||i.targetNames.length===0?!0:i.targetNames.includes(a))}function ln(e){return e?Ye(e).flatMap(n=>{if(n.kind==="action")return[];const a=n.name.trim(),i=n.command.trim(),g=Be(n.timeoutSeconds),u=n.ports.flatMap(l=>{const x=Be(l.port);return x?[{port:x,label:typeof l.label=="string"&&l.label.trim()?l.label.trim():"web",access:l.access==="public"?"public":"private",path:typeof l.path=="string"&&l.path.trim()?l.path.trim():"/"}]:[]});return a&&i?[{name:a,command:i,timeoutSeconds:g,ports:u}]:[]}):[]}function on(e){return{cpu:Qe(e.cpu)??1,memoryGb:Qe(e.memoryGb)??1,diskGb:Qe(e.diskGb)??8}}function cn(e,n){const a=Array.isArray(e?.volumes)?e.volumes:[];if(a.length>0)return a.map((u,l)=>{const x=l===0?"volume":`volume-${l+1}`,p=typeof u.name=="string"&&u.name.trim()?u.name.trim():x;return{name:p,mountPath:typeof u.mountPath=="string"&&u.mountPath.trim()?u.mountPath.trim():`/workspace/volumes/${p}`,...Be(u.storageGb)?{storageGb:Be(u.storageGb)??void 0}:{},deleteOnSandboxDelete:u.deleteOnSandboxDelete===!0}});const i=n.find(u=>u.targetPath.startsWith("volumes/"));if(!i)return[];const[,g="volume"]=i.targetPath.split("/");return[{name:g,mountPath:`/workspace/volumes/${g}`,storageGb:8,deleteOnSandboxDelete:!1}]}function dn(e){return(Array.isArray(e?.inputs.env)?e.inputs.env:[]).flatMap(a=>{const i=typeof a.name=="string"?a.name.trim():"";return i?[{name:i,required:a.required===!0,secret:a.secret!==!1,description:typeof a.description=="string"?a.description.trim():""}]:[]})}function un(e){return e?.schedules?.length?e.schedules.flatMap(n=>{const a=typeof n.name=="string"?n.name.trim():"",i=mn(n);if(!a||!i.scheduleExpression)return[];try{return[{name:a,...typeof n.description=="string"&&n.description.trim()?{description:n.description.trim()}:{},enabled:!1,...i,...typeof n.timezone=="string"&&n.timezone.trim()?{timezone:n.timezone.trim()}:{},...typeof n.startAt=="string"&&n.startAt.trim()?{startAt:n.startAt.trim()}:{},...typeof n.endAt=="string"&&n.endAt.trim()?{endAt:n.endAt.trim()}:{},...typeof n.maxRuns=="number"&&Number.isInteger(n.maxRuns)&&n.maxRuns>0?{maxRuns:n.maxRuns}:{},runtimePolicy:n.runtimePolicy,target:pn(e,n),...n.budget?{budget:n.budget}:{},...n.resources?{resources:n.resources}:{},...n.quotas?{quotas:n.quotas}:{},...n.lifecycle?{lifecycle:n.lifecycle}:{},...n.retentionPolicy?{retentionPolicy:n.retentionPolicy}:{},...n.env?{env:n.env}:{},...n.integrationLeases?{integrationLeases:n.integrationLeases}:{},metadata:{...te(n.metadata),manifestScheduleName:a,source:"openpond-app-sandbox-template-start"}}]}catch{return[]}}):[]}function mn(e){return e.scheduleExpression?{scheduleType:e.scheduleType??"cron",scheduleExpression:e.scheduleExpression}:e.rate?{scheduleType:"rate",scheduleExpression:/^rate\(/i.test(e.rate)?e.rate:`rate(${e.rate})`}:e.once?{scheduleType:"once",scheduleExpression:/^at\(/i.test(e.once)?e.once:`at(${e.once})`}:{scheduleType:"cron",scheduleExpression:e.cron??""}}function pn(e,n){const a=n.command??n.target?.command??null;if(a)return{kind:"command",command:a,requiresStart:n.requiresStart??n.target?.requiresStart??!1};const i=n.target?.kind??"action";if(i==="start")return{kind:"command",command:e.start.command,requiresStart:n.requiresStart??n.target?.requiresStart??e.start.requiresStart??!1};if(i==="service"){const l=n.target?.name??"",x=e.services.find(p=>p.name===l);if(!x)throw new Error("schedule_service_target_missing");return{kind:"command",command:x.command,requiresStart:n.requiresStart??n.target?.requiresStart??x.requiresStart??!1}}const g=n.actionName??n.action??n.target?.actionName??(n.target?.kind==="action"?n.target?.name:void 0),u=e.actions.find(l=>l.name===g);if(!u)throw new Error("schedule_action_target_missing");return{kind:"command",command:u.command,requiresStart:n.requiresStart??n.target?.requiresStart??u.requiresStart??!1}}function gt(e,n){return e.flatMap(a=>{const i=(n[a.name]??"").trim();return i?[{name:a.name,secretRef:i}]:[]})}function bt(e,n){const a={};for(const i of e){const g=n[i.name]??"";if(!(!g.trim()&&!i.required))if(i.type==="boolean")a[i.name]=g==="true";else if(i.type==="number"||i.type==="integer"){const u=Number(g);Number.isFinite(u)&&(a[i.name]=i.type==="integer"?Math.trunc(u):u)}else a[i.name]=g}return a}function gn(e,n){const a=e["x-openpond-targets"]??e.xOpenPondTargets??n.targets??n.actions,i=ft(a).map(g=>g.trim()).filter(Boolean);return i.length>0?[...new Set(i)]:null}function bn(e,n){return typeof e.accept=="string"?e.accept.trim():Array.isArray(e.accept)?e.accept.filter(a=>typeof a=="string").join(","):typeof n.accept=="string"?n.accept.trim():""}function fn(e,n){return(typeof e.targetPath=="string"&&e.targetPath.trim()?e.targetPath.trim():typeof e.path=="string"&&e.path.trim()?e.path.trim():`uploads/${n}`).replace(/^\/+/,"").replace(/^workspace\//,"").replace(/\/+$/,"")}function Qe(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:null}function Be(e){const n=Number(e);return Number.isInteger(n)&&n>0?n:null}function xn(e,n){return[n,...e.slice(1)]}function ft(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}function hn(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function te(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function jn({busy:e,defaultRepoUrl:n,projectName:a,commitBeforeCreate:i,templateManifest:g,uploadBeforeCreate:u,onClose:l,onSubmit:x}){const p=m.useMemo(()=>pt(g),[g]),N=p.entrypoints[0]??null,[c,U]=m.useState(n),[I,V]=m.useState(N?.name??""),[z,v]=m.useState(N?.command??""),[q,H]=m.useState(N?.timeoutSeconds?String(N.timeoutSeconds):""),[X,b]=m.useState(`Update ${a}`),[j,A]=m.useState("0.05"),[_,F]=m.useState(()=>Object.fromEntries(p.scalarInputs.map(r=>[r.name,r.defaultValue]))),[B,ae]=m.useState(()=>Object.fromEntries(p.envInputs.map(r=>[r.name,""]))),[Z,fe]=m.useState({}),K=p.volumes[0]??null,[Y,o]=m.useState(p.volumes.length>0||p.fileInputs.length>0),[P,w]=m.useState(K?.name??"volume"),[R,$]=m.useState(K?.mountPath??"/workspace/volumes/volume"),[J,ce]=m.useState(String(K?.storageGb??8)),[Pe,de]=m.useState(!(K?.deleteOnSandboxDelete??!1)),[M,ze]=m.useState(p.schedules),qe=p.entrypoints.find(r=>r.name===I)??N,se=qe?.ports??[],re=se[0]??null,[ue,xe]=m.useState(!!re),[Ce,me]=m.useState(re?String(re.port):""),D=Number(Ce),he=Number(j),ie=Number(J),le=Number(q),ke=!q.trim()||Number.isInteger(le)&&le>0&&le<=86400,oe=!ue||Number.isInteger(D)&&D>=Mt&&D<=Ut&&se.some(r=>r.port===D),Ie=Number.isFinite(he)&&he>0,ne=!Y||Number.isInteger(ie)&&ie>0,G=M.every(r=>!r.enabled||!!r.scheduleExpression.trim()),W=Fe(p.scalarInputs,I),je=Fe(p.fileInputs,I),Me=p.envInputs.every(r=>!r.required||!!(B[r.name]??"").trim()),ve=p.envInputs.filter(r=>r.required&&!(B[r.name]??"").trim()),Re=(u||!!c.trim())&&!!z.trim()&&Ie&&ke&&ne&&W.every(r=>!r.required||!!(_[r.name]??"").trim())&&je.every(r=>!r.required||(Z[r.name]?.length??0)>0)&&Me&&G&&oe;function Ve(r){V(r);const f=p.entrypoints.find(E=>E.name===r);if(!f)return;v(f.command),H(f.timeoutSeconds?String(f.timeoutSeconds):"");const y=f.ports[0]??null;me(y?String(y.port):""),xe(!!y)}function _e(r,f){F(y=>({...y,[r]:f}))}function pe(r,f){ae(y=>({...y,[r]:f}))}function He(r,f){const y=Array.from(f.target.files??[]);fe(E=>({...E,[r.name]:r.multiple?y:y.slice(0,1)}))}function ee(r,f){ze(y=>y.map((E,ge)=>ge===r?{...E,...f}:E))}function Ee(r){r.preventDefault(),!(!Re||e)&&x({repoUrl:c.trim(),command:z.trim(),entrypointName:I,commitMessage:X.trim(),budgetUsd:j.trim(),params:bt(W,_),env:gt(p.envInputs,B),timeoutSeconds:q.trim()&&Number.isInteger(le)?le:qe?.timeoutSeconds??null,uploads:je.flatMap(f=>{const y=Z[f.name]??[];return y.length>0?[{inputName:f.name,label:f.label,targetPath:f.targetPath,multiple:f.multiple,files:y}]:[]}),resources:p.resources,volumes:Y?xn(p.volumes,{...P.trim()?{name:P.trim()}:{},...R.trim()?{mountPath:R.trim()}:{},...Number.isInteger(ie)&&ie>0?{storageGb:ie}:{},deleteOnSandboxDelete:!Pe}):[],schedules:M.filter(f=>f.enabled),openPreview:ue,previewPort:ue?D:null,previewLabel:se.find(f=>f.port===D)?.label??"web",previewAccess:se.find(f=>f.port===D)?.access??"private"})}return t.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:t.jsxs("form",{className:"git-dialog run-once-dialog sandbox-start-dialog",role:"dialog","aria-modal":"true","aria-label":"Start sandbox",onSubmit:Ee,children:[t.jsx("button",{className:"git-dialog-close",disabled:e,type:"button",title:"Close","aria-label":"Close",onClick:l,children:t.jsx(mt,{size:15})}),t.jsxs("div",{className:"sandbox-start-dialog-heading",children:[t.jsx("div",{className:"git-dialog-icon",children:t.jsx(Ae,{size:18})}),t.jsx("h2",{children:"Start sandbox"}),t.jsxs("div",{className:"git-dialog-row",children:[t.jsx("span",{children:"Project"}),t.jsx("strong",{children:a})]})]}),t.jsxs("div",{className:"sandbox-start-dialog-body",children:[u?null:t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Repository"}),t.jsx("input",{disabled:e,value:c,onChange:r=>U(r.target.value)})]}),i?t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Commit message"}),t.jsx("input",{disabled:e,value:X,onChange:r=>b(r.target.value)})]}):null,p.entrypoints.length>0?t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Run target"}),t.jsx("select",{disabled:e,value:I,onChange:r=>Ve(r.target.value),children:p.entrypoints.map(r=>t.jsx("option",{value:r.name,children:r.name},r.name))})]}):null,t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Shell command"}),t.jsx("input",{disabled:e,value:z,onChange:r=>v(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Timeout seconds"}),t.jsx("input",{disabled:e,inputMode:"numeric",value:q,onChange:r=>H(r.target.value)})]}),W.map(r=>r.type==="boolean"?t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:(_[r.name]??"")==="true",disabled:e,type:"checkbox",onChange:f=>_e(r.name,f.target.checked?"true":"false")}),t.jsx("span",{}),r.label]},r.name):t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:r.label}),t.jsx("input",{disabled:e,inputMode:r.type==="number"||r.type==="integer"?"decimal":void 0,value:_[r.name]??"",onChange:f=>_e(r.name,f.target.value)})]},r.name)),je.map(r=>t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:r.label}),t.jsx("input",{accept:r.accept||void 0,disabled:e,multiple:r.multiple,type:"file",onChange:f=>He(r,f)})]},r.name)),p.envInputs.length>0?t.jsxs("div",{className:"sandbox-start-env-section",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Environment"}),ve.length>0?t.jsxs("p",{className:"sandbox-start-env-warning",role:"status",children:["Required sandbox secret ref missing: ",ve.map(r=>r.name).join(", ")]}):null,p.envInputs.map(r=>{const f=B[r.name]??"",y=r.required&&!f.trim(),E=`sandbox-env-${r.name}-description`;return t.jsxs("label",{className:"git-dialog-field",children:[t.jsxs("span",{children:[r.name,r.required?" *":""]}),t.jsx("input",{"aria-describedby":E,"aria-invalid":y,disabled:e,placeholder:"openpond://secret/...",value:f,onChange:ge=>pe(r.name,ge.target.value)}),t.jsx("small",{id:E,children:y?"Add a sandbox secret ref before starting.":r.description||"Sandbox secret ref only."})]},r.name)})]}):null,je.length>0||p.volumes.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:Y,disabled:e,type:"checkbox",onChange:r=>o(r.target.checked)}),t.jsx("span",{}),"Mount volume"]}),Y?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"run-once-dialog-grid",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Volume"}),t.jsx("input",{disabled:e,value:P,onChange:r=>w(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Storage GiB"}),t.jsx("input",{disabled:e,inputMode:"numeric",value:J,onChange:r=>ce(r.target.value)})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Mount path"}),t.jsx("input",{disabled:e,value:R,onChange:r=>$(r.target.value)})]}),t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:Pe,disabled:e,type:"checkbox",onChange:r=>de(r.target.checked)}),t.jsx("span",{}),"Keep volume"]})]}):null]}):null,M.length>0?t.jsxs("div",{className:"sandbox-start-schedules",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Schedules"}),M.map((r,f)=>t.jsxs("div",{className:"sandbox-start-schedule-row",children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:r.enabled,disabled:e,type:"checkbox",onChange:y=>ee(f,{enabled:y.target.checked})}),t.jsx("span",{}),r.name]}),t.jsxs("div",{className:"run-once-dialog-grid",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Type"}),t.jsxs("select",{disabled:e||!r.enabled,value:r.scheduleType,onChange:y=>ee(f,{scheduleType:y.target.value}),children:[t.jsx("option",{value:"rate",children:"Rate"}),t.jsx("option",{value:"cron",children:"Cron"}),t.jsx("option",{value:"once",children:"Once"})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Max runs"}),t.jsx("input",{disabled:e||!r.enabled,inputMode:"numeric",value:r.maxRuns??"",onChange:y=>{const E=Number(y.target.value);ee(f,{maxRuns:Number.isInteger(E)&&E>0?E:null})}})]})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Expression"}),t.jsx("input",{disabled:e||!r.enabled,value:r.scheduleExpression,onChange:y=>ee(f,{scheduleExpression:y.target.value})})]})]},r.name))]}):null,t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Budget"}),t.jsx("input",{disabled:e,inputMode:"decimal",value:j,onChange:r=>A(r.target.value)})]}),se.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:ue,disabled:e,type:"checkbox",onChange:r=>xe(r.target.checked)}),t.jsx("span",{}),"Open preview"]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Preview port"}),t.jsx("select",{disabled:e||!ue,value:Ce,onChange:r=>me(r.target.value),children:se.map(r=>t.jsx("option",{value:r.port,children:r.label?`${r.label} (${r.port})`:r.port},r.port))})]})]}):null]}),t.jsxs("div",{className:"git-dialog-footer sandbox-start-dialog-footer",children:[t.jsx("button",{className:"git-dialog-secondary",disabled:e,type:"button",onClick:l,children:"Cancel"}),t.jsxs("button",{className:"git-dialog-primary",disabled:e||!Re,title:Me?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx(Lt,{size:14}),"Start"]})]})]})})}function vn({busy:e,projectName:n,templateManifest:a,onClose:i,onSubmit:g}){const u=m.useMemo(()=>pt(a),[a]),l=m.useMemo(()=>a?Ye(a).filter(o=>o.kind==="action"):[],[a]),x=l[0]??null,[p,N]=m.useState("sandbox"),[c,U]=m.useState(x?.name??""),[I,V]=m.useState(()=>Object.fromEntries(u.scalarInputs.map(o=>[o.name,o.defaultValue]))),[z,v]=m.useState(()=>Object.fromEntries(u.envInputs.map(o=>[o.name,""]))),[q,H]=m.useState({}),X=Fe(u.scalarInputs,c),b=Fe(u.fileInputs,c),j=p==="sandbox"?u.envInputs:[],A=X.every(o=>!o.required||!!(I[o.name]??"").trim()),_=b.every(o=>!o.required||(q[o.name]?.length??0)>0),F=j.every(o=>!o.required||!!(z[o.name]??"").trim()),B=j.filter(o=>o.required&&!(z[o.name]??"").trim()),ae=!!c&&A&&_&&F;function Z(o,P){V(w=>({...w,[o]:P}))}function fe(o,P){v(w=>({...w,[o]:P}))}function K(o,P,w){const R=Array.from(w.target.files??[]);H($=>({...$,[o]:P?R:R.slice(0,1)}))}function Y(o){o.preventDefault(),!(!ae||e)&&g({mode:p,target:c,params:bt(X,I),env:p==="sandbox"?gt(j,z):[],uploads:b.flatMap(P=>{const w=q[P.name]??[];return w.length>0?[{inputName:P.name,label:P.label,targetPath:P.targetPath,multiple:P.multiple,files:w}]:[]})})}return t.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:t.jsxs("form",{className:"git-dialog run-once-dialog sandbox-start-dialog",role:"dialog","aria-modal":"true","aria-label":"Run sandbox action",onSubmit:Y,children:[t.jsx("button",{className:"git-dialog-close",disabled:e,type:"button",title:"Close","aria-label":"Close",onClick:i,children:t.jsx(mt,{size:15})}),t.jsxs("div",{className:"sandbox-start-dialog-heading",children:[t.jsx("div",{className:"git-dialog-icon",children:t.jsx($e,{size:18})}),t.jsx("h2",{children:"Run action"}),t.jsxs("div",{className:"git-dialog-row",children:[t.jsx("span",{children:"Project"}),t.jsx("strong",{children:n})]})]}),t.jsxs("div",{className:"sandbox-start-dialog-body",children:[t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Action"}),t.jsx("select",{disabled:e||l.length===0,value:c,onChange:o=>U(o.target.value),children:l.map(o=>t.jsx("option",{value:o.name,children:o.name},o.name))})]}),t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:"Run on"}),t.jsxs("select",{disabled:e,value:p,onChange:o=>N(o.target.value==="local"?"local":"sandbox"),children:[t.jsx("option",{value:"sandbox",children:"Hosted sandbox (start/update)"}),t.jsx("option",{value:"local",children:"Local machine"})]})]}),X.map(o=>o.type==="boolean"?t.jsxs("label",{className:"git-dialog-toggle",children:[t.jsx("input",{checked:(I[o.name]??"")==="true",disabled:e,type:"checkbox",onChange:P=>Z(o.name,P.target.checked?"true":"false")}),t.jsx("span",{}),o.label]},o.name):t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:o.label}),t.jsx("input",{disabled:e,inputMode:o.type==="number"||o.type==="integer"?"decimal":void 0,value:I[o.name]??"",onChange:P=>Z(o.name,P.target.value)})]},o.name)),b.map(o=>t.jsxs("label",{className:"git-dialog-field",children:[t.jsx("span",{children:o.label}),t.jsx("input",{accept:o.accept||void 0,disabled:e,multiple:o.multiple,type:"file",onChange:P=>K(o.name,o.multiple,P)})]},o.name)),j.length>0?t.jsxs("div",{className:"sandbox-start-env-section",children:[t.jsx("div",{className:"sandbox-start-section-title",children:"Environment"}),B.length>0?t.jsxs("p",{className:"sandbox-start-env-warning",role:"status",children:["Required sandbox secret ref missing: ",B.map(o=>o.name).join(", ")]}):null,j.map(o=>{const P=z[o.name]??"",w=o.required&&!P.trim(),R=`sandbox-action-env-${o.name}-description`;return t.jsxs("label",{className:"git-dialog-field",children:[t.jsxs("span",{children:[o.name,o.required?" *":""]}),t.jsx("input",{"aria-describedby":R,"aria-invalid":w,disabled:e,placeholder:"openpond://secret/...",value:P,onChange:$=>fe(o.name,$.target.value)}),t.jsx("small",{id:R,children:w?"Add a sandbox secret ref before running.":o.description||"Sandbox secret ref only."})]},o.name)})]}):null]}),t.jsxs("div",{className:"git-dialog-footer sandbox-start-dialog-footer",children:[t.jsx("button",{className:"git-dialog-secondary",disabled:e,type:"button",onClick:i,children:"Cancel"}),t.jsxs("button",{className:"git-dialog-primary",disabled:e||!ae,title:F?void 0:"Required sandbox secret refs are missing.",type:"submit",children:[t.jsx($e,{size:14}),"Run"]})]})]})})}function xt(e,n){const a=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"agent";return n==="cron"?`name: ${a}
2
2
  version: 0.1.0
3
3
  useCase: scheduled_report
4
4
  start:
@@ -1 +1 @@
1
- import{j as e}from"./index-C0gdp_hv.js";/* empty css */import{C as z}from"./cloud-upload-B1A_725d.js";import{bc as j,I as _,X as D}from"./App-BqgpZNh-.js";import{G as h}from"./git-commit-horizontal-75RSWQ3Q.js";import{U as B}from"./upload-AB1N3bCZ.js";function E({open:s,branch:l,filesChanged:i,additions:c,deletions:n,message:m,includeUnstaged:g,nextStep:a,draft:p,busy:t,canPush:u,canPublish:b,onMessageChange:f,onIncludeUnstagedChange:C,onNextStepChange:r,onDraftChange:N,onClose:v,onSubmit:k}){return s?e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:e.jsxs("form",{className:"git-dialog commit-dialog","aria-label":"Commit changes",onSubmit:o=>{o.preventDefault(),k()},children:[e.jsx(x,{disabled:t,onClose:v}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(h,{size:18})}),e.jsx("h2",{children:"Commit your changes"}),e.jsxs("div",{className:"git-dialog-row",children:[e.jsx("span",{children:"Branch"}),e.jsxs("strong",{children:[e.jsx(j,{size:14}),l??"No branch"]})]}),e.jsxs("div",{className:"git-dialog-row",children:[e.jsx("span",{children:"Changes"}),e.jsxs("strong",{children:[i," ",i===1?"file":"files",e.jsxs("span",{className:"git-dialog-additions",children:["+",c]}),e.jsxs("span",{className:"git-dialog-deletions",children:["-",n]})]})]}),e.jsxs("label",{className:"git-dialog-toggle",children:[e.jsx("input",{checked:g,disabled:t,type:"checkbox",onChange:o=>C(o.target.checked)}),e.jsx("span",{}),"Include unstaged"]}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsxs("span",{children:["Commit message",e.jsx("small",{children:"Leave blank to use an autogenerated message"})]}),e.jsx("textarea",{value:m,disabled:t,placeholder:"Update workspace",onChange:o=>f(o.target.value)})]}),e.jsxs("fieldset",{className:"git-dialog-next",children:[e.jsx("legend",{children:"Next steps"}),e.jsx(d,{active:a==="commit",icon:e.jsx(h,{size:14}),label:"Commit",disabled:t,onSelect:()=>r("commit")}),e.jsx(d,{active:a==="commit_push",icon:e.jsx(B,{size:14}),label:"Commit & push",disabled:t||!u,onSelect:()=>r("commit_push")}),b&&e.jsx(d,{active:a==="commit_publish",icon:e.jsx(z,{size:14}),label:"Commit & publish",disabled:t,onSelect:()=>r("commit_publish")}),e.jsx(d,{active:a==="commit_pr",icon:e.jsx(_,{size:14}),label:"Commit & create PR",disabled:!0,onSelect:()=>r("commit_pr")})]}),e.jsxs("div",{className:"git-dialog-footer",children:[e.jsxs("label",{className:"git-dialog-toggle draft-toggle",children:[e.jsx("input",{checked:p,disabled:t||a!=="commit_pr",type:"checkbox",onChange:o=>N(o.target.checked)}),e.jsx("span",{}),"Draft"]}),e.jsx("button",{className:"git-dialog-primary",disabled:t||i===0,type:"submit",children:"Continue"})]})]})}):null}function F({open:s,branchName:l,busy:i,onBranchNameChange:c,onSetPrefix:n,onClose:m,onSubmit:g}){return s?e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:e.jsxs("form",{className:"git-dialog branch-dialog","aria-label":"Create branch",onSubmit:a=>{a.preventDefault(),g()},children:[e.jsx(x,{disabled:i,onClose:m}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(j,{size:18})}),e.jsx("h2",{children:"Work here"}),e.jsx("p",{children:"Create a branch to commit changes, push, and create a PR from this worktree."}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsxs("span",{children:["Branch name",e.jsx("button",{className:"git-dialog-inline-action",disabled:i,type:"button",onClick:n,children:"Set prefix"})]}),e.jsx("input",{autoFocus:!0,disabled:i,value:l,onChange:a=>c(a.target.value)})]}),e.jsx("button",{className:"git-dialog-primary full",disabled:i||!l.trim(),type:"submit",children:"Create"})]})}):null}function d({active:s,icon:l,label:i,disabled:c,onSelect:n}){return e.jsxs("button",{"aria-pressed":s,className:s?"active":"",disabled:c,type:"button",onClick:n,children:[l,e.jsx("span",{children:i}),s&&e.jsx("span",{className:"git-dialog-check",children:"✓"})]})}function x({disabled:s,onClose:l}){return e.jsx("button",{className:"git-dialog-close",disabled:s,type:"button",onClick:l,children:e.jsx(D,{size:16})})}export{F as BranchDialog,E as CommitDialog};
1
+ import{j as e}from"./index-B5RqBp_p.js";/* empty css */import{C as z}from"./cloud-upload-CJVhhG6P.js";import{bc as j,I as _,X as D}from"./App-kwt-UxX_.js";import{G as h}from"./git-commit-horizontal-BifoV1dR.js";import{U as B}from"./upload-juEp2zRQ.js";function E({open:s,branch:l,filesChanged:i,additions:c,deletions:n,message:m,includeUnstaged:g,nextStep:a,draft:p,busy:t,canPush:u,canPublish:b,onMessageChange:f,onIncludeUnstagedChange:C,onNextStepChange:r,onDraftChange:N,onClose:v,onSubmit:k}){return s?e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:e.jsxs("form",{className:"git-dialog commit-dialog","aria-label":"Commit changes",onSubmit:o=>{o.preventDefault(),k()},children:[e.jsx(x,{disabled:t,onClose:v}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(h,{size:18})}),e.jsx("h2",{children:"Commit your changes"}),e.jsxs("div",{className:"git-dialog-row",children:[e.jsx("span",{children:"Branch"}),e.jsxs("strong",{children:[e.jsx(j,{size:14}),l??"No branch"]})]}),e.jsxs("div",{className:"git-dialog-row",children:[e.jsx("span",{children:"Changes"}),e.jsxs("strong",{children:[i," ",i===1?"file":"files",e.jsxs("span",{className:"git-dialog-additions",children:["+",c]}),e.jsxs("span",{className:"git-dialog-deletions",children:["-",n]})]})]}),e.jsxs("label",{className:"git-dialog-toggle",children:[e.jsx("input",{checked:g,disabled:t,type:"checkbox",onChange:o=>C(o.target.checked)}),e.jsx("span",{}),"Include unstaged"]}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsxs("span",{children:["Commit message",e.jsx("small",{children:"Leave blank to use an autogenerated message"})]}),e.jsx("textarea",{value:m,disabled:t,placeholder:"Update workspace",onChange:o=>f(o.target.value)})]}),e.jsxs("fieldset",{className:"git-dialog-next",children:[e.jsx("legend",{children:"Next steps"}),e.jsx(d,{active:a==="commit",icon:e.jsx(h,{size:14}),label:"Commit",disabled:t,onSelect:()=>r("commit")}),e.jsx(d,{active:a==="commit_push",icon:e.jsx(B,{size:14}),label:"Commit & push",disabled:t||!u,onSelect:()=>r("commit_push")}),b&&e.jsx(d,{active:a==="commit_publish",icon:e.jsx(z,{size:14}),label:"Commit & publish",disabled:t,onSelect:()=>r("commit_publish")}),e.jsx(d,{active:a==="commit_pr",icon:e.jsx(_,{size:14}),label:"Commit & create PR",disabled:!0,onSelect:()=>r("commit_pr")})]}),e.jsxs("div",{className:"git-dialog-footer",children:[e.jsxs("label",{className:"git-dialog-toggle draft-toggle",children:[e.jsx("input",{checked:p,disabled:t||a!=="commit_pr",type:"checkbox",onChange:o=>N(o.target.checked)}),e.jsx("span",{}),"Draft"]}),e.jsx("button",{className:"git-dialog-primary",disabled:t||i===0,type:"submit",children:"Continue"})]})]})}):null}function F({open:s,branchName:l,busy:i,onBranchNameChange:c,onSetPrefix:n,onClose:m,onSubmit:g}){return s?e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:e.jsxs("form",{className:"git-dialog branch-dialog","aria-label":"Create branch",onSubmit:a=>{a.preventDefault(),g()},children:[e.jsx(x,{disabled:i,onClose:m}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(j,{size:18})}),e.jsx("h2",{children:"Work here"}),e.jsx("p",{children:"Create a branch to commit changes, push, and create a PR from this worktree."}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsxs("span",{children:["Branch name",e.jsx("button",{className:"git-dialog-inline-action",disabled:i,type:"button",onClick:n,children:"Set prefix"})]}),e.jsx("input",{autoFocus:!0,disabled:i,value:l,onChange:a=>c(a.target.value)})]}),e.jsx("button",{className:"git-dialog-primary full",disabled:i||!l.trim(),type:"submit",children:"Create"})]})}):null}function d({active:s,icon:l,label:i,disabled:c,onSelect:n}){return e.jsxs("button",{"aria-pressed":s,className:s?"active":"",disabled:c,type:"button",onClick:n,children:[l,e.jsx("span",{children:i}),s&&e.jsx("span",{className:"git-dialog-check",children:"✓"})]})}function x({disabled:s,onClose:l}){return e.jsx("button",{className:"git-dialog-close",disabled:s,type:"button",onClick:l,children:e.jsx(D,{size:16})})}export{F as BranchDialog,E as CommitDialog};