openpond 0.0.35 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/chunks/{app-layer-GUF2CKYH.js → app-layer-LF2HK2B2.js} +6 -3
- package/dist/chunks/{apps-DIVHAUOV.js → apps-ZMCMQZKX.js} +16 -12
- package/dist/chunks/{chunk-YPK2W34Z.js → chunk-2WMGA5FE.js} +8 -10
- package/dist/chunks/{chunk-NTRTK6C6.js → chunk-35PPAOWD.js} +2 -2
- package/dist/chunks/chunk-3VURZQHA.js +864 -0
- package/dist/chunks/{chunk-FRPL5XPX.js → chunk-43YI36NA.js} +1 -1
- package/dist/chunks/{chunk-4Y25BACE.js → chunk-A3CJUBA7.js} +1 -1
- package/dist/chunks/{chunk-RLQGMSW7.js → chunk-BWA3COR4.js} +573 -1204
- package/dist/chunks/{chunk-TXJ4TIDO.js → chunk-HLCTINEP.js} +1 -1
- package/dist/chunks/{chunk-GUGFYXFS.js → chunk-IATK3CIP.js} +6 -6
- package/dist/chunks/{chunk-2GV3QBBZ.js → chunk-ICLLW5QD.js} +1 -1
- package/dist/chunks/chunk-KSRWKXRB.js +12 -0
- package/dist/chunks/{chunk-II2ERA2H.js → chunk-KT2BB4AR.js} +30 -11
- package/dist/chunks/{chunk-XIF53VR3.js → chunk-LNKYEHIJ.js} +28 -3
- package/dist/chunks/{chunk-SECNDLPQ.js → chunk-MHBQWGCL.js} +1070 -57
- package/dist/chunks/chunk-MUMPWI4O.js +92 -0
- package/dist/chunks/{chunk-ZZOTKXRD.js → chunk-N6E6YSTP.js} +2 -2
- package/dist/chunks/{chunk-S3VA47DG.js → chunk-PGET7EZF.js} +7 -5
- package/dist/chunks/chunk-T4QXKU5Y.js +1 -0
- package/dist/chunks/{chunk-LUA5QGQP.js → chunk-VFL2JVBZ.js} +48 -121
- package/dist/chunks/{chunk-EY52SLOQ.js → chunk-WL76II47.js} +1 -1
- package/dist/chunks/{chunk-CRFB72X2.js → chunk-WTA33KQQ.js} +23 -19
- package/dist/chunks/{chunk-LHYK6QO2.js → chunk-XEJ7XXUQ.js} +1 -0
- package/dist/chunks/{chunk-2I5TZW66.js → chunk-ZPL4GZML.js} +128 -4
- package/dist/chunks/chunk-ZZ4ECDTP.js +668 -0
- package/dist/chunks/{cli-HUVI6ELM.js → cli-5NFIDCRL.js} +5 -5
- package/dist/chunks/cli-AS3DZ7XB.js +23 -0
- package/dist/chunks/{core-commands-2HUTKFHQ.js → core-commands-7223BEQL.js} +7 -4
- package/dist/chunks/{extend-PAJMXYKV.js → extend-6N5S5KA5.js} +18 -13
- package/dist/chunks/extension-FJSVCG2Q.js +121 -0
- package/dist/chunks/{harness-UWAS2VAN.js → harness-OMJXIGEW.js} +6 -3
- package/dist/chunks/{help-M7D2XAOX.js → help-YPPROIS7.js} +2 -1
- package/dist/chunks/{opchat-FQ2CJVM6.js → opchat-K7IYFPX6.js} +12 -7
- package/dist/chunks/{organizations-L5N6LJ7O.js → organizations-W3FMAWQ4.js} +8 -5
- package/dist/chunks/{profile-KH5IKVNY.js → profile-N4B3F7M7.js} +11 -8
- package/dist/chunks/{project-agent-F4NHVRGY.js → project-agent-NA6SGU25.js} +10 -7
- package/dist/chunks/{sandbox-command-DDXRQNB6.js → sandbox-command-AKCFJKKN.js} +7 -4
- package/dist/chunks/{sandbox-template-5EEEQKR5.js → sandbox-template-5NKTAXCL.js} +11 -7
- package/dist/chunks/{src-34FV42HE.js → src-SCS4KKP4.js} +2387 -1262
- package/dist/chunks/{src-LHZWUSD7.js → src-XAVSQTVR.js} +3 -3
- package/dist/chunks/{teams-bot-HFWO5GOV.js → teams-bot-557NZC73.js} +6 -3
- package/dist/chunks/{workspaces-LO44JAC2.js → workspaces-S2H75XQB.js} +6 -2
- package/dist/cli.js +14 -11
- package/dist/index.js +27 -9
- package/dist/profile/local-profile-types.d.ts +1 -0
- package/dist/profile/profile-skills.d.ts +2 -0
- package/dist/web/assets/{AppDialog-T3j6O3yg.js → AppDialog-y6krB0MJ.js} +1 -1
- package/dist/web/assets/{AppsView-70Qqf9eJ.js → AppsView-4F6oLktr.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-CdBLHdNW.js → BrowserSidebar-C0MHQaaD.js} +1 -1
- package/dist/web/assets/{CloudWorkView-C5-jvlOo.js → CloudWorkView-DwFIZoXy.js} +1 -1
- package/dist/web/assets/CommandMenu-CYGFrMZi.js +1 -0
- package/dist/web/assets/{CommunityView-BHUJ9Hun.js → CommunityView-C6n89YXz.js} +1 -1
- package/dist/web/assets/ComposerCreateImproveStrip-C3RwXC3_.js +1 -0
- package/dist/web/assets/{GetStartedView-CIXScviw.js → GetStartedView-fwD0ZXo9.js} +1 -1
- package/dist/web/assets/LabSkillSidebar-BSuc-NJr.js +1 -0
- package/dist/web/assets/LabSkillSidebar-CVxtS9pd.css +1 -0
- package/dist/web/assets/LabsRoute-BrJkBNig.css +1 -0
- package/dist/web/assets/LabsRoute-D2y8dSsT.js +3 -0
- package/dist/web/assets/MainChatThread-Dj_Ry6WQ.js +2 -0
- package/dist/web/assets/{MakeAgentTutorialLearningPanel-r7jyZVc0.js → MakeAgentTutorialLearningPanel-Bz2VDaRe.js} +2 -2
- package/dist/web/assets/{MarkdownText-E35C404I.js → MarkdownText-B6Nu_0Fz.js} +4 -4
- package/dist/web/assets/Messages-CH2wfv2a.js +10 -0
- package/dist/web/assets/NativeSkillSidebar-4iUfgwqO.js +1 -0
- package/dist/web/assets/{NewProjectDialog-BowacUmA.js → NewProjectDialog-8M5-6-h-.js} +1 -1
- package/dist/web/assets/{PostTrainingLearningPanel-oJu5qaHK.js → PostTrainingLearningPanel-CdG5KHZs.js} +2 -2
- package/dist/web/assets/{PostTrainingStatusPill-B9Eoc4s0.js → PostTrainingStatusPill-COZ4qISQ.js} +1 -1
- package/dist/web/assets/{ProfileSettingsSection-Dnh92gDH.js → ProfileSettingsSection-Bo7dybgW.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-Di8zoHJI.js +1 -0
- package/dist/web/assets/{SettingsView-uHhQnazW.css → SettingsView-BcYyY66X.css} +1 -1
- package/dist/web/assets/SettingsView-CAaKdDHt.js +6 -0
- package/dist/web/assets/{TeamChatView-Tn4X5cuY.js → TeamChatView-CzQYFBap.js} +2 -2
- package/dist/web/assets/{TerminalOverlay-DoX5LYzK.js → TerminalOverlay-B56XmI-k.js} +1 -1
- package/dist/web/assets/TrainingCreationPanel-C_ntWAAP.js +1 -0
- package/dist/web/assets/{TrainingDraftPanel-Da6uGu9y.js → TrainingDraftPanel-3hJIxLNn.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-DKky0p47.js → UsageSettingsSection-r3CqRm6Q.js} +1 -1
- package/dist/web/assets/WorkspaceDiffPanel-By8PWUuE.js +14 -0
- package/dist/web/assets/{WorkspaceEnvironmentMenu-Ba4M8z1N.js → WorkspaceEnvironmentMenu-7wmC-spz.js} +3 -3
- package/dist/web/assets/{WorkspaceGitDialogs-CSepNOb8.js → WorkspaceGitDialogs-Hn--lsRh.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-LhFdzCRs.js → WorkspaceMonacoEditor-CHd22UcG.js} +3 -3
- package/dist/web/assets/{activity-bW02ZsBD.js → activity-Dp5V58om.js} +1 -1
- package/dist/web/assets/{boxes-B1dRA1pi.js → boxes-DE7WJaEv.js} +1 -1
- package/dist/web/assets/{chevron-up-CySy6WNq.js → chevron-up-BWx8gGab.js} +1 -1
- package/dist/web/assets/{circle-x-DY8vKAKi.js → circle-x-DnmOfZIg.js} +1 -1
- package/dist/web/assets/{copy-DuHI1UZ_.js → copy-BjWvaXLC.js} +1 -1
- package/dist/web/assets/{create-pipeline-request-CGBcdK9r.js → create-pipeline-request-C4V6-lWN.js} +3 -3
- package/dist/web/assets/{credit-card-Bot0OuTl.js → credit-card-Bjg0Zaw5.js} +1 -1
- package/dist/web/assets/{cssMode-BIjAothW.js → cssMode-KFDYjM8T.js} +1 -1
- package/dist/web/assets/file-BrC1KjAS.js +1 -0
- package/dist/web/assets/{git-branch-Cm02aNWq.js → git-branch-DTeeARsp.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-FYILXW0v.js → git-commit-horizontal-C8UFKlXy.js} +1 -1
- package/dist/web/assets/{htmlMode-zO2xLLgL.js → htmlMode-NbLN3n6Q.js} +1 -1
- package/dist/web/assets/index-BcZetaeD.css +1 -0
- package/dist/web/assets/index-DQalqxbw.js +177 -0
- package/dist/web/assets/index-DYxF_d9i.js +1 -0
- package/dist/web/assets/{info-DeuEU_RO.js → info-BXBpMeVU.js} +1 -1
- package/dist/web/assets/{jsonMode-D2A3mj4n.js → jsonMode-Bl3r4LM_.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-aPSqvscU.js → lspLanguageFeatures-DH22w5XD.js} +1 -1
- package/dist/web/assets/make-agent-tutorial-CAnTPFCK.js +2 -0
- package/dist/web/assets/{monaco.contribution-Do3Jjslo.js → monaco.contribution-C0BsxYAz.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DAq6Jihl.js → monaco.contribution-CzpXjm9j.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CHVe9CQ9.js → monaco.contribution-DK-g-i00.js} +2 -2
- package/dist/web/assets/{monaco.contribution-KqCt1n9-.js → monaco.contribution-iAurj7TQ.js} +2 -2
- package/dist/web/assets/{monitor-DXvHWFeW.js → monitor-Ba2FFblh.js} +1 -1
- package/dist/web/assets/{play-BIHyH-Yu.js → play-2NDQ4-7K.js} +1 -1
- package/dist/web/assets/{python-g3mtmU2J.js → python-CQ0TmUW9.js} +1 -1
- package/dist/web/assets/{refresh-cw-Daz0oqwK.js → refresh-cw-CyermMsy.js} +1 -1
- package/dist/web/assets/{reply-wu9DIBuK.js → reply-BSExNLHM.js} +1 -1
- package/dist/web/assets/{rotate-cw-D7q9GgNc.js → rotate-cw-DJ-zYG9E.js} +1 -1
- package/dist/web/assets/{save-BVFY6VTI.js → save-Bij3cc3Q.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-D9C_WUDu.js → toggleHighContrast-CxALivAH.js} +1 -1
- package/dist/web/assets/{training-1du5QD-P.css → training-BN8CALIc.css} +1 -1
- package/dist/web/assets/{tsMode-B4lEUN5X.js → tsMode-vH4lMS7h.js} +1 -1
- package/dist/web/assets/{upload-DNbYB4Rl.js → upload-DbJfEI3G.js} +1 -1
- package/dist/web/assets/{wifi-off-C5QLifIJ.js → wifi-off-BnVFBG28.js} +1 -1
- package/dist/web/assets/{workers-CV4BZb_x.js → workers-CBihj7z6.js} +1 -1
- package/dist/web/assets/{yaml-3ah8oX43.js → yaml-Bhkoq1sy.js} +1 -1
- package/dist/web/index.html +2 -2
- package/docs/command-reference.md +15 -0
- package/package.json +1 -1
- package/dist/chunks/cli-3AEIYSMD.js +0 -19
- package/dist/web/assets/CommandMenu-B3Y4MvmT.js +0 -1
- package/dist/web/assets/ComposerCreateImproveStrip-DeRI5XEO.js +0 -1
- package/dist/web/assets/LabsRoute-CgKtVYTP.css +0 -1
- package/dist/web/assets/LabsRoute-Cs_R1fuu.js +0 -3
- package/dist/web/assets/MainChatThread-h7VSA_Rc.js +0 -2
- package/dist/web/assets/Messages-BANZuAnA.js +0 -10
- package/dist/web/assets/NativeSkillSidebar-Qgccncuc.js +0 -1
- package/dist/web/assets/RightChatPanelStack-pGwbt6Wy.js +0 -1
- package/dist/web/assets/SettingsView-Bjehxwt1.js +0 -6
- package/dist/web/assets/TrainingCreationPanel-BLSf1Bnp.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-DTRtW9n8.js +0 -14
- package/dist/web/assets/circle-alert-DMHz5tj_.js +0 -1
- package/dist/web/assets/index-B5AN29EO.js +0 -177
- package/dist/web/assets/index-BnwYyUgT.js +0 -1
- package/dist/web/assets/index-COGlKIJ4.css +0 -1
- package/dist/web/assets/make-agent-tutorial-A2W9Ajwv.js +0 -2
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WorkspaceMonacoEditor-LhFdzCRs.js","./index-B5AN29EO.js","./index-COGlKIJ4.css","./WorkspaceMonacoEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{d as ye,j as e,W as Ye,aA as ws,r as l,u as ke,n as z,aB as xt,a0 as bt,K as _e,T as On,aC as Un,t as ut,F as Hn,aD as Vn,Y as Ms,aE as Gn,aF as Kn,J as qn,X as ks,k as Qn,M as Xn,S as Zn,aG as Yn,as as Jn,at as ea,aH as ta,Q as ys,aI as sa,aJ as Ot,aK as na,aL as zs,aM as aa,a1 as ia,ad as ra,aN as zt,aO as la,aP as Ut,aQ as ge,aR as oa,aS as Ss,aT as ca,aU as da,aV as ua}from"./index-B5AN29EO.js";import{M as fa,u as Ns,I as pa}from"./MarkdownText-E35C404I.js";import{C as Is}from"./circle-alert-DMHz5tj_.js";import{R as Ht}from"./refresh-cw-Daz0oqwK.js";import{t as ha,a as ma,m as xa,s as ba,d as ga,f as ja,b as va}from"./training-model-data-BXUCzS0p.js";import{I as Cs}from"./info-DeuEU_RO.js";import{S as wa}from"./save-BVFY6VTI.js";import{C as ka}from"./chevron-up-CySy6WNq.js";const ya=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],Sa=ye("text-align-start",ya);const Na=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Ca=ye("chevrons-up",Na);const Ra=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],$a=ye("columns-2",Ra);const Fa=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Ea=ye("file",Fa);const Aa=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],La=ye("panel-top",Aa);const Pa=[["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"}]],Da=ye("redo-2",Pa);const Ta=[["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"}]],_a=ye("undo-2",Ta);function Ma({createRuntime:t,goalRuntime:s,subagentRuntime:n=null,onRunSubagentLifecycleAction:i}){const a=t?"Create/Improve Details":"Goal Details",c=t?X(t.run.state):n?.activeCount?n.label:s?.actionLabel??"No active goal";return e.jsxs("div",{className:"goal-details-view","aria-label":a,children:[e.jsxs("div",{className:"goal-details-header",children:[e.jsxs("div",{className:"goal-details-title",children:[e.jsx(Ye,{size:15,"aria-hidden":"true"}),e.jsx("span",{children:a})]}),e.jsx("span",{className:`goal-details-state ${si(t?.run.state??null)}`,children:c})]}),e.jsx("div",{className:"goal-details-body",children:t?e.jsx(za,{runtime:t}):s||n?e.jsx(Wa,{goalRuntime:s,subagentRuntime:n,onRunSubagentLifecycleAction:i}):e.jsx(ti,{})})]})}function za({runtime:t}){const s=t.run,n=s.plan,i=ws(n?.metadata)??ws(s.metadata),a=s.questions,c=a.filter(d=>d.status==="pending"),o=s.sourceRefs,u=s.checkRefs,f=s.state,p=s.target.kind==="agent"?s.target.defaultActionKey:null;return e.jsxs(e.Fragment,{children:[e.jsx(O,{title:"Current Work",children:e.jsx(Xe,{rows:[["State",X(f)],["Operation",s.operation],["Target",X(s.target.kind)],["Name",s.target.displayName??s.target.id??"Pending"],["Target ID",s.target.id??"Pending"],["Default action",p??n?.defaultChatAction.key??"Pending"],["Adapter",X(s.adapter.kind)],["Run",s.id],["Revision",String(s.revision)]]})}),e.jsx(O,{title:"Plan",children:n?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"goal-details-summary",children:n.summary}),e.jsx(Xe,{rows:[["Objective",n.objective],["Context",n.capturedContextSummary],["Status",X(n.status)],["Plan ID",n.id],["Run ID",n.runId],["Approval",n.approvalId??"Pending"],["Approved",n.approvedAt??"Not approved"]]})]}):c.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."})}),i?e.jsxs(O,{title:"Action Shape",children:[e.jsx(Xe,{rows:[["Mode",i.label],["Default action",i.defaultActionKey??"None"],["Direct action",i.directActionHint??"None planned"],["Artifacts",i.artifactPolicy]]}),e.jsx("p",{className:"goal-details-note",children:i.detail})]}):null,a.length?e.jsx(O,{title:"Questions",children:e.jsx("div",{className:"goal-details-list",children:a.map(d=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:d.title}),e.jsx("span",{className:`goal-details-inline-state ${d.status}`,children:X(d.status)})]}),e.jsx("p",{children:d.prompt}),d.answer?e.jsxs("small",{children:["Answer: ",d.answer.label??d.answer.value]}):d.options.length?e.jsxs("small",{children:["Options: ",d.options.map(b=>b.label).join(", ")]}):null]},d.id))})}):null,n?.requirements.length?e.jsx(O,{title:"Setup Requirements",children:e.jsx("div",{className:"goal-details-list",children:n.requirements.map(d=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:d.name}),e.jsx("span",{className:`goal-details-inline-state ${d.status}`,children:X(d.status)})]}),e.jsxs("small",{children:[X(d.kind),d.detail?`: ${d.detail}`:""]})]},`${d.kind}:${d.name}`))})}):null,n?.sourcePlan.length?e.jsx(O,{title:"Source Plan",children:e.jsx(dt,{refs:n.sourcePlan.map(d=>({id:`${d.operation}:${d.path}`,primary:d.path,secondary:`${X(d.operation)}: ${d.reason}`}))})}):null,n?.checks.length?e.jsx(O,{title:"Checks",children:e.jsx(dt,{refs:n.checks.map(d=>({id:d.name,primary:d.name,secondary:`${d.required?"Required":"Optional"}: ${d.command}`}))})}):null,o.length||u.length?e.jsx(O,{title:"Run Refs",children:e.jsx(dt,{refs:[...o.map(d=>({id:`source:${d}`,primary:d,secondary:"Source ref"})),...u.map(d=>({id:`check:${d}`,primary:d,secondary:"Check ref"}))]})}):null,e.jsx(Ia,{run:s}),s.blockedReason?e.jsx(O,{title:"Blocked",children:e.jsxs("div",{className:"goal-details-alert",children:[e.jsx(Is,{size:15}),e.jsx("span",{children:s.blockedReason})]})}):null,e.jsx(O,{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 Ia({run:t}){const s=[...t.context.attachments.map(a=>({id:`attachment:${a.id??a.name}`,primary:a.name,secondary:a.ref??a.mediaType??"Attachment"})),...t.context.apps.map(a=>({id:`app:${a.id}`,primary:a.name,secondary:a.required?"Required app context":"Optional app context"})),...t.context.tools.map(a=>({id:`tool:${a.name}`,primary:a.name,secondary:a.outputSummary??a.inputSummary??"Tool context"})),...t.context.targetRepoAssumptions.map(a=>({id:`target:${a}`,primary:a,secondary:"Target assumption"}))],n=t.workflowCapture,i=n?[...n.files.map(a=>({id:`workflow-file:${a}`,primary:a,secondary:"Captured file"})),...n.outputArtifacts.map(a=>({id:`workflow-artifact:${a}`,primary:a,secondary:"Output artifact"})),...n.traceRefs.map(a=>({id:`workflow-trace:${a}`,primary:a,secondary:"Trace"}))]:[];return!s.length&&!i.length?null:e.jsx(O,{title:"Context",children:e.jsx(dt,{refs:[...s,...i]})})}function Wa({goalRuntime:t,subagentRuntime:s,onRunSubagentLifecycleAction:n}){return e.jsxs(e.Fragment,{children:[t?e.jsxs(O,{title:"Goal",children:[e.jsx("p",{className:"goal-details-summary",children:t.objective}),e.jsx(Xe,{rows:[["Status",t.actionLabel],["Runtime",t.timeLabel],["Detail",t.detail]]})]}):null,s?e.jsx(Ba,{runtime:s,onRunSubagentLifecycleAction:n}):null,e.jsx(O,{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 Ba({runtime:t,onRunSubagentLifecycleAction:s}){const[n,i]=l.useState(null),[a,c]=l.useState(null);ke(a);const o=async(u,f)=>{if(!s)return;const p=`${u}:${f}`;i(p),c(null);try{await s({runId:u,action:f})}catch(d){c(d instanceof Error?d.message:String(d))}finally{i(d=>d===p?null:d)}};return e.jsxs(e.Fragment,{children:[e.jsxs(O,{title:"Subagents",children:[e.jsx(Xe,{rows:[["Latest update",qa(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",Qa(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(u=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${u.status}`,children:u.status}),e.jsxs("div",{children:[e.jsx("strong",{children:ft(u.roleId)}),e.jsx("p",{children:u.message})]})]},`${u.runId}:${u.message}`))}):null,e.jsx("ul",{className:"goal-details-list",children:t.runs.slice(0,8).map(u=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${u.status}`,children:u.status}),e.jsxs("div",{children:[e.jsx("strong",{children:ft(u.roleId)}),e.jsx("p",{children:u.objective}),u.report?.summary?e.jsx("small",{children:u.report.summary}):null,s?e.jsx(Ua,{pendingAction:n,run:u,onRun:o}):null]})]},u.id))})]}),t.finalResults.length>0?e.jsx(Oa,{results:t.finalResults}):null]})}function Oa({results:t}){return e.jsx(O,{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:ft(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?`${X(s.confidence)} confidence`:"Confidence unknown"})]}),s.findings.length>0?e.jsxs("small",{children:["Findings: ",je(s.findings,3)]}):null,s.changedFiles.length>0?e.jsxs("small",{children:["Files: ",je(s.changedFiles,4)]}):null,s.testsRun.length>0?e.jsxs("small",{children:["Tests: ",je(s.testsRun,3)]}):null,s.validationAttempts.length>0?e.jsxs("small",{children:["Validation: ",je(s.validationAttempts,2)]}):null,s.refs.length>0?e.jsxs("small",{children:["Refs: ",je(s.refs.map(Xa),4)]}):null,s.blockers.length>0?e.jsxs("small",{children:["Blockers: ",je(s.blockers,3)]}):null,s.workspaceRetention?e.jsxs("small",{children:["Workspace: ",Ya(s.workspaceRetention)]}):null,s.importantMessages.length>0?e.jsxs("small",{children:["Messages: ",je(s.importantMessages.map(Za),2)]}):null]},s.runId))})})}function Ua({pendingAction:t,run:s,onRun:n}){const i=Ha(s);return i.length===0?null:e.jsx("div",{className:"goal-details-actions",children:i.map(a=>{const c=`${s.id}:${a}`,o=t===c;return e.jsx("button",{type:"button",disabled:!!t,onClick:()=>{n(s.id,a)},children:o?"Working...":Va(a)},a)})})}function Ha(t){const s=[],n=Ga(t),i=Ka(t);return n&&s.push("cleanup"),i&&s.push("archive"),s}function Va(t){return t==="cleanup"?"Clean":t==="archive"?"Archive":"Clean + archive"}function Ga(t){if(!Ws(t))return!1;const s=Ze(t.metadata);if(!s?.subagentWorkspace&&!s?.workspaceHandoff)return!1;const n=Ze(s.lifecycleCleanup),i=Ze(n?.workspaceCleanup),a=Bs(i?.status);return a!=="removed"&&a!=="deleted"&&a!=="retained"&&a!=="skipped"}function Ka(t){if(!t.childSessionId||!Ws(t))return!1;const s=Ze(Ze(t.metadata)?.childSessionArchive),n=Bs(s?.status);return n!=="archived"&&n!=="already_archived"}function Ws(t){return t.status==="completed"||t.status==="failed"||t.status==="cancelled"}function qa(t){const s=t.latestMeaningfulUpdate;return s?`${ft(s.roleId)} ${s.status}: ${s.message}`:"No structured update"}function Qa(t,s){if(t<=0&&s<=0)return"0 tokens";const n=`${s} ${s===1?"request":"requests"}`;return`${Ja(t)} tokens · ${n}`}function ft(t){return t.slice(0,1).toUpperCase()+t.slice(1).replace(/[-_]+/g," ")}function Xa(t){return`${t.kind}: ${t.label}`}function Za(t){return`${X(t.kind)}: ${t.body}`}function Ya(t){const s=t.expiresAt?`until ${ei(t.expiresAt)}`:"for inspection",n=t.trigger?` · ${X(t.trigger)}`:"";return`retained ${s}${n}`}function je(t,s){const n=t.slice(0,s),i=t.length-n.length;return i>0?`${n.join(", ")} +${i}`:n.join(", ")}function Ja(t){if(t<1e3)return String(t);if(t>=1e6){const n=t/1e6;return`${Rs(n,n<10?2:1)}M`}const s=t/1e3;return`${Rs(s,s<10?1:0)}k`}function ei(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Rs(t,s){return t.toFixed(s).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")}function ti(){return e.jsxs("div",{className:"goal-details-empty",children:[e.jsx(Ye,{size:18}),e.jsx("span",{children:"No active Goal or Create workflow."})]})}function O({children:t,title:s}){return e.jsxs("section",{className:"goal-details-section",children:[e.jsx("h2",{children:s}),t]})}function Xe({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 dt({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 Ze(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Bs(t){return typeof t=="string"&&t.trim()?t.trim():null}function X(t){return t.split(/[_-]/g).filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function si(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 ni({sandboxId:t,connection:s}){const[n,i]=l.useState(null),[a,c]=l.useState([]),[o,u]=l.useState(null),[f,p]=l.useState(null),[d,b]=l.useState(null),[w,k]=l.useState(null);ke(d,{prefix:"Sandbox"}),ke(w,{prefix:"Sandbox integrations"});const C=n?.integrationLeases??[],I=l.useMemo(()=>a.filter(x=>x.status==="active"),[a]),T=l.useMemo(()=>ii(n),[n]),M=l.useCallback(async()=>{if(!s){b("OpenPond App server is not connected.");return}if(!t){i(null),c([]),b(null);return}u("summary"),b(null);try{const x=await z.sandbox(s,t),N=await z.integrationConnections(s,$s(x.sandbox));i(x.sandbox),c(N.connections),k(null)}catch(x){b(x instanceof Error?x.message:String(x))}finally{u(null)}},[s,t]),U=l.useCallback(async()=>{if(!(!s||!n)){p("load"),k(null);try{const[x,N]=await Promise.all([z.integrationConnections(s,$s(n)),z.sandboxIntegrationLeases(s,n.id)]);c(x.connections),i(N.sandbox)}catch(x){k(x instanceof Error?x.message:String(x))}finally{p(null)}}},[s,n]),W=l.useCallback(async x=>{if(!s||!n)return;const N=xt(x.provider),_=N?bt(N):null,P=_?.leasePolicy.allowedCapabilityIds??[];if(!N||!_?.leasePolicy.leaseable||P.length===0){k(`${se(x.provider)} cannot be attached to this sandbox.`);return}p(`attach:${x.id}`),k(null);try{const E=await z.attachSandboxIntegrationConnection(s,n.id,{connectionId:x.id,provider:x.provider,capabilities:P,...x.scopes.length>0?{scopes:x.scopes}:{},..._.leasePolicy.defaultTtlSeconds?{ttlSeconds:_.leasePolicy.defaultTtlSeconds}:{},required:!1});i(E.sandbox)}catch(E){k(E instanceof Error?E.message:String(E))}finally{p(null)}},[s,n]),G=l.useCallback(async x=>{if(!(!s||!n)){p(`remove:${x}`),k(null);try{const N=await z.removeSandboxIntegrationLease(s,n.id,x);i(N.sandbox)}catch(N){k(N instanceof Error?N.message:String(N))}finally{p(null)}}},[s,n]);return l.useEffect(()=>{M()},[M]),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:o!==null,onClick:()=>{M()},children:o==="summary"?e.jsx(_e,{className:"spinning",size:14}):e.jsx(Ht,{size:14})})]})]}),n?e.jsxs("dl",{className:"sandbox-workspace-kv",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Sandbox"}),e.jsx("dd",{children:Fs(n.id)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Runtime"}),e.jsx("dd",{children:n.runtimeDriver})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Spend"}),e.jsxs("dd",{children:[It(n.reservation.capturedUsd)," / ",It(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:Os(n.updatedAt)})]}),T?e.jsxs("div",{children:[e.jsx("dt",{children:"Receipt"}),e.jsxs("dd",{children:[Fs(T.id)," / ",It(T.totalUsd)]})]}):null]}):e.jsxs("div",{className:"sandbox-workspace-loading",children:[o==="summary"?e.jsx(_e,{className:"spinning",size:16}):null,e.jsx("span",{children:o==="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:C.length}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh integrations","aria-label":"Refresh integrations",disabled:f!==null||!n,onClick:()=>{U()},children:f==="load"?e.jsx(_e,{className:"spinning",size:14}):e.jsx(Ht,{size:14})})]})]}),C.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:C.map(x=>e.jsxs("div",{className:"sandbox-workspace-integration-row",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:se(x.provider)}),e.jsxs("small",{children:[x.required?"required":"optional"," / ",oi(x)," / ",ai(x)]})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:`Revoke ${se(x.provider)} lease`,"aria-label":`Revoke ${se(x.provider)} lease`,disabled:f!==null,onClick:()=>{G(x.leaseId)},children:f===`remove:${x.leaseId}`?e.jsx(_e,{className:"spinning",size:14}):e.jsx(On,{size:14})}),e.jsxs("div",{className:"sandbox-workspace-chip-row",children:[x.capabilities.slice(0,5).map(N=>e.jsx("span",{children:li(x.provider,N)},N)),x.capabilities.length>5?e.jsxs("span",{children:["+",x.capabilities.length-5]}):null]})]},x.leaseId))}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No active integration leases."}),I.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:I.map(x=>{const N=C.some(E=>E.provider===x.provider),P=ri(x)?.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:ci(x)}),e.jsx("small",{children:di(x,P)})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:N?`${se(x.provider)} already attached`:`Attach ${se(x.provider)}`,"aria-label":N?`${se(x.provider)} already attached`:`Attach ${se(x.provider)}`,disabled:N||f!==null||P===0,onClick:()=>{W(x)},children:f===`attach:${x.id}`?e.jsx(_e,{className:"spinning",size:14}):e.jsx(Un,{size:14})})]},x.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 $s(t){return{status:"active"}}function ai(t){return t.proxyUrl?"runtime proxy available":"metadata only, no runtime proxy"}function ii(t){return t?.receipts?.at(-1)??null}function ri(t){const s=xt(t.provider);return s?bt(s):null}function se(t){const s=xt(t),n=s?bt(s):null;return n?n.label:t==="microsoft_teams"?"Microsoft Teams":t?t.replace(/_/g," "):"Integration"}function li(t,s){const n=xt(t);return(n?bt(n):null)?.capabilities.find(a=>a.id===s)?.label??s}function oi(t){return t.expiresAt?`expires ${Os(t.expiresAt)}`:"active"}function ci(t){const s=t.providerAccountName?.trim();return s?`${se(t.provider)} / ${s}`:se(t.provider)}function di(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 Fs(t){return t.length>10?`${t.slice(0,8)}...`:t}function Os(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 It(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=ha(t.taskset),n=t.taskset.learningSignals.demonstrations.filter(o=>o.approved).length,i=t.taskset.tasks.filter(o=>o.split==="frozen_eval").length,a=t.plan?.recipe.method==="sft"||t.plan?.recipe.method==="grpo"?t.plan.recipe:null,c=ma(t.taskset,t.plan);return e.jsxs("div",{className:"training-sidebar-summary",children:[e.jsxs("header",{children:[e.jsx("h2",{children:xa(t.taskset.name)}),e.jsx("span",{children:t.job?ba(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(B,{label:"Primary recommendation",value:s.toUpperCase()}),e.jsx(B,{label:"Training stage",value:c}),e.jsx(B,{label:"Base model",value:a?.baseModel.id??"Not selected"}),e.jsx(B,{label:"Compute",value:t.plan?ga(t.plan.destinationId):"Not selected"}),e.jsx(B,{label:"Started",value:ja(t.job?.startedAt??null)}),e.jsx(B,{label:"Duration",value:va(t.job?.startedAt??null,t.job?.completedAt??null)})]})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Data"}),e.jsxs("dl",{children:[e.jsx(B,{label:"Training examples",value:String(n)}),e.jsx(B,{label:"Test examples",value:String(i)}),e.jsx(B,{label:"Dataset sources",value:String(t.taskset.sourceRefs.length)})]})]}),a?e.jsxs("section",{children:[e.jsx("h3",{children:"Recipe"}),e.jsxs("dl",{children:[a.method==="grpo"?e.jsx(B,{label:"RL loss",value:a.loss.method==="gspo-token"?"GSPO-token":a.loss.method.toUpperCase()}):null,e.jsx(B,{label:"LoRA rank",value:String(a.lora.rank)}),e.jsx(B,{label:"Learning rate",value:String(a.optimizer.learningRate)}),e.jsx(B,{label:"Optimizer steps",value:String(a.optimizer.maxSteps)}),e.jsx(B,{label:a.method==="grpo"?"Prompt length":"Sequence length",value:String(a.method==="grpo"?a.dataset.maxPromptTokens:a.dataset.maxSequenceLength)})]})]}):null,e.jsxs("section",{children:[e.jsx("h3",{children:"Result"}),e.jsxs("dl",{children:[e.jsx(B,{label:"Adapter",value:t.lineage?`${c} ready`:"Not created"}),e.jsx(B,{label:"Evaluation",value:t.lineage?.frozenEvaluationArtifactId?"Completed":"Not completed"}),e.jsx(B,{label:"Artifacts",value:String(t.artifacts.length)})]})]})]})}function B({label:t,value:s}){return e.jsxs("div",{children:[e.jsx("dt",{children:t}),e.jsx("dd",{children:s})]})}function fi(t){const s=Es("","","folder");for(const n of t){const i=n.endsWith("/"),a=n.split("/").filter(Boolean);if(a.length===0)continue;let c=s,o="";for(let u=0;u<a.length;u+=1){const f=a[u];o=o?`${o}/${f}`:f;const p=!i&&u===a.length-1?"file":"folder",d=`${p}:${f}`;let b=c.childMap.get(d);b||(b=Es(f,o,p),c.childMap.set(d,b),c.children.push(b)),c=b}}return Us(s.children)}function Es(t,s,n){return{name:t,path:s,type:n,children:[],childMap:new Map}}function Us(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:Us(s.children)}))}function pi({changedByPath:t,expandedFolderPaths:s,rootPath:n,repoFiles:i,selectedPath:a,onOpenFile:c,onToggleFolder:o}){const u=l.useMemo(()=>fi(i),[i]);return e.jsxs("div",{className:"workspace-file-tree-view",children:[e.jsxs("div",{className:"workspace-file-tree-header",children:[e.jsx(ut,{size:14}),e.jsx("strong",{title:n??void 0,children:n?n.split("/").at(-1):"Files"}),e.jsx("span",{children:i.length})]}),e.jsx("div",{className:"workspace-file-tree",children:u.map(f=>e.jsx(Hs,{changedByPath:t,expandedFolderPaths:s,node:f,rootPath:n,selectedPath:a,onOpenFile:c,onToggleFolder:o},`${f.type}:${f.path}`))})]})}function Hs({changedByPath:t,depth:s=0,expandedFolderPaths:n,node:i,rootPath:a,selectedPath:c,onOpenFile:o,onToggleFolder:u}){const f=a?`${a}/${i.path}`:i.path,p=i.type==="folder"&&n.has(f),d=t.get(f),b=2+s*11;return i.type==="folder"?e.jsxs("div",{className:"workspace-file-tree-node",children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row folder","aria-expanded":p,style:{paddingLeft:b},onClick:()=>u(f),children:[p?e.jsx(ut,{size:14}):e.jsx(Hn,{size:14}),e.jsx("span",{children:i.name})]}),p&&i.children.map(w=>e.jsx(Hs,{changedByPath:t,depth:s+1,expandedFolderPaths:n,node:w,rootPath:a,selectedPath:c,onOpenFile:o,onToggleFolder:u},`${w.type}:${w.path}`))]}):e.jsxs("button",{type:"button",className:`workspace-file-tree-row file ${d?"changed":""} ${c===f?"selected":""}`,style:{paddingLeft:b},onClick:()=>o(f),children:[e.jsx(Ea,{size:13}),e.jsx("span",{children:i.name}),d&&e.jsxs("small",{children:[e.jsxs("span",{className:"diff-addition",children:["+",d.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",d.deletions]})]})]})}function As({diff:t,expandedFolderPaths:s,rootPath:n,repoFiles:i,selectedPath:a,onOpenFile:c,onToggleFolder:o}){const u=t?.files??[],f=l.useMemo(()=>new Map(u.map(b=>[b.path,b])),[u]),p=n?.replace(/^\/+|\/+$/g,"")||null,d=l.useMemo(()=>{if(!p)return i;const b=`${p}/`;return i.filter(w=>w.startsWith(b)).map(w=>w.slice(b.length)).filter(Boolean)},[p,i]);return e.jsx("div",{className:"workspace-diff-files-view",children:e.jsx(pi,{changedByPath:f,expandedFolderPaths:s,rootPath:p,repoFiles:d,selectedPath:a,onOpenFile:c,onToggleFolder:o})})}function hi({collapsed:t,editorControlsVisible:s,hideWhiteSpace:n,loadFullFiles:i,renderMarkdown:a,wordDiffs:c,wordWrap:o,onClose:u,onCopyGitApply:f,onRefresh:p,onToggleCollapsed:d,onToggleEditorControlsVisible:b,onToggleHideWhiteSpace:w,onToggleLoadFullFiles:k,onToggleRenderMarkdown:C,onToggleWordDiffs:I,onToggleWordWrap:T}){return e.jsxs("div",{className:"workspace-diff-options-menu",role:"menu",children:[e.jsx(le,{icon:e.jsx(Ht,{size:14}),label:"Refresh",onClick:p,onClose:u}),e.jsx(le,{checked:o,icon:e.jsx(Vn,{size:14}),label:"Enable word wrap",onClick:T,onClose:u}),e.jsx(le,{checked:t,icon:e.jsx(Ca,{size:14}),label:"Collapse all diffs",onClick:d,onClose:u}),e.jsx("div",{className:"workspace-diff-menu-divider"}),e.jsx(le,{checked:s,icon:e.jsx(La,{size:14}),label:"Show editor controls",onClick:b,onClose:u}),e.jsx(le,{checked:a,icon:e.jsx(Ms,{size:14}),label:"Render Markdown",onClick:C,onClose:u}),e.jsx(le,{checked:!i,icon:e.jsx(Ye,{size:14}),label:"Show diffs first",onClick:k,onClose:u}),e.jsx(le,{checked:c,icon:e.jsx(Sa,{size:14}),label:"Enable word diffs",onClick:I,onClose:u}),e.jsx(le,{checked:n,icon:e.jsx(Gn,{size:14}),label:"Hide white space",onClick:w,onClose:u}),e.jsx(le,{icon:e.jsx(Kn,{size:14}),label:"Copy git apply command",onClick:f,onClose:u})]})}function le({checked:t,icon:s,label:n,onClick:i,onClose:a}){return e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{i?.(),a()},children:[s,e.jsx("span",{children:n}),t&&e.jsx(qn,{size:14})]})}function mi({addMenuOpen:t,expanded:s,filteredFiles:n,dirtyFilePaths:i,openFiles:a,goalDetailsAvailable:c,searchOpen:o,searchQuery:u,selectedPath:f,sideChatTabs:p=[],summaryAvailable:d,sourceStatus:b,sourceSwitcher:w,visibleTab:k,onCloseFileTab:C,onCloseSideChat:I,onCloseSearch:T,onOpenFile:M,onOpenBrowser:U,onOpenSearch:W,onOpenSideChat:G,onSearchQueryChange:x,onSelectFile:N,onSelectFiles:_,onSelectGoal:P,onSelectSummary:E,onSelectSideChat:J,onToggleAddMenu:D,onToggleExpanded:V}){const K=l.useRef(null);l.useEffect(()=>{if(!t&&!o)return;function g(){t&&D(),o&&T()}function q(oe){K.current?.contains(oe.target)||g()}function ie(oe){oe.key==="Escape"&&g()}return document.addEventListener("pointerdown",q),document.addEventListener("keydown",ie),()=>{document.removeEventListener("pointerdown",q),document.removeEventListener("keydown",ie)}},[t,T,D,o]);function ae(g){if(g.key==="Escape"){T();return}g.key==="Enter"&&n[0]&&M(n[0])}function A(g){if(!["ArrowRight","ArrowLeft","Home","End"].includes(g.key))return;const q=g.target;if(!(q instanceof HTMLButtonElement)||q.getAttribute("role")!=="tab")return;const ie=Array.from(g.currentTarget.querySelectorAll('button[role="tab"]')),oe=ie.indexOf(q);if(oe<0||ie.length===0)return;g.preventDefault();const ee=sa(oe,ie.length,g.key),Se=ie[ee];if(!Se)return;Se.focus(),Se.click();const Q=Se.id;Q&&window.requestAnimationFrame(()=>document.getElementById(Q)?.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:A,children:[c?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="goal"?"active":""}`,role:"tab","aria-selected":k==="goal",onClick:P,children:[e.jsx(Ye,{size:14}),e.jsx("span",{children:"Goal"})]}):null,d&&E?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="summary"?"active":""}`,role:"tab","aria-selected":k==="summary",onClick:E,children:[e.jsx(Cs,{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:_,children:[e.jsx(ut,{size:14}),e.jsx("span",{children:"Files"})]}),a.map(g=>e.jsxs("div",{className:`workspace-diff-tab file ${k==="file"&&f===g.path?"active":""}`,children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab","aria-selected":k==="file"&&f===g.path,title:g.path,onClick:()=>N(g.path),children:[e.jsx(Ye,{className:"workspace-diff-tab-icon",size:13}),i.has(g.path)&&e.jsx("span",{className:"workspace-diff-tab-dirty","aria-hidden":"true"}),e.jsx("span",{children:g.path.split("/").pop()})]}),e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${g.path}`,onClick:q=>C(g.path,q),children:e.jsx(ks,{size:12})})]},g.path)),p.map(g=>e.jsxs("div",{className:"workspace-diff-tab right-chat-tab",children:[e.jsx("button",{type:"button",className:"workspace-diff-tab-main",role:"tab",id:`right-chat-tab-${g.id}`,"aria-controls":`right-chat-panel-${g.id}`,"aria-selected":!1,tabIndex:-1,title:g.title,onClick:()=>J?.(g.id),children:e.jsx("span",{children:g.title})}),I?e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${g.title}`,"aria-label":`Close ${g.title}`,onClick:q=>{q.stopPropagation(),I(g.id)},children:e.jsx(ks,{size:12})}):null]},g.id)),e.jsxs("div",{className:"workspace-diff-add-anchor",ref:K,children:[e.jsx("button",{type:"button",className:`workspace-diff-add-tab ${t||o?"active":""}`,title:"Add","aria-label":"Add to right sidebar",onClick:D,children:e.jsx(Qn,{size:15})}),t&&e.jsxs("div",{className:"workspace-diff-add-menu",role:"menu",children:[G?e.jsxs("button",{type:"button",role:"menuitem",onClick:G,children:[e.jsx(Xn,{size:14}),e.jsx("span",{children:"New task"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:_,children:[e.jsx(ut,{size:14}),e.jsx("span",{children:"Files"}),e.jsx("kbd",{})]}),d&&E?e.jsxs("button",{type:"button",role:"menuitem",onClick:E,children:[e.jsx(Cs,{size:14}),e.jsx("span",{children:"Summary"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:W,children:[e.jsx(Zn,{size:14}),e.jsx("span",{children:"Open file"}),e.jsx("kbd",{children:"Ctrl+P"})]}),e.jsxs("button",{type:"button",role:"menuitem",onClick:U,children:[e.jsx(Yn,{size:14}),e.jsx("span",{children:"Browser"}),e.jsx("kbd",{children:"Ctrl+I"})]})]}),o&&e.jsxs("div",{className:"workspace-file-search-popover",children:[e.jsx("input",{autoFocus:!0,placeholder:"Search files",value:u,onChange:g=>x(g.target.value),onKeyDown:ae}),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(g=>e.jsx("button",{type:"button",onClick:()=>M(g),children:g},g))})]})]})]}),w||b?e.jsxs("div",{className:"workspace-diff-source-bar","aria-label":"Workspace source",children:[w?e.jsx("div",{className:"workspace-diff-source-toggle",role:"group","aria-label":"File source",children:w.options.map(g=>e.jsx("button",{type:"button",className:w.value===g.value?"active":"","aria-pressed":w.value===g.value,onClick:()=>w.onChange(g.value),children:g.label},g.value))}):null,b?e.jsx("span",{className:`workspace-diff-source-status ${b.tone}`,children:b.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:V,children:s?e.jsx(Jn,{size:14}):e.jsx(ea,{size:14})})]})}function xi({canCheckActiveFile:t,canSaveActiveFile:s,collapsed:n,editorControlsVisible:i,editorDiagnosticStatus:a,editorDiagnosticsChecking:c,hideWhiteSpace:o,loadFullFiles:u,menuOpen:f,renderMarkdown:p,showEditorCommandBar:d,showRenderMarkdownToggle:b,splitView:w,wordDiffs:k,wordWrap:C,onCopyGitApply:I,onEditorCheck:T,onEditorRedo:M,onEditorSave:U,onEditorUndo:W,onRefresh:G,onToggleCollapsed:x,onToggleEditorControlsVisible:N,onToggleHideWhiteSpace:_,onToggleLoadFullFiles:P,onToggleMenu:E,onToggleRenderMarkdown:J,onToggleSplitView:D,onToggleWordDiffs:V,onToggleWordWrap:K}){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":f,onClick:()=>E(),children:e.jsx(ta,{size:15})}),f&&e.jsx(hi,{collapsed:n,editorControlsVisible:i,hideWhiteSpace:o,loadFullFiles:u,renderMarkdown:p,wordDiffs:k,wordWrap:C,onClose:()=>E(!1),onCopyGitApply:I,onRefresh:G,onToggleCollapsed:x,onToggleEditorControlsVisible:N,onToggleHideWhiteSpace:_,onToggleLoadFullFiles:P,onToggleRenderMarkdown:J,onToggleWordDiffs:V,onToggleWordWrap:K})]}),d&&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:U,children:e.jsx(wa,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Undo","aria-label":"Undo",onClick:W,children:e.jsx(_a,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Redo","aria-label":"Redo",onClick:M,children:e.jsx(Da,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Check file","aria-label":"Check file",disabled:!t,onClick:T,children:c?e.jsx(_e,{className:"spinning",size:14}):e.jsx(ys,{size:14})}),a&&e.jsxs("span",{className:`workspace-editor-diagnostic-chip ${a.severity}`,children:[a.severity==="error"||a.severity==="warning"||a.severity==="unavailable"?e.jsx(Is,{size:13}):e.jsx(ys,{size:13}),e.jsx("span",{children:a.label})]})]}),b&&e.jsx("button",{type:"button",className:`diff-icon-button ${p?"active":""}`,title:p?"Show Markdown source":"Render Markdown","aria-label":p?"Show Markdown source":"Render Markdown","aria-pressed":p,onClick:J,children:e.jsx(Ms,{size:14})}),e.jsx("button",{type:"button",className:`diff-icon-button ${w?"active":""}`,title:w?"Show unified diff":"Show split diff","aria-label":w?"Show unified diff":"Show split diff","aria-pressed":w,onClick:D,children:e.jsx($a,{size:14})})]})})}const bi={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 Vt(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 bi[n]??"text"}function gi(t,s){return t?s==="markdown"?ji(t):s==="json"?we(t,/("(?:\\.|[^"\\])*"(?=\s*:)|"(?:\\.|[^"\\])*"|[-]?\b\d+(?:\.\d+)?\b|\btrue\b|\bfalse\b|\bnull\b|[{}[\]:,])/g):s==="css"?we(t,/(\/\*.*?\*\/|#[\da-fA-F]{3,8}\b|--[\w-]+|[.#]?[\w-]+(?=\s*:)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\b\d+(?:\.\d+)?(?:px|rem|em|%|vh|vw)?\b|[{}():;,])/g):s==="html"?we(t,/(<!--.*?-->|<\/?[\w-]+|[\w:-]+(?==)|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[<>/=])/g):s==="shell"?we(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"?we(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):we(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 ji(t){return/^\s{0,3}#{1,6}\s/.test(t)?[{text:t,kind:"keyword"}]:/^\s*[-*+]\s/.test(t)?[{text:t,kind:"property"}]:we(t,/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)]+\)|https?:\/\/\S+)/g)}function vi(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 we(t,s){const n=[];let i=0;for(const a of t.matchAll(s)){const c=a.index??0;c>i&&n.push({text:t.slice(i,c),kind:"plain"});const o=a[0];if(n.push({text:o,kind:vi(o)}),i=c+o.length,/^(\/\/|#|<!--)/.test(o))break}return i<t.length&&n.push({text:t.slice(i),kind:"plain"}),n.length>0?n:[{text:t,kind:"plain"}]}function pt({language:t,text:s}){return e.jsx(e.Fragment,{children:gi(s,t).map((n,i)=>e.jsx("span",{className:`syntax-token ${n.kind}`,children:n.text},`${i}-${n.text}`))})}const wi=`
|
|
3
|
-
|
|
4
|
-
[file truncated]`,ki=l.lazy(()=>ra(()=>import("./WorkspaceMonacoEditor-LhFdzCRs.js").then(t=>t.jc),__vite__mapDeps([0,1,2,3]),import.meta.url)),Wt=6,yi=18,ve=22,Ls=44,Si=160,Ps=12;function ht({path:t,workspaceName:s,workspaceRootPath:n,onSelectPath:i}){const a=zs(t,n),c=aa(a),o=c?Ni(a):s?.trim()||"Workspace",f=(c&&o!=="/"&&a.startsWith(`${o}/`)?a.slice(o.length+1):a).split("/").filter(Boolean),p=!!(i&&!c);return e.jsxs("span",{className:"workspace-file-breadcrumbs",title:c?a:`${o} > ${a}`,children:[i&&!c?e.jsx("button",{type:"button",onClick:()=>i(null),children:o}):e.jsx("span",{children:o}),f.map((d,b)=>{const w=b===f.length-1,k=f.slice(0,b+1).join("/");return e.jsxs("span",{className:"workspace-file-breadcrumb-segment",children:[e.jsx(ia,{size:13}),i&&p&&!w?e.jsx("button",{type:"button",onClick:()=>i(k),children:d}):e.jsx("span",{children:d})]},`${b}-${d}`)})]})}function Ni(t){const s=/^[A-Za-z]:\//.exec(t);return s?s[0].slice(0,-1):"/"}function Ci({collapsed:t=!1,diagnostics:s=[],draftContent:n,editable:i=!1,editorRef:a,error:c,file:o,hideWhiteSpace:u=!1,imageSrc:f,loading:p,loadFullFiles:d,onOpenImage:b,onSelectBreadcrumbPath:w,onDraftContentChange:k,onLspAction:C,onSave:I,renderMarkdown:T,saveError:M,saving:U=!1,splitView:W=!1,wordDiffs:G=!1,wordWrap:x,workspaceName:N,workspaceRootPath:_}){ke(c,{prefix:"File preview"}),ke(M,{prefix:"Save failed"});const P=n??o.content??"",E=l.useMemo(()=>P.split(`
|
|
5
|
-
`).slice(0,800),[P]),J=Vt(o.path),D=n!=null||o.content!=null,V=P.endsWith(wi),K=T&&D&&Ot(o.path),ae=D&&na(o.path)&&Ai(P);return f?e.jsxs("div",{className:"workspace-file-preview",children:[e.jsx("div",{className:"workspace-diff-file-heading",children:e.jsxs("div",{children:[e.jsx(ht,{path:o.path,workspaceName:N,workspaceRootPath:_,onSelectPath:w}),e.jsxs("span",{className:"diff-addition",children:["+",o.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",o.deletions]})]})}),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 ${o.path}`,onClick:b,children:e.jsx("img",{alt:o.path,decoding:"async",src:f})})})]}):!d&&o.patch||!D&&o.patch?W?e.jsx($i,{collapsed:t,file:o,hideWhiteSpace:u,onSelectBreadcrumbPath:w,wordDiffs:G,wordWrap:x,workspaceName:N,workspaceRootPath:_}):e.jsx(Ri,{collapsed:t,file:o,hideWhiteSpace:u,wordWrap:x,workspaceName:N,workspaceRootPath:_,onSelectBreadcrumbPath:w}):e.jsxs("div",{className:`workspace-file-preview ${x?"wrap":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(ht,{path:o.path,workspaceName:N,workspaceRootPath:_,onSelectPath:w}),e.jsxs("span",{className:"diff-addition",children:["+",o.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",o.deletions]})]}),U?e.jsx("span",{className:"workspace-file-save-state",children:"Saving"}):null]}),D?K?e.jsx("div",{className:"workspace-markdown-preview",children:e.jsx(fa,{content:P})}):ae?e.jsx(Fi,{file:o,contentBase64:P}):i&&!V?e.jsx(l.Suspense,{fallback:e.jsx("div",{className:"workspace-diff-code-empty",children:"Loading editor"}),children:e.jsx(ki,{diagnostics:s,filePath:o.path,onChange:A=>k?.(A),onLspAction:C,onSave:()=>I?.(),ref:a,value:P,wordWrap:x})}):e.jsx("div",{className:"workspace-file-code",children:E.map((A,g)=>e.jsxs("div",{className:"workspace-file-code-row",children:[e.jsx("span",{children:g+1}),e.jsx("code",{children:e.jsx(pt,{language:J,text:A||" "})})]},`${g}-${A}`))}):e.jsx("div",{className:"workspace-diff-code-empty",children:p?"Loading file content":"No file content available."})]})}function Ri({collapsed:t=!1,file:s,hideWhiteSpace:n=!1,wordWrap:i,workspaceName:a,workspaceRootPath:c,onSelectBreadcrumbPath:o}){const u=l.useMemo(()=>Gs(s.patch,n),[s.patch,n]),f=Vt(s.path);return e.jsxs("div",{className:`workspace-diff-preview ${i?"wrap":""}`,children:[e.jsx("div",{className:"workspace-diff-file-heading",children:e.jsxs("div",{children:[e.jsx(ht,{path:s.path,workspaceName:a??null,workspaceRootPath:c,onSelectPath:o}),e.jsxs("span",{className:"diff-addition",children:["+",s.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",s.deletions]})]})}),t?e.jsx("div",{className:"workspace-diff-code-empty",children:"Diff collapsed"}):e.jsx(Vs,{ariaLabel:`${s.path} diff`,className:"workspace-diff-code",emptyMessage:"No patch available.",rows:u,renderRow:(p,d)=>p.kind==="spacer"?e.jsx("div",{className:"workspace-diff-spacer",role:"row",children:p.label},`${p.label}-${d}`):e.jsxs("div",{className:`workspace-diff-code-row ${p.kind}`,role:"row",children:[e.jsx("span",{className:"workspace-diff-line-number",role:"cell",children:p.newLine||p.oldLine}),e.jsx("code",{role:"cell",children:e.jsx(pt,{language:f,text:p.newContent||p.oldContent||" "})})]},`${p.oldLine}-${p.newLine}-${d}`),wordWrap:i})]})}function $i({collapsed:t,file:s,hideWhiteSpace:n,wordDiffs:i,wordWrap:a,workspaceName:c,workspaceRootPath:o,onSelectBreadcrumbPath:u}){const f=l.useMemo(()=>Gs(s.patch,n),[s.patch,n]),p=Vt(s.path);return e.jsxs("div",{className:`workspace-diff-preview split ${a?"wrap":""} ${i?"word-diffs":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(ht,{path:s.path,workspaceName:c,workspaceRootPath:o,onSelectPath:u}),e.jsxs("span",{className:"diff-addition",children:["+",s.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",s.deletions]})]}),e.jsx(ka,{size:14})]}),t?e.jsx("div",{className:"workspace-diff-code-empty",children:"Diff collapsed"}):e.jsx(Vs,{ariaLabel:`${s.path} split diff`,className:"workspace-split-code",emptyMessage:"No patch available.",rows:f,renderRow:(d,b)=>d.kind==="spacer"?e.jsx("div",{className:"workspace-diff-spacer split",role:"row",children:d.label},`${d.label}-${b}`):e.jsxs("div",{className:`workspace-split-row ${d.kind}`,role:"row",children:[e.jsx("span",{className:"workspace-diff-line-number old",role:"cell",children:d.oldLine}),e.jsx("code",{className:"old",role:"cell",children:e.jsx(pt,{language:p,text:d.oldContent||" "})}),e.jsx("span",{className:"workspace-diff-line-number new",role:"cell",children:d.newLine}),e.jsx("code",{className:"new",role:"cell",children:e.jsx(pt,{language:p,text:d.newContent||" "})})]},`${d.oldLine}-${d.newLine}-${b}`),wordWrap:a})]})}function Fi({file:t,contentBase64:s}){const n=l.useMemo(()=>{const i=Li(s);if(!i)return null;const a=new Blob([new Uint8Array(i)],{type:Ei(t.path)});return URL.createObjectURL(a)},[s,t.path]);return l.useEffect(()=>()=>{n&&URL.revokeObjectURL(n)},[n]),n?e.jsxs("div",{className:"workspace-document-preview",children:[e.jsxs("div",{className:"workspace-document-preview-card",children:[e.jsx("strong",{children:t.path.split("/").pop()}),e.jsx("span",{children:"Word document"}),e.jsx("a",{href:n,download:t.path.split("/").pop()||"document",children:"Download document"})]}),e.jsx("iframe",{src:n,title:`${t.path} preview`})]}):e.jsx("div",{className:"workspace-diff-code-empty",children:"Document preview unavailable."})}function Ei(t){return/\.docx$/i.test(t)?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"application/msword"}function Ai(t){return t.length>0&&/^[A-Za-z0-9+/=\s]+$/.test(t)}function Li(t){try{const s=atob(t.replace(/\s/g,"")),n=new Uint8Array(s.length);for(let i=0;i<s.length;i+=1)n[i]=s.charCodeAt(i);return n}catch{return null}}function Vs({ariaLabel:t,className:s,emptyMessage:n,rows:i,renderRow:a,wordWrap:c}){const o=!c&&i.length>Si,{endIndex:u,offsetTop:f,scrollRef:p,startIndex:d,totalHeight:b}=Pi(i.length,o);return i.length===0?e.jsx("div",{className:s,role:"table","aria-label":t,children:e.jsx("div",{className:"workspace-diff-code-empty",children:n})}):o?e.jsx("div",{className:`${s} virtualized`,ref:p,role:"table","aria-label":t,"aria-rowcount":i.length,children:e.jsx("div",{className:"workspace-diff-virtual-spacer",style:{height:b},children:e.jsx("div",{className:"workspace-diff-virtual-window",style:{transform:`translateY(${f}px)`},children:i.slice(d,u).map((w,k)=>a(w,d+k))})})}):e.jsx("div",{className:s,role:"table","aria-label":t,children:i.map(a)})}function Pi(t,s){const n=l.useRef(null),[i,a]=l.useState({height:ve*Ls,scrollTop:0}),c=l.useCallback(()=>{const p=n.current;p&&a({height:p.clientHeight||ve*Ls,scrollTop:p.scrollTop})},[]);if(l.useEffect(()=>{if(!s)return;const p=n.current;if(!p)return;c();let d=0;const b=()=>{if(typeof window>"u"){c();return}window.cancelAnimationFrame(d),d=window.requestAnimationFrame(c)};p.addEventListener("scroll",b,{passive:!0});const w=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>b());return w?.observe(p),()=>{p.removeEventListener("scroll",b),w?.disconnect(),typeof window<"u"&&window.cancelAnimationFrame(d)}},[s,c]),!s)return{endIndex:t,offsetTop:0,scrollRef:n,startIndex:0,totalHeight:t*ve};const o=Math.ceil(i.height/ve),u=Math.max(0,Math.floor(i.scrollTop/ve)-Ps);return{endIndex:Math.min(t,u+o+Ps*2),offsetTop:u*ve,scrollRef:n,startIndex:u,totalHeight:t*ve}}function Gs(t,s){if(!t.trim())return[];const n=[];let i=0,a=0,c=null,o=null,u=!1,f=[];function p(){n.push(...Di(f)),f=[]}function d(){u&&(p(),c=i,o=a,u=!1)}for(const b of t.split(`
|
|
6
|
-
`)){const w=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(b);if(w){d();const I=Number(w[1]),T=Number(w[2]);if(c!==null&&o!==null){const M=Math.max(I-c,T-o,0);M>0&&n.push({kind:"spacer",label:Ks(M)})}i=I,a=T,u=!0;continue}if(b.startsWith("diff --git")||b.startsWith("index ")||b.startsWith("--- ")||b.startsWith("+++ ")||!u||b.startsWith("\\ No newline"))continue;const k=b.slice(1)||" ";if(s&&!k.trim())continue;if(b.startsWith("+")){p(),n.push({kind:"addition",oldLine:"",newLine:String(a||""),oldContent:"",newContent:k}),a+=1;continue}if(b.startsWith("-")){p(),n.push({kind:"deletion",oldLine:String(i||""),newLine:"",oldContent:k,newContent:""}),i+=1;continue}const C=b.startsWith(" ")?b.slice(1)||" ":b||" ";s&&!C.trim()||(f.push({kind:"context",oldLine:String(i||""),newLine:String(a||""),oldContent:C,newContent:C}),i+=1,a+=1)}return d(),n}function Di(t){if(t.length<yi)return t;const s=t.length-Wt*2;return s<=0?t:[...t.slice(0,Wt),{kind:"spacer",label:Ks(s)},...t.slice(-Wt)]}function Ks(t){return`${t} unmodified ${t===1?"line":"lines"}`}const mt=`
|
|
7
|
-
|
|
8
|
-
[file truncated]`,Ti="openpond.sandboxSourceReadback.v1";async function _i(t,s,n,i=[]){let a;try{a=await z.sandboxDownloadFile(t,s,n,{maxBytes:256*1024})}catch(o){const u=o instanceof Error?o.message:String(o);if(!Mi(u))throw o;const f=Wi(i,s,n);if(f)return f;const p=!!Gt(i,s)?.artifact,d=await z.sandbox(t,s).catch(()=>null);throw new Error(zi(n,d?.sandbox??null,u,{hasReadbackArtifact:p}))}const c=a.file.isBinary?a.file.contentsBase64||null:`${a.contents}${a.file.truncated?mt:""}`;return{path:a.file.path,status:"",additions:0,deletions:0,patch:"",content:c}}function Mi(t){return t.includes("sandbox_not_ready")&&t.includes("placement_stale")||t.includes("sandbox_not_running")}function zi(t,s,n="sandbox_not_ready:placement_stale",i={}){const a=s?Bi(s):null,c=t||"this file";if(i.hasReadbackArtifact)return`Sandbox file content is unavailable because the stopped runtime placement is stale. The latest source checkpoint has a saved readback artifact, but ${c} was not captured as text. Resume the sandbox to inspect it. ${n}`;if(!a)return`Sandbox file content is unavailable because the stopped runtime placement is stale. Resume the sandbox to inspect ${c}. ${n}`;const o=a.preservedSha?a.preservedSha.slice(0,12):null,u=a.sourceRef?` (${a.sourceRef})`:"";return`Sandbox file content is unavailable because the stopped runtime placement is stale. The latest source checkpoint is saved${o?` at ${o}`:""}${u}, but this Desktop app cannot read file bodies from preserved source refs yet. Resume the sandbox to inspect ${c}.`}function Ii(t,s){if(!s)return null;const n=Gt(t,s);if(!n)return null;const i=Qs(n.artifact),a=new Map;for(const u of Kt(i))a.set(u.path,u);for(const u of Xs(n.artifact)){const f=qs(n.artifact,u.path);f&&a.set(u.path,f)}const c=[...a.values()].sort((u,f)=>u.path.localeCompare(f.path)),o=[...new Set(c.map(u=>u.path))].sort((u,f)=>u.localeCompare(f));return{appId:s,repoPath:"",initialized:!0,dirty:!1,filesChanged:c.length,additions:c.reduce((u,f)=>u+f.additions,0),deletions:c.reduce((u,f)=>u+f.deletions,0),repoFiles:o,files:c,error:null,updatedAt:Me(ne(n.artifact)?.createdAt)??n.event.timestamp}}function Wi(t,s,n){if(!s)return null;const i=Gt(t,s);return i?qs(i.artifact,n):null}function Gt(t,s){for(let n=t.length-1;n>=0;n-=1){const i=t[n];if(i?.name!=="workspace_action_result")continue;const a=ne(i.data),c=ne(a?.sourcePreservation),o=ne(c?.sourceReadbackArtifact);if(o&&o.schemaVersion===Ti&&o.sandboxId===s)return{artifact:o,event:i}}return null}function qs(t,s){const n=Kt(Qs(t)).find(c=>c.path===s),i=Xs(t).find(c=>c.path===s);if(!n&&!i)return null;const a=typeof i?.content=="string"?`${i.content}${i.truncated?mt:""}`:null;return{path:i?.path??n?.path??s,status:n?.status??"M",additions:n?.additions??0,deletions:n?.deletions??0,patch:n?.patch??"",content:a}}function Qs(t){const s=ne(t.patch);return typeof s?.text=="string"?s.text:""}function Xs(t){return(Array.isArray(t.files)?t.files:[]).map(n=>{const i=ne(n),a=Me(i?.path);return a?{path:a,...typeof i?.content=="string"?{content:i.content}:{},...i?.truncated===!0?{truncated:!0}:{}}:null}).filter(n=>!!n)}function Bi(t){const s=ne(t.metadata)??{},n=ne(s.sourcePreservation)??ne(s.sourcePreserve),i=ne(s.sourceChangeDetection),a=Me(n?.preservedSha)??Me(i?.preservedSha)??null,c=Me(n?.sourceRef)??Me(i?.sourceRef)??(typeof t.repoRef=="string"?t.repoRef:null);return!a&&!c?null:{preservedSha:a,sourceRef:c}}function ne(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Me(t){return typeof t=="string"&&t.trim()?t.trim():null}async function Oi(t,s,n,i){const a=await z.sandboxUploadFile(t,s,{path:n,contents:i});return await z.preserveSandboxSource(t,s,{message:"Auto-preserve source after right sidebar save"}),{path:a.file.path,status:"M",additions:0,deletions:0,patch:"",content:i}}function Ui(t){return t.filter(s=>s.type==="file").map(s=>s.path).sort((s,n)=>s.localeCompare(n))}function Hi(t,s){const n=new Map;for(const i of Kt(t?.diff??""))n.set(i.path,i);for(const i of Vi(s?.porcelain??""))n.has(i.path)||n.set(i.path,i);return[...n.values()].sort((i,a)=>i.path.localeCompare(a.path))}function Kt(t){const s=[];let n=null;const i=()=>{n&&(s.push({path:n.path,status:n.status,additions:n.additions,deletions:n.deletions,patch:n.patchLines.join(`
|
|
9
|
-
`),content:null}),n=null)};for(const a of t.split(`
|
|
10
|
-
`)){if(a.startsWith("diff --git ")){i(),n={path:Ki(a)??"changed-file",status:"M",additions:0,deletions:0,patchLines:[a]};continue}if(n){if(n.patchLines.push(a),a.startsWith("+++ ")){const c=Ds(a.slice(4));c&&(n.path=c);continue}if(a.startsWith("--- ")){const c=Ds(a.slice(4));c&&n.path==="changed-file"&&(n.path=c);continue}a.startsWith("new file mode ")&&(n.status="A"),a.startsWith("deleted file mode ")&&(n.status="D"),a.startsWith("rename to ")&&(n.status="R",n.path=a.slice(10).trim()||n.path),a.startsWith("+")&&!a.startsWith("+++")&&(n.additions+=1),a.startsWith("-")&&!a.startsWith("---")&&(n.deletions+=1)}}return i(),s}function Vi(t){const s=[];for(const n of t.split(`
|
|
11
|
-
`)){if(!n.trim())continue;const i=Gi(n);i&&s.push({path:i,status:n.slice(0,2).trim()||"M",additions:0,deletions:0,patch:"",content:null})}return s}function Gi(t){const s=t.slice(3).trim();return s?s.split(" -> ").pop()?.trim()||s:null}function Ki(t){const s=/^diff --git a\/(.+) b\/(.+)$/.exec(t.trim());return s?.[2]??s?.[1]??null}function Ds(t){const s=t.trim();return!s||s==="/dev/null"?null:s.startsWith("a/")||s.startsWith("b/")?s.slice(2):s}const Zs="openpond.workspace.editorControlsVisible";function qi(){try{return window.localStorage.getItem(Zs)==="true"}catch{return!1}}function Qi(t){try{window.localStorage.setItem(Zs,String(t))}catch{}}function Xi({activeDiagnostics:t,activeServers:s,editorDiagnosticsChecking:n,editorLspEnabled:i,showEditorCommandBar:a}){if(!a)return null;if(!i)return{label:"LSP off",severity:"unavailable"};if(n)return{label:"Checking",severity:"info"};const c=t.filter(p=>p.severity==="error").length;if(c>0)return{label:`${c} error${c===1?"":"s"}`,severity:"error"};const o=t.filter(p=>p.severity==="warning").length;if(o>0)return{label:`${o} warning${o===1?"":"s"}`,severity:"warning"};const u=t.length;if(u>0)return{label:`${u} note${u===1?"":"s"}`,severity:"info"};if(!s)return null;const f=s.find(p=>p.status!=="connected");return f?{label:f.id==="none"?"No LSP":`${f.id} unavailable`,severity:"unavailable"}:{label:"No issues",severity:"none"}}const Ts=3e3,Zi=2e3,_s=[],Yi=[];function fr({appId:t,workspaceKind:s,connection:n,runtimeEvents:i,diff:a,editorPreferences:c,loading:o,workspaceName:u,workspaceInitialized:f,workspaceError:p,expanded:d,fileRootPath:b,filesWithPreview:w=!1,openFileRequest:k,readOnly:C=!1,sideChatTabs:I,sourceSwitcher:T,tabRequest:M,viewState:U,onRefresh:W,onResizeStart:G,onToggleExpanded:x,onOpenBrowser:N,onViewStateChange:_,onCloseSideChat:P,onOpenSideChat:E,onSelectSideChat:J,goalDetails:D,sandboxFileSource:V,trainingSummary:K}){return e.jsx(nr,{appId:t,workspaceKind:s,connection:n,runtimeEvents:i??[],diff:a,editorPreferences:c??null,loading:o,workspaceName:u,workspaceInitialized:f,workspaceError:p,expanded:d,fileRootPath:b??null,filesWithPreview:w,openFileRequest:k,readOnly:C,sideChatTabs:I??[],sourceSwitcher:T??null,tabRequest:M??null,viewState:U??null,onRefresh:W,onResizeStart:G,onToggleExpanded:x,onOpenBrowser:N,onViewStateChange:_,onCloseSideChat:P,onOpenSideChat:E,onSelectSideChat:J,goalDetails:D??null,sandboxFileSource:V??null,trainingSummary:K??null})}function Ji(t,s,n,i){return t&&s?.content!=null?{...t,content:s.content}:s&&!t&&Bt(s)?s:t&&Bt(t)?t:s&&Bt(s)?s:t??s??n??Ut(i)}function Bt(t){return!!(t.patch||t.content!=null)}function er({changedFiles:t,checkpointStatus:s,dirty:n,error:i,loading:a,preservedReadback:c,sandboxMode:o,sourcePending:u}){if(u)return{label:"sandbox pending",tone:"loading"};if(a)return{label:"refreshing",tone:"loading"};if(o&&c&&s)return s;if(i)return{label:"status unavailable",tone:"error"};if(o&&s?.tone==="error"||o&&s&&!n&&t===0)return s;if(n||t>0){const f=Math.max(1,t),p=f===1?"change":"changes";return{label:o?`${f} unpreserved ${p}`:`${f} local ${p}`,tone:"dirty"}}return{label:o?"sandbox clean":"local clean",tone:"clean"}}function tr(t,s){if(!s)return null;for(let n=t.length-1;n>=0;n-=1){const i=t[n];if(i?.name!=="workspace_action_result")continue;const a=i.data&&typeof i.data=="object"&&!Array.isArray(i.data)?i.data:null,c=a?.sourcePreservation&&typeof a.sourcePreservation=="object"&&!Array.isArray(a.sourcePreservation)?a.sourcePreservation:null;if(c?.attempted===!0&&c.sandboxId===s)return c.ok!==!0?{label:"checkpoint failed",tone:"error"}:c.preserved===!0?{label:"checkpoint saved",tone:"clean"}:{label:"checkpoint clean",tone:"clean"}}return null}function sr(t){const s=t.split("/").filter(Boolean);return s.map((n,i)=>s.slice(0,i+1).join("/"))}function nr({appId:t,workspaceKind:s,connection:n,runtimeEvents:i,diff:a,editorPreferences:c,loading:o,workspaceName:u,workspaceInitialized:f,workspaceError:p,expanded:d,fileRootPath:b,filesWithPreview:w,openFileRequest:k,readOnly:C,sideChatTabs:I,sourceSwitcher:T,tabRequest:M,viewState:U,onRefresh:W,onResizeStart:G,onToggleExpanded:x,onOpenBrowser:N,onViewStateChange:_,onCloseSideChat:P,onOpenSideChat:E,onSelectSideChat:J,goalDetails:D,sandboxFileSource:V,trainingSummary:K}){const ae=U??ua(),[A,g]=l.useState(ae.activeTab),[q,ie]=l.useState(!1),[oe,ee]=l.useState(!1),[Se,Q]=l.useState(!1),[gt,qt]=l.useState(""),[Z,Je]=l.useState(()=>[...ae.openFilePaths]),[j,Ne]=l.useState(ae.selectedPath),[Qt,Ys]=l.useState(!1),[Xt,Js]=l.useState(!1),[Ce,en]=l.useState(!1),[jt,tn]=l.useState(!0),[Zt,sn]=l.useState(qi),[Yt,nn]=l.useState(!1),[Jt,an]=l.useState(!1),[es,rn]=l.useState(!1),[te,et]=l.useState({}),[ce,ze]=l.useState({}),[ts,vt]=l.useState(()=>new Set),[Ie,We]=l.useState(null),[ln,wt]=l.useState(!1),[ss,Be]=l.useState(null),[ns,kt]=l.useState({}),[on,yt]=l.useState({}),[cn,St]=l.useState(null),[dn,Re]=l.useState(null),[un,$e]=l.useState(null);ke(p,{prefix:"Workspace"}),ke(ss,{prefix:"Sandbox files"});const[Nt,Ct]=l.useState(null),[fn,Oe]=l.useState({}),[tt,Rt]=l.useState(null),[st,nt]=l.useState(null),[at,it]=l.useState(null),Y=c??da.editor,as=l.useRef(te),$t=l.useRef(zt(ae)),Ft=l.useRef(zt(ae)),is=l.useRef(null),Et=l.useRef(W),re=l.useRef(!1),Ue=l.useRef(null),He=l.useRef(0),de=l.useRef(null),Ve=l.useRef(null),F=V?.sandboxId?.trim()||null,S=!!V,Fe=!!K||S&&!!F,rt=S?`sandbox:${F??"pending"}`:`workspace:${t??"none"}`,rs=S?!!F:!!t,ls=l.useRef(rt),ue=!!(D?.createRuntime||D?.goalRuntime||D?.subagentRuntime),Ee=l.useCallback(async(r={})=>{if(S){if(!n){We(null),Be("OpenPond App server is not connected.");return}if(!F){We(null),Be(null);return}r.silent||wt(!0);try{const[h,m,y]=await Promise.allSettled([z.sandboxFiles(n,F,{recursive:!0,maxEntries:Zi}),z.sandboxGitStatus(n,F),z.sandboxGitDiff(n,F,{})]);if(h.status==="rejected")throw h.reason;const $=Ui(h.value.files),v=m.status==="fulfilled"?m.value.status:null,R=y.status==="fulfilled"?y.value.diff:null,L=Hi(R,v),Qe=L.reduce((_t,Mt)=>_t+Mt.additions,0),Bn=L.reduce((_t,Mt)=>_t+Mt.deletions,0);We({appId:F,repoPath:"",initialized:!0,dirty:v?!v.clean:L.length>0,filesChanged:L.length,additions:Qe,deletions:Bn,repoFiles:$,files:L,error:null,updatedAt:new Date().toISOString()}),Be(null)}catch(h){We(null),Be(h instanceof Error?h.message:String(h))}finally{r.silent||wt(!1)}}},[n,F,S]),os=l.useMemo(()=>Ii(i,F),[i,F]),cs=!!(Ie&&((Ie.files?.length??0)>0||(Ie.repoFiles?.length??0)>0)),pn=S&&!cs&&!!os,fe=S?cs?Ie:os??Ie:a,lt=fe?.repoPath??null,hn=l.useMemo(()=>tr(i,F),[i,F]),Ae=fe?.files??_s,ds=fe?.files??_s,he=l.useMemo(()=>new Map(ds.map(r=>[r.path,r])),[ds]),me=l.useMemo(()=>new Map(Ae.map(r=>[r.path,r])),[Ae]),Le=fe?.repoFiles??(Ae.length>0?Ae.map(r=>r.path):Yi),Pe=l.useMemo(()=>Ae.filter(r=>!la(r,Le)),[Le,Ae]),xe=l.useMemo(()=>at&&!Le.includes(at)?[at,...Le]:Le,[Le,at]),us=l.useMemo(()=>Z.map(r=>he.get(r)??te[r]??me.get(r)??Ut(r)),[he,me,te,Z]),ot=l.useMemo(()=>{const r={};for(const h of Z){if(ge(h))continue;const m=he.get(h)??te[h]??me.get(h)??Ut(h);m.content!=null&&(r[h]=m.content)}return r},[he,me,te,Z]),De=l.useMemo(()=>{const r=new Set;for(const[h,m]of Object.entries(ce))m.content!==m.savedContent&&r.add(h);return r},[ce]),mn=l.useMemo(()=>{const r=gt.trim().toLowerCase(),h=xe;return r?h.filter(m=>m.toLowerCase().includes(r)):h},[xe,gt]),At=l.useMemo(()=>({activeTab:A,openFilePaths:Z,selectedPath:j}),[A,Z,j]);l.useEffect(()=>{as.current=te},[te]),l.useEffect(()=>{Ue.current=tt},[tt]),l.useEffect(()=>{ze(r=>{let h=!1;const m={...r},y=new Set(Z),$=a?.updatedAt?Date.parse(a.updatedAt):null;for(const[v,R]of Object.entries(m))y.has(v)||R.content!==R.savedContent||(delete m[v],h=!0);for(const[v,R]of Object.entries(ot)){const L=m[v];if(!L){m[v]={content:R,savedContent:R},h=!0;continue}if(L.content===L.savedContent&&L.savedContent!==R){if(L.savedAt&&($===null||$<L.savedAt))continue;m[v]={content:R,savedContent:R},h=!0}}return h?m:r})},[a?.updatedAt,ot,Z]),l.useEffect(()=>{Et.current=W},[W]),l.useEffect(()=>{if(!U)return;const r=oa(U,lt);Ss($t.current,r)||($t.current=r,Ft.current=r,g(r.activeTab),Je(r.openFilePaths),Ne(r.selectedPath))},[U,lt]),l.useEffect(()=>{if(Ss(Ft.current,At))return;const r=zt(At);Ft.current=r,$t.current=r,_?.(r)},[At,_]),l.useEffect(()=>{C||S||!n||!t||!f||a||p||re.current||(re.current=!0,Promise.resolve(Et.current({silent:!0})).catch(()=>{}).finally(()=>{re.current=!1}))},[t,n,a,C,S,p,f]),l.useEffect(()=>(ls.current!==rt&&(ls.current=rt,de.current?.abort(new Error("lsp_diagnostics_source_changed")),de.current=null,Je([]),Ne(null),et({}),ze({}),vt(new Set),We(null),Be(null),wt(!1),kt({}),yt({}),St(null),Re(null),$e(null),Ct(null),Oe({}),Rt(null),nt(null),it(null)),()=>{de.current?.abort(new Error("lsp_diagnostics_unmounted")),de.current=null}),[rt]),l.useEffect(()=>{!k||is.current===k.id||rs&&(is.current=k.id,ct(k.path))},[rs,k]),l.useEffect(()=>{if(!S||(Ee(),!n||!F))return;let r=!1;async function h(){if(!(r||re.current)&&!(typeof document<"u"&&document.visibilityState==="hidden")){re.current=!0;try{await Ee({silent:!0})}finally{re.current=!1}}}const m=window.setInterval(()=>{h()},Ts),y=()=>{h()};return window.addEventListener("focus",y),()=>{r=!0,window.clearInterval(m),window.removeEventListener("focus",y)}},[n,Ee,F,S]),l.useEffect(()=>{if(C||S||!n||!t||!f)return;let r=!1;async function h(){if(!(r||re.current)&&!(typeof document<"u"&&document.visibilityState==="hidden")){re.current=!0;try{await Et.current({silent:!0})}catch{}finally{re.current=!1}}}const m=window.setInterval(()=>{h()},Ts),y=()=>{h()};return window.addEventListener("focus",y),()=>{r=!0,window.clearInterval(m),window.removeEventListener("focus",y)}},[t,n,C,S,f]),l.useEffect(()=>{if(S||!n||!t||s==="local_project"){it(null);return}let r=!1;return z.workspaceTemplateConfig(n,t).then(h=>{r||it(h.exists?h.configPath??ca:null)}).catch(()=>{r||it(null)}),()=>{r=!0}},[t,n,S,s]),l.useEffect(()=>{!j||xe.includes(j)||Z.includes(j)||Ne(Pe[0]?.path??null)},[Pe,Z,xe,j]),l.useEffect(()=>{D?.active&&ue&&g("goal")},[D?.active,ue]),l.useEffect(()=>{M&&g(M.tab)},[M]),l.useEffect(()=>{!ue&&A==="goal"&&g("files")},[A,ue]),l.useEffect(()=>{!Fe&&A==="summary"&&g("files")},[A,Fe]);const H=A==="file"||w&&A==="files"?j:null;l.useEffect(()=>{if(!n||!H)return;if(ge(H)){$e(null),Re(v=>v===H?null:v);return}const r=Nt?.path===H,h=Ge(H);if(C&&(h?.content!=null||h?.patch)){$e(null),Re(v=>v===H?null:v);return}if(!r&&(h?.content!=null||h?.patch&&!Ce)){$e(null),Re(v=>v===H?null:v);return}let m=!1;const y=as.current[H];return y?.content==null&&(Ce||!y?.patch)&&Re(H),$e(null),(S?F?_i(n,F,H,i):Promise.reject(new Error(V?.emptyMessage??"No sandbox filesystem is available.")):t?z.workspaceFile(n,t,H):Promise.reject(new Error("Workspace files are unavailable."))).then(v=>{m||et(R=>{const L=R[v.path];return L?.content===v.content&&L.patch===v.patch&&L.status===v.status?R:{...R,[v.path]:v}})}).catch(v=>{m||$e(v instanceof Error?v.message:String(v))}).finally(()=>{m||(Re(v=>v===H?null:v),Ct(v=>v&&v.id===Nt?.id&&v.path===H?null:v))}),()=>{m=!0}},[A,t,n,Nt,Ce,C,i,V?.emptyMessage,F,S,H]);function ct(r){const h=zs(r,lt);h&&(et(m=>{if(!(h in m))return m;const y={...m};return delete y[h],y}),Ct({id:Date.now(),path:h}),w||Je(m=>m.includes(h)?m:[...m,h]),Ne(h),g(w?"files":"file"),!S&&n&&t&&ge(h)&&nt(h),ee(!1),Q(!1),qt(""))}const xn=l.useCallback(()=>{sn(r=>{const h=!r;return Qi(h),h})},[]),Ge=r=>Ji(he.get(r),te[r],me.get(r),r),bn=l.useCallback((r,h)=>{ze(m=>{const y=m[r],$=y?.savedContent??ot[r]??Ge(r).content??"";return{...m,[r]:{content:h,savedContent:$,savedAt:y?.savedAt}}}),Oe(m=>{if(!(r in m))return m;const y={...m};return delete y[r],y})},[he,me,te,ot]),Te=l.useCallback(async(r,h={})=>{if(S||!n||!t||ge(r))return;const m=Ge(r),y=h.content??ce[r]?.content??m.content??void 0;if(y?.endsWith(mt))return;const $=He.current+1;He.current=$,de.current?.abort(new Error("lsp_diagnostics_superseded"));const v=new AbortController;de.current=v,St(r);try{const R=await z.workspaceLspTouch(n,t,{path:r,content:y,waitForDiagnostics:h.waitForDiagnostics??!0},{signal:v.signal});if($!==He.current)return;kt(L=>({...L,[R.path]:R.diagnostics})),yt(L=>({...L,[R.path]:R.servers}))}catch(R){if(v.signal.aborted||$!==He.current)return;const L=R instanceof Error?R.message:String(R);kt(Qe=>({...Qe,[r]:[]})),yt(Qe=>({...Qe,[r]:[{id:"lsp",root:"",status:"error",message:L}]}))}finally{if(de.current===v&&(de.current=null),v.signal.aborted)return;$===He.current&&St(R=>R===r?null:R)}},[t,n,he,me,ce,te,S]),gn=l.useCallback(async r=>{if(S||!n||!t)throw new Error("Workspace LSP is unavailable.");return z.workspaceLspAction(n,t,r)},[t,n,S]),Ke=l.useCallback(async r=>{if(!n||!t&&!F||Ue.current===r)return;const h=ce[r];if(!h||h.content===h.savedContent)return;const m=h.content,y=Date.now();Ue.current=r,Rt(r),Oe($=>{if(!(r in $))return $;const v={...$};return delete v[r],v});try{const $=S?await Oi(n,F,r,m):await z.saveWorkspaceFile(n,t,{path:r,content:m});et(v=>({...v,[$.path]:$})),ze(v=>{const R=v[r];return R?{...v,[r]:{content:R.content,savedContent:m,savedAt:y}}:v}),Y.languageServers!=="off"&&Y.checkOnSave&&await Te(r,{content:m,waitForDiagnostics:!0}),S?await Ee({silent:!0}):await W({silent:!0})}catch($){Oe(v=>({...v,[r]:$ instanceof Error?$.message:String($)}))}finally{Ue.current===r&&(Ue.current=null),Rt($=>$===r?null:$)}},[Y.checkOnSave,Y.languageServers,t,n,ce,W,Te,Ee,F,S]),fs=j?Ge(j):null,be=j?ce[j]?.content??fs?.content??null:null,jn=!!(fs?.patch&&!Ce),Lt=!!(!C&&A==="file"&&!jn&&j&&be!=null&&!ge(j)&&!(jt&&Ot(j))&&!be.endsWith(mt));l.useEffect(()=>{if(Y.languageServers==="off"||!Y.diagnosticsWhileEditing||!j||!Lt||be==null)return;const r=window.setTimeout(()=>{Te(j,{content:be,waitForDiagnostics:!0})},700);return()=>window.clearTimeout(r)},[Y.diagnosticsWhileEditing,Y.languageServers,Te,be,Lt,j]),l.useEffect(()=>{function r(h){!(h.ctrlKey||h.metaKey)||h.key.toLowerCase()!=="s"||A!=="file"||!j||(h.preventDefault(),De.has(j)&&Ke(j))}return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[A,De,Ke,j]);const vn=l.useCallback(()=>{j&&(Ve.current?Ve.current.save():Ke(j))},[Ke,j]),wn=l.useCallback(()=>{Ve.current?.undo()},[]),kn=l.useCallback(()=>{Ve.current?.redo()},[]),yn=l.useCallback(()=>{j&&Y.languageServers!=="off"&&Te(j,{content:be??void 0,waitForDiagnostics:!0})},[Y.languageServers,Te,be,j]);function Sn(r,h){if(h.stopPropagation(),!(De.has(r)&&!window.confirm(`Discard unsaved changes to ${r}?`))&&(De.has(r)&&(ze(m=>{if(!(r in m))return m;const y={...m};return delete y[r],y}),Oe(m=>{if(!(r in m))return m;const y={...m};return delete y[r],y})),Je(m=>m.filter(y=>y!==r)),j===r)){const m=us.find(y=>y.path!==r)??null;Ne(m?.path??Pe[0]?.path??null),m||g("files")}}function Nn(){g("files"),ee(!1),Q(!1)}function ps(r){vt(h=>{const m=new Set(h);return m.has(r)?m.delete(r):m.add(r),m})}function Cn(r){r&&vt(h=>{const m=new Set(h);for(const y of sr(r))m.add(y);return m}),g("files"),ee(!1),Q(!1)}function Rn(){const h=`git apply <<'PATCH'
|
|
12
|
-
${Pe.map(m=>m.patch).filter(Boolean).join(`
|
|
13
|
-
`)}
|
|
14
|
-
PATCH`;navigator.clipboard?.writeText(h)}const $n=Pe.length>0,Fn=xe.length>0,En=Z.length>0,An=ue||Fe||$n||Fn||En,pe=A==="goal"&&ue?"goal":A==="summary"&&Fe?"summary":A==="file"&&j?"file":"files",Ln=pe==="files"?"No files to show":"No local changes",Pn=s==="local_project"&&!f&&!p,hs=S?ln:o,ms=S?ss:p,Dn=er({changedFiles:fe?.filesChanged??Pe.length,checkpointStatus:hn,dirty:!!fe?.dirty,error:ms,loading:hs,preservedReadback:pn,sandboxMode:S,sourcePending:S&&!F}),Tn=hs?"Loading workspace files":ms?"Workspace files are unavailable":S&&!F?V?.emptyMessage??"No sandbox filesystem is available.":Pn?"Loading workspace files":f?Ln:"No local files to show",_n=!S&&j&&ge(j)?j:null,Mn=!S&&st&&ge(st)?st:null,Pt=Ns(n,t,_n),xs=Ns(n,t,Mn),bs=pe==="file"||w&&pe==="files"?j:null,zn=!!(bs&&Ot(bs)),gs=j?ns[j]??[]:[],js=j?on[j]??null:null,Dt=!!(j&&cn===j),Tt=Zt&&Lt,qe=!C&&!S&&Y.languageServers!=="off",In=l.useMemo(()=>Xi({activeDiagnostics:gs,activeServers:js,editorDiagnosticsChecking:Dt,editorLspEnabled:qe,showEditorCommandBar:Tt}),[gs,js,Dt,qe,Tt]),Wn=l.useCallback(async r=>{if(!n)throw new Error("OpenPond server connection is unavailable.");await z.runSubagentLifecycleAction(n,r.runId,{action:r.action,reason:"User requested from Goal details."}),await W({silent:!0})},[n,W]),vs=j?e.jsx(Ci,{diagnostics:qe?ns[j]??[]:[],draftContent:ce[j]?.content,editorRef:Ve,editable:!C&&!Pt,error:un,file:Ge(j),collapsed:Xt,hideWhiteSpace:Jt,imageSrc:Pt,loading:dn===j,loadFullFiles:Ce,saveError:fn[j]??null,saving:tt===j,onOpenImage:()=>{Pt&&nt(j)},onDraftContentChange:r=>bn(j,r),onLspAction:qe?gn:void 0,onSave:()=>{Ke(j)},onSelectBreadcrumbPath:Cn,renderMarkdown:jt,splitView:es,wordDiffs:Yt,wordWrap:Qt,workspaceName:u,workspaceRootPath:lt}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:`workspace-diff-panel ${d?"expanded":""}`,id:"right-sidebar-files-panel",role:"tabpanel","aria-label":"Workspace diffs",children:[!d&&e.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize diff panel",onPointerDown:G}),e.jsx(mi,{addMenuOpen:oe,expanded:d,filteredFiles:mn,openFiles:us,dirtyFilePaths:De,goalDetailsAvailable:ue,searchOpen:Se,searchQuery:gt,selectedPath:j,sideChatTabs:I,summaryAvailable:Fe,sourceStatus:Dn,sourceSwitcher:T,visibleTab:pe,onCloseFileTab:Sn,onCloseSideChat:P,onCloseSearch:()=>Q(!1),onOpenFile:ct,onOpenBrowser:()=>{ee(!1),Q(!1),N()},onOpenSearch:()=>{ee(!1),Q(!0)},onOpenSideChat:E?()=>{ee(!1),Q(!1),E()}:void 0,onSearchQueryChange:qt,onSelectFile:r=>{Ne(r),g("file")},onSelectFiles:Nn,onSelectGoal:()=>g("goal"),onSelectSummary:()=>{g("summary"),ee(!1),Q(!1)},onSelectSideChat:J,onToggleAddMenu:()=>{ee(r=>!r),Q(!1)},onToggleExpanded:x}),pe==="goal"&&ue?e.jsx(Ma,{createRuntime:D?.createRuntime??null,goalRuntime:D?.goalRuntime??null,subagentRuntime:D?.subagentRuntime??null,onRunSubagentLifecycleAction:n?Wn:void 0}):pe==="summary"&&Fe?K?e.jsx(ui,{summary:K}):e.jsx(ni,{sandboxId:F,connection:n}):An?e.jsxs(e.Fragment,{children:[e.jsx(xi,{canSaveActiveFile:!!(!C&&j&&De.has(j)&&tt!==j),canCheckActiveFile:qe,collapsed:Xt,editorControlsVisible:Zt,editorDiagnosticStatus:In,editorDiagnosticsChecking:Dt,hideWhiteSpace:Jt,loadFullFiles:Ce,menuOpen:q,renderMarkdown:jt,showEditorCommandBar:Tt,showRenderMarkdownToggle:zn,splitView:es,wordDiffs:Yt,wordWrap:Qt,onCopyGitApply:Rn,onEditorCheck:yn,onEditorRedo:kn,onEditorSave:vn,onEditorUndo:wn,onRefresh:()=>{S?Ee():W()},onToggleCollapsed:()=>Js(r=>!r),onToggleEditorControlsVisible:xn,onToggleHideWhiteSpace:()=>an(r=>!r),onToggleLoadFullFiles:()=>en(r=>!r),onToggleMenu:r=>ie(h=>r??!h),onToggleRenderMarkdown:()=>tn(r=>!r),onToggleSplitView:()=>rn(r=>!r),onToggleWordDiffs:()=>nn(r=>!r),onToggleWordWrap:()=>Ys(r=>!r)}),pe==="files"&&(w?e.jsxs("div",{className:"workspace-diff-files-preview-layout",children:[e.jsx(As,{diff:fe,expandedFolderPaths:ts,rootPath:b,repoFiles:xe,selectedPath:j,onOpenFile:ct,onToggleFolder:ps}),vs??e.jsx("div",{className:"workspace-diff-files-preview-empty",children:"Select a file to review its changes."})]}):e.jsx(As,{diff:fe,expandedFolderPaths:ts,rootPath:b,repoFiles:xe,selectedPath:j,onOpenFile:ct,onToggleFolder:ps})),pe==="file"&&j&&vs]}):e.jsx("div",{className:"workspace-diff-empty",children:e.jsx("span",{children:Tn})})]}),e.jsx(pa,{open:!!xs,src:xs,title:st??"",onClose:()=>nt(null)})]})}export{fr as WorkspaceDiffPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e}from"./index-B5AN29EO.js";const c=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],y=e("circle-alert",c);export{y as C};
|