openpond 0.2.52 → 0.2.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-server.d.ts +2 -1
- package/dist/app-server.js +1 -1
- package/dist/chunks/{app-layer-RRFI27N4.js → app-layer-I7MZYVLL.js} +1 -1
- package/dist/chunks/{app-server-runtime-NITNSHYS.js → app-server-runtime-7AXV6JZI.js} +1 -1
- package/dist/chunks/{apps-NELJL377.js → apps-TM74FFQB.js} +1 -1
- package/dist/chunks/{chunk-XC7AHL57.js → chunk-37DXASQL.js} +115 -115
- package/dist/chunks/chunk-4EEH7MEC.js +2 -0
- package/dist/chunks/{chunk-7YR6CBNU.js → chunk-4SHKI3BH.js} +1 -1
- package/dist/chunks/{chunk-7MXZJQS7.js → chunk-4TZHH5FC.js} +1 -1
- package/dist/chunks/{chunk-T5T7NCHJ.js → chunk-5TNDPNS3.js} +1 -1
- package/dist/chunks/{chunk-AV3WI7JZ.js → chunk-6JAN4RMN.js} +1 -1
- package/dist/chunks/{chunk-OE2VF6KU.js → chunk-6VF3Q6QJ.js} +1 -1
- package/dist/chunks/{chunk-PVSUQGWK.js → chunk-7ZG3IT7C.js} +1 -1
- package/dist/chunks/{chunk-Q4H3NUVW.js → chunk-AH22RHPS.js} +2 -2
- package/dist/chunks/{chunk-DLZP22WV.js → chunk-FPUUZQUP.js} +1 -1
- package/dist/chunks/{chunk-ZBZBV5TB.js → chunk-GCOUYYHG.js} +1 -1
- package/dist/chunks/{chunk-MASJQWA2.js → chunk-GXSTZBM6.js} +1 -1
- package/dist/chunks/{chunk-IOQUF34U.js → chunk-H2VT22JK.js} +1 -1
- package/dist/chunks/{chunk-L3V4QKRV.js → chunk-NHFGEVVH.js} +1 -1
- package/dist/chunks/{chunk-HJEY5LBD.js → chunk-PQHTZ5CP.js} +1 -1
- package/dist/chunks/{chunk-CFLMKFOE.js → chunk-UE3DMPGM.js} +2 -2
- package/dist/chunks/{chunk-QJRXTIOC.js → chunk-USKE34VR.js} +1 -1
- package/dist/chunks/{chunk-FQZFLNLY.js → chunk-YD55Z5H3.js} +1 -1
- package/dist/chunks/{chunk-RLZPX4YP.js → chunk-YJ4PNAST.js} +1 -1
- package/dist/chunks/{cli-ZYFSCHZK.js → cli-JVB345H2.js} +1 -1
- package/dist/chunks/{configuration-command-SA56RV5B.js → configuration-command-MATM4XR5.js} +1 -1
- package/dist/chunks/{connected-evidence-IVSQZYIB.js → connected-evidence-YDPGNHLP.js} +1 -1
- package/dist/chunks/{core-commands-W5IGIITV.js → core-commands-MTV4EKXY.js} +1 -1
- package/dist/chunks/{datasets-KSO2UG6R.js → datasets-CP3IT47T.js} +1 -1
- package/dist/chunks/{desktop-test-6HXFM7PO.js → desktop-test-IAZC5MAH.js} +1 -1
- package/dist/chunks/{dist-5VFPYEIV.js → dist-SAABJU5F.js} +1 -1
- package/dist/chunks/{evaluation-coordination-MOFBXRXN.js → evaluation-coordination-EPHLZXYM.js} +1 -1
- package/dist/chunks/{experiment-improvements-TDHM6NEA.js → experiment-improvements-6JTOPA74.js} +1 -1
- package/dist/chunks/{experiments-HFPDFD4I.js → experiments-XHPFGECH.js} +1 -1
- package/dist/chunks/{extension-R373LYIB.js → extension-GX7DLW2X.js} +1 -1
- package/dist/chunks/{help-PEFQDDTA.js → help-WLKSACLZ.js} +1 -1
- package/dist/chunks/{hosted-experiment-improvement-MGBPXXW2.js → hosted-experiment-improvement-HAB3UE6A.js} +1 -1
- package/dist/chunks/{hosted-harness-runtime-WOLADXXP.js → hosted-harness-runtime-YM23QNDK.js} +1 -1
- package/dist/chunks/{hosted-profile-candidate-LVNKOTKJ.js → hosted-profile-candidate-EOBGKQAS.js} +1 -1
- package/dist/chunks/{hosted-profile-compiler-NBMUCZVS.js → hosted-profile-compiler-SCVJI2CP.js} +1 -1
- package/dist/chunks/{hosted-profile-evaluation-control-7B3RAZU2.js → hosted-profile-evaluation-control-RJ6XJZCS.js} +1 -1
- package/dist/chunks/{hosted-profile-evaluation-inspection-FPCV42DD.js → hosted-profile-evaluation-inspection-OC4XNGL2.js} +1 -1
- package/dist/chunks/{hosted-profile-evaluation-preparation-I6H6RFT6.js → hosted-profile-evaluation-preparation-ZD4FM3FD.js} +1 -1
- package/dist/chunks/{human-review-HRGGACEM.js → human-review-AAVMISBF.js} +1 -1
- package/dist/chunks/{import-RSAQ44GG.js → import-V3HUGRHR.js} +1 -1
- package/dist/chunks/{opchat-I7ZWJ5XK.js → opchat-QK43DXTY.js} +1 -1
- package/dist/chunks/{organizations-LFCZIH7E.js → organizations-SRPAWKC7.js} +1 -1
- package/dist/chunks/{profile-EPIX5QVK.js → profile-C6CQNVYE.js} +1 -1
- package/dist/chunks/{project-agent-DGOPMECP.js → project-agent-GZV5HNYI.js} +1 -1
- package/dist/chunks/{sandbox-command-Q5F6VUOS.js → sandbox-command-4TJXQTKT.js} +1 -1
- package/dist/chunks/{sandbox-template-7GICPIKJ.js → sandbox-template-BBGGPJMI.js} +1 -1
- package/dist/chunks/{src-DH5AQ4Z7.js → src-CR6UZYTX.js} +1 -1
- package/dist/chunks/{src-MGP3OYHL.js → src-NE6R4XC6.js} +109 -109
- package/dist/chunks/{teams-bot-Z6RJGHME.js → teams-bot-7I4BAUVO.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/web/assets/App-CO2F717V.css +1 -0
- package/dist/web/assets/{App-Dg6mZIQk.js → App-CuhaCsfb.js} +65 -64
- package/dist/web/assets/{AppDialog-gcj3rrTZ.js → AppDialog-BdusXgU0.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-Be-E4qZF.js → AppTerminalPanel-C4uRpnBz.js} +2 -2
- package/dist/web/assets/{AppsView-BdyPNSpT.js → AppsView-BS1czXUP.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-CcQxU0uO.js → BrowserSidebar-Bl7V6YO2.js} +1 -1
- package/dist/web/assets/{CartesianChart-CN5hB6rV.js → CartesianChart-BstFbsdn.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-BiDPHgXG.js → CollaborationTabs-B8YAf0c1.js} +1 -1
- package/dist/web/assets/{CommandMenu-B2qJCgWH.js → CommandMenu-DZct7zUJ.js} +1 -1
- package/dist/web/assets/{CommunityView-D1aOQKfS.js → CommunityView-CR0-W-uG.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-f1tdD0QS.js → ComposerCreateImproveStrip-DR-Qo7b4.js} +1 -1
- package/dist/web/assets/{GetStartedView-CPYs0fYN.js → GetStartedView-xqQoMMei.js} +1 -1
- package/dist/web/assets/HostedModelLearningReview-CHxxf_Lu.js +1 -0
- package/dist/web/assets/{HostedModelLearningSettings-IEKRXOkG.js → HostedModelLearningSettings-De3i9wF4.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-DkIa0oG_.js → LabModelVersionDetailPage-DAY1MmqP.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-BUlU1Ti-.js → LabSkillSidebar-DLnIgnry.js} +1 -1
- package/dist/web/assets/{LabsRoute-8cKFNq19.js → LabsRoute-CXJRJMhr.js} +4 -4
- package/dist/web/assets/{MainChatThread-C5GwaIl_.js → MainChatThread-BwAla81W.js} +2 -2
- package/dist/web/assets/{MainPane-SMqq5YAM.js → MainPane-CakOBCHw.js} +4 -4
- package/dist/web/assets/{MarkdownText-CLnvdLVg.js → MarkdownText-gJMuefaJ.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-B9bVb00x.js → NativeSkillSidebar-Dlxb8iOC.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-CelgG7Ua.js → NewExperienceSwitcher-DM-cqJ-K.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-eEnsg9s2.js → NewProjectDialog-Cu1q75gq.js} +1 -1
- package/dist/web/assets/{OutputsPage-ByvsTUW-.js → OutputsPage-DiXMkasl.js} +1 -1
- package/dist/web/assets/{ProjectsPage-Cl2zFh8X.js → ProjectsPage-DqiBHiCB.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-MnGscF87.js → RightChatPanelStack-VaOOmxwd.js} +1 -1
- package/dist/web/assets/{RightSidebarHomePanel-C6NXMYuy.js → RightSidebarHomePanel-CeSFJM5s.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-DCb6d7Lg.js → ScheduledWorkPage-D1jRQxFs.js} +1 -1
- package/dist/web/assets/{SettingsView-BMFfrxmo.js → SettingsView-RA9OXgcu.js} +3 -3
- package/dist/web/assets/{TeamChatView-DW_v2B9E.js → TeamChatView-DM0adMtj.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-BJ7qsr9F.js → TerminalOverlay-CFlH51DD.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-GSIwP6f1.js → TrainingCreationPanel-CgIBVGha.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-DorY6I29.js → TrainingDraftPanel-Bbo3RRie.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-DmzStI9q.js → UsageSettingsSection-CSRjJUSa.js} +1 -1
- package/dist/web/assets/{WorkSidebarPanel-zsJrGaaL.js → WorkSidebarPanel-DwlEMEoG.js} +1 -1
- package/dist/web/assets/WorkspaceDiffPanel-pGVezNMw.js +14 -0
- package/dist/web/assets/{WorkspaceEnvironmentMenu-vJw9hE0y.js → WorkspaceEnvironmentMenu-Byjngd9V.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-BpL-xtRX.js → WorkspaceGitDialogs-Dgmg-6XG.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-CJ3x0GHH.js → WorkspaceMonacoEditor-BR4qxMgU.js} +3 -3
- package/dist/web/assets/{arrow-up-right-C60QSULo.js → arrow-up-right-H0pvnH2s.js} +1 -1
- package/dist/web/assets/{chunk-UHVJOMWN-BxgPi0yP.js → chunk-UHVJOMWN-BqXRe639.js} +1 -1
- package/dist/web/assets/{clipboard-QIy0Jd_K.js → clipboard-BZzZ82Bk.js} +1 -1
- package/dist/web/assets/{cloud-upload-B9L-_gy0.js → cloud-upload-CJPYPVl8.js} +1 -1
- package/dist/web/assets/{cssMode-ffPyPUW9.js → cssMode-WC4Rg1l-.js} +1 -1
- package/dist/web/assets/{folder-open-BFy7KXWm.js → folder-open-sLZJxLQy.js} +1 -1
- package/dist/web/assets/{folder-plus-C3iGtUOI.js → folder-plus-C84wrpt_.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-DsTniKvi.js → git-commit-horizontal-Cotm7KEC.js} +1 -1
- package/dist/web/assets/{htmlMode-7ytlsiyK.js → htmlMode-C6oZGeaB.js} +1 -1
- package/dist/web/assets/{index-BK8GmZmB.js → index-BxWTVKtn.js} +2 -2
- package/dist/web/assets/index-dSmk3FLJ.css +1 -0
- package/dist/web/assets/{info-C8mwoaIJ.js → info-Dc81lEfw.js} +1 -1
- package/dist/web/assets/{jsonMode-BT35NJi4.js → jsonMode-BET4LQIn.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-BKAwIewO.js → lspLanguageFeatures-BPxA_-Kg.js} +1 -1
- package/dist/web/assets/{minimize-2-34MApatV.js → minimize-2-Bs7MVN3C.js} +1 -1
- package/dist/web/assets/{monaco.contribution-CxtX0z-m.js → monaco.contribution-7AUuf2NS.js} +2 -2
- package/dist/web/assets/{monaco.contribution-9diduNNi.js → monaco.contribution-BH6kkO4b.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DVnPUDsR.js → monaco.contribution-DFzEyaHi.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Dj4R5U8Z.js → monaco.contribution-DXzyQfVi.js} +2 -2
- package/dist/web/assets/{monitor-4JxqJ7wz.js → monitor-DXL019Wf.js} +1 -1
- package/dist/web/assets/{play-C4PtpamL.js → play-CXkxUZeU.js} +1 -1
- package/dist/web/assets/{python-0GVncePC.js → python-PzBkTjWx.js} +1 -1
- package/dist/web/assets/{save-DjB16eou.js → save-DpezrtH2.js} +1 -1
- package/dist/web/assets/{square-Coz7UQqd.js → square-oy7f5Ce6.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-D-3108_3.js → toggleHighContrast-Cto-fOXm.js} +1 -1
- package/dist/web/assets/{tsMode-CV4ktqqR.js → tsMode-BYA4LNc6.js} +1 -1
- package/dist/web/assets/{upload-D007T9Hm.js → upload-C5YFNgtS.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-BXjFbAVS.js → useLocalAgentSchedules-CnyTsqlf.js} +1 -1
- package/dist/web/assets/useProviderSettings-B_KeQjE5.js +5 -0
- package/dist/web/assets/{useSessionTurnCache-Bee6zbC_.js → useSessionTurnCache-DICuJSJW.js} +1 -1
- package/dist/web/assets/{wifi-off-BbNZc0za.js → wifi-off-nzHj7JXp.js} +1 -1
- package/dist/web/assets/{workers-DNQ5ne3z.js → workers-Dboaw6f_.js} +1 -1
- package/dist/web/assets/{yaml-BfAho-gB.js → yaml-uuY5JmO8.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunks/chunk-EPY7M5XS.js +0 -2
- package/dist/web/assets/App-DkH8CeoI.css +0 -1
- package/dist/web/assets/HostedModelLearningReview-DVfJyUW_.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-CiFsZjMm.js +0 -14
- package/dist/web/assets/index-C0H85uUI.css +0 -1
- package/dist/web/assets/useProviderSettings-SY7mp-5B.js +0 -5
- /package/dist/chunks/{chunk-XDMUD4FW.js → chunk-2JO2KWT3.js} +0 -0
- /package/dist/chunks/{chunk-XBCIBAXD.js → chunk-GS2NKNKG.js} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as t,r as o}from"./index-
|
|
1
|
+
import{j as t,r as o}from"./index-BxWTVKtn.js";/* empty css */import{fB as G,X as R,aq as le,fC as re,fD as X,an as Y,at as de,aW as N,B as T,G as ce,a$ as me,b1 as ue,fE as ge,fF as he,fG as fe,b8 as xe,fH as ve,fI as Ce}from"./App-CuhaCsfb.js";import{R as L,m as U}from"./MainPane-CakOBCHw.js";import{T as ye,M as E}from"./MarkdownText-gJMuefaJ.js";import"./cloud-upload-CJPYPVl8.js";import"./arrow-up-right-H0pvnH2s.js";import"./square-oy7f5Ce6.js";import"./folder-open-sLZJxLQy.js";import"./play-CXkxUZeU.js";function be(e,l){const s=new Set(Array.from(e.matchAll(/(?:^|\s)@([a-zA-Z0-9_-]+)/g),n=>(n[1]??"").toLowerCase()));return l.filter(n=>{const d=n.handle?.toLowerCase(),r=n.name.toLowerCase().replace(/[^a-z0-9_-]+/g,"-");return d&&s.has(d)||s.has(r)}).map(n=>n.userId)}function je(e){return t.jsxs("div",{className:"team-chat-composer-reply",role:"status",children:[t.jsx(L,{size:15,"aria-hidden":"true"}),t.jsxs("button",{type:"button",className:"team-chat-composer-reply-target","aria-label":`Jump to message from ${e.authorLabel}`,onClick:e.onJump,children:[t.jsxs("strong",{children:["Replying to ",e.authorLabel]}),t.jsx("span",{children:G(e.target)})]}),t.jsx("button",{type:"button",className:"team-chat-icon-button","aria-label":"Cancel reply","data-tooltip":"Cancel reply",onClick:e.onCancel,children:t.jsx(R,{size:14})})]})}function we(e){return t.jsxs("button",{type:"button",className:"team-chat-message-reply-quote","aria-label":`Jump to replied message from ${e.authorLabel}`,onClick:e.onJump,children:[t.jsx("strong",{children:e.authorLabel}),t.jsx("span",{children:G(e.target)})]})}function Te(e){const l=o.useRef(null);if(o.useEffect(()=>{if(!e.menu)return;l.current?.focus();const n=()=>e.onClose(),d=r=>{r.key==="Escape"&&n()};return window.addEventListener("click",n),window.addEventListener("blur",n),window.addEventListener("keydown",d),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("click",n),window.removeEventListener("blur",n),window.removeEventListener("keydown",d),window.removeEventListener("scroll",n,!0)}},[e.menu,e.onClose]),!e.menu||typeof document>"u")return null;const s=t.jsx("div",{className:"team-chat-message-context-menu",role:"menu","aria-label":"Message actions",style:{left:e.menu.x,top:e.menu.y},onClick:n=>n.stopPropagation(),children:t.jsxs("button",{ref:l,type:"button",role:"menuitem",onClick:()=>{e.onReply(e.menu.message),e.onClose()},children:[t.jsx(L,{size:14}),"Reply"]})});return le.createPortal(s,document.body)}function Me(e){const d=e.clientX||e.fallbackX,r=e.clientY||e.fallbackY;return{x:Math.max(8,Math.min(d,e.viewportWidth-150-8)),y:Math.max(8,Math.min(r,e.viewportHeight-42-8))}}function V(e){return`team-chat-message-${encodeURIComponent(e)}`}function Re(e){const[l,s]=o.useState(!1),[n,d]=o.useState(e.message.body),r=e.message.refs.find(a=>a.refType==="hosted_ai_thread"),m=e.message.refs.find(a=>a.refType==="agent_run"),C=typeof r?.preview.status=="string"?r.preview.status:null,h=typeof e.message.metadata.deliveryStatus=="string"?e.message.metadata.deliveryStatus:null,b=typeof e.message.metadata.uploadProgress=="string"?e.message.metadata.uploadProgress:null,c=!e.message.deletedAt&&!h,g=re(e.message,e.messagesById),y=g?X(g,e.membersById):null;return t.jsxs("article",{id:V(e.message.id),className:`team-chat-message${e.own?" own":""}`,tabIndex:-1,onContextMenu:a=>{if(!c)return;a.preventDefault();const x=a.currentTarget.getBoundingClientRect();e.onOpenReplyMenu(e.message,{clientX:a.clientX,clientY:a.clientY,fallbackX:x.right-12,fallbackY:x.top+24})},children:[t.jsx(Ie,{member:e.author}),t.jsxs("div",{className:"team-chat-message-content",children:[t.jsxs("header",{children:[t.jsx("strong",{children:e.author?.name??"Team member"}),t.jsx("time",{children:Se(e.message.createdAt)}),e.message.editedAt?t.jsx("span",{children:"edited"}):null,h==="sending"?t.jsx("span",{children:"sending"}):null,h==="sending"&&b?t.jsxs("span",{children:["uploaded ",b]}):null,h==="failed"?t.jsx("span",{className:"failed",children:"not sent"}):null,h==="failed"?t.jsxs("div",{className:"team-chat-message-actions visible",children:[t.jsx("button",{type:"button","data-tooltip":"Retry message","aria-label":"Retry message",onClick:()=>{e.onRetry(e.message)},children:t.jsx(Y,{size:13})}),t.jsx("button",{type:"button","data-tooltip":"Remove failed message","aria-label":"Remove failed message",onClick:()=>e.onDismissFailed(e.message),children:t.jsx(R,{size:13})})]}):c||e.own&&!e.message.deletedAt?t.jsxs("div",{className:"team-chat-message-actions",children:[c?t.jsx("button",{type:"button","data-tooltip":"Reply","aria-label":"Reply to message",onClick:()=>e.onReply(e.message),children:t.jsx(L,{size:13})}):null,e.own&&!r?t.jsx("button",{type:"button","data-tooltip":"Edit message","aria-label":"Edit message",onClick:()=>s(!0),children:t.jsx(de,{size:13})}):null,e.own?t.jsx("button",{type:"button","data-tooltip":"Delete message","aria-label":"Delete message",onClick:()=>{e.onDelete(e.message)},children:t.jsx(ye,{size:13})}):null]}):null]}),g&&y?t.jsx(we,{authorLabel:y,target:g,onJump:()=>e.onJumpToMessage(g.id)}):null,l?t.jsxs("form",{className:"team-chat-message-edit",onSubmit:a=>{a.preventDefault(),e.onEdit(e.message,n).then(x=>{x&&s(!1)})},children:[t.jsx("textarea",{autoFocus:!0,value:n,onChange:a=>d(a.currentTarget.value),onKeyDown:a=>{a.key==="Escape"&&(a.preventDefault(),s(!1),d(e.message.body))}}),t.jsxs("div",{children:[t.jsx("button",{type:"button",onClick:()=>s(!1),children:"Cancel"}),t.jsx("button",{type:"submit",disabled:!n.trim(),children:"Save"})]})]}):t.jsx("div",{className:e.message.deletedAt?"deleted":"",children:e.message.deletedAt?"Message deleted":e.message.body}),!e.message.deletedAt&&e.message.attachments.length>0?t.jsx(Ae,{message:e.message,connection:e.connection}):null,r?t.jsxs("button",{type:"button",className:"team-chat-thread-link",onClick:()=>{e.onOpenAiThread(r.refId)},children:[t.jsx(N,{size:14}),t.jsx("span",{children:"Thread"}),C&&C!=="completed"?t.jsx("small",{children:K(C)}):null,t.jsx("span",{"aria-hidden":"true",children:"›"})]}):null,m?t.jsxs("button",{type:"button",className:"team-chat-thread-link",onClick:()=>{e.onOpenAgentConversation(m.refId)},children:[t.jsx(T,{size:14}),t.jsx("span",{children:"Agent run"}),t.jsx("small",{children:K(String(m.preview.status??"queued"))}),t.jsx("span",{"aria-hidden":"true",children:"›"})]}):null]})]})}function Ae(e){const l=new Map(Array.isArray(e.message.metadata.localAttachmentPreviews)?e.message.metadata.localAttachmentPreviews.flatMap(s=>{if(!s||typeof s!="object")return[];const n=s;return typeof n.id=="string"&&typeof n.url=="string"?[[n.id,n.url]]:[]}):[]);return t.jsx("div",{className:"team-chat-message-images",children:e.message.attachments.map(s=>t.jsx(Pe,{attachmentId:s.id,alt:s.name,teamId:e.message.teamId,connection:e.connection,localUrl:l.get(s.clientAttachmentId)??null},s.id))})}function Pe(e){const[l,s]=o.useState(e.localUrl),[n,d]=o.useState(!1),r=o.useRef(0);async function m(){if(!e.connection||e.localUrl){e.localUrl||d(!0);return}d(!1);try{const C=await ce.teamChatAttachmentDownload(e.connection,e.teamId,e.attachmentId);s(C.url)}catch{s(null),d(!0)}}return o.useEffect(()=>{s(e.localUrl),d(!1),r.current=0,e.localUrl||m()},[e.attachmentId,e.connection,e.localUrl,e.teamId]),l?t.jsx("a",{href:l,target:"_blank",rel:"noreferrer","aria-label":`Open ${e.alt}`,children:t.jsx("img",{src:l,alt:e.alt,loading:"lazy",onError:()=>{if(!e.localUrl&&r.current<1){r.current+=1,m();return}s(null),d(!0)}})}):n?t.jsx("button",{type:"button",className:"team-chat-message-image-retry","aria-label":`Retry ${e.alt}`,"data-tooltip":"Retry image",onClick:()=>{r.current=0,e.localUrl?(d(!1),s(e.localUrl)):m()},children:t.jsx(Y,{size:18})}):t.jsx("div",{className:"team-chat-message-image-loading",role:"status","aria-label":`Loading ${e.alt}`})}function K(e){return e==="pending"?"Starting":e==="running"?"Responding":e==="failed"?"Failed":e==="interrupted"?"Interrupted":e==="cancelled"?"Cancelled":e}function Ie({member:e}){if(e?.image)return t.jsx("img",{className:"team-chat-avatar",src:e.image,alt:""});const l=(e?.name??"T").split(/\s+/).slice(0,2).map(s=>s[0]?.toUpperCase()??"").join("");return t.jsx("span",{className:"team-chat-avatar fallback",children:l})}function Se(e){const l=new Date(e);return Number.isFinite(l.getTime())?l.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):""}const D={value:"none",label:"No project",detail:"Team conversation",options:[],busy:!1},z={value:"local",label:"Local",detail:"Local execution",options:[],action:{value:"local",label:"Local",detail:"Local execution",disabled:!1},busy:!1},Q=new Set(["codex","openai","xai","openrouter","deepseek","zai","moonshot","together","groq","custom-openai-compatible"]);function ke(e,l){return!l||e===l?e:e?`${l}
|
|
2
2
|
|
|
3
3
|
${e}`:l}function _e(){return t.jsx("section",{className:"team-chat-view team-chat-pro-view","aria-label":"Team Chat",children:t.jsxs("div",{className:"team-chat-pro-content",children:[t.jsx("span",{className:"team-chat-pro-icon","aria-hidden":"true",children:t.jsx(N,{size:22})}),t.jsx("h1",{children:"Team Chat"}),t.jsx("p",{children:"Team Chat is available with Pro mode."}),t.jsx("small",{children:"Create or join a Pro team to chat with teammates, coordinate work, and share agents."})]})})}function Fe(e){me(e.error);const[l,s]=o.useState(""),[n,d]=o.useState(!1),[r,m]=o.useState(null),[C,h]=o.useState(null),[b,c]=o.useState(0),g=o.useRef(null),y=o.useRef(!0),a=o.useRef(e.detail?.thread.id??null);a.current=e.detail?.thread.id??null;const{confirmAction:x,confirmDialog:O,resolveConfirmDialog:A}=ue(),P=o.useMemo(()=>new Map(e.members.map(i=>[i.userId,i])),[e.members]),q=o.useMemo(()=>new Map((e.detail?.messages??[]).map(i=>[i.id,i])),[e.detail?.messages]),Z=e.detail?.thread.id??null,B=r?.threadId===Z?q.get(r.message.id)??r.message:null,M=B?.deletedAt?null:B,j=M?ge(M):null,$=j?X(j,P):null,p=e.detail?he(e.detail.thread,e.currentUserId):"Team",I=Q.has(e.provider)?e.provider:"codex",_=I===e.provider?e.model:"gpt-5.6-sol",ee=o.useMemo(()=>fe({hostedActions:e.agents,profile:e.profile,teamId:e.teamId}),[e.agents,e.profile,e.teamId]),te=e.detail?.messages.at(-1)?.sequence??0;o.useEffect(()=>{if(!y.current)return;const i=g.current;i&&(i.scrollTop=i.scrollHeight)},[te,e.detail?.thread.id]);const F=o.useCallback(i=>{i.deletedAt||i.id.startsWith("pending:")||typeof i.metadata.deliveryStatus=="string"||(m({threadId:i.threadId,message:i}),d(!1),h(null),c(f=>f+1))},[]),ne=o.useCallback(()=>h(null),[]),ae=o.useCallback((i,f)=>{const v=Me({...f,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight});h({message:i,...v})},[]),W=o.useCallback(i=>{const f=document.getElementById(V(i));f&&(f.scrollIntoView({behavior:"smooth",block:"center"}),f.focus({preventScroll:!0}))},[]);async function se(i=[],f=null){if(i.some(u=>u.kind!=="image"||!["image/png","image/jpeg","image/webp","image/gif"].includes(u.mediaType)))return e.showToast("Team chat supports PNG, JPEG, WebP, and GIF images.","error"),!1;let v=f;if(M&&v)return e.showToast("Remove the agent action before replying to a message.","error"),!1;if(ve(v)){const u=Ce(v);if(!u)throw new Error("The selected profile agent is missing its profile id.");if(!await x({title:`Publish ${v.label??v.name??"agent"} to Team?`,body:`This will upload the committed agent source to ${e.teamName??"this Team"}, create its hosted runtime, and then send your message.`,confirmLabel:"Publish and send",tone:"default"}))return!1;v=await e.onPublishProfileAgent(u)}const S=v?.approvalPolicy?.risk;let H=null;if(v?.approvalPolicy?.required&&S&&S!=="read"){const u=S==="destructive";if(!await x({title:u?"Approve destructive action?":"Approve external write?",body:`${v.label??v.name??"This agent action"} will use the workspace connection to ${u?"perform a destructive operation":"write external data"}. Approve this run only?`,confirmLabel:u?"Approve destructive action":"Approve write",tone:u?"danger":"default"}))return!1;H=crypto.randomUUID()}const k=l,oe=e.detail?.thread.id??null,w=M,J=()=>{a.current===oe&&(s(u=>ke(u,k)),w&&m(u=>u??{threadId:w.threadId,message:w}))};s(""),w&&m(null);try{const u=await e.onSendMessage({body:k,useModel:n,providerId:I,modelId:_,mentionUserIds:be(k,e.members),attachments:i,replyToMessage:w,selectedActionKey:v?.id??null,approvalId:H});return u?n&&d(!1):J(),u}catch(u){throw J(),u}}return t.jsxs("section",{className:"team-chat-view",children:[t.jsxs("div",{className:"team-chat-main conversation-surface-main",children:[t.jsxs("div",{className:"team-chat-messages conversation-message-scroll",role:"log","aria-live":"polite","aria-relevant":"additions text","aria-busy":e.loading,"aria-label":p,tabIndex:0,ref:g,onScroll:i=>{const f=i.currentTarget;y.current=f.scrollHeight-f.scrollTop-f.clientHeight<72},children:[e.detail?.hasMoreBefore?t.jsx("button",{type:"button",className:"team-chat-load-older",disabled:e.loading,onClick:()=>{e.onLoadMoreMessages()},children:e.loading?"Loading...":"Load older messages"}):null,e.loading&&!e.detail?t.jsx("div",{className:"team-chat-empty",children:"Loading messages..."}):e.detail?.messages.length?e.detail.messages.map(i=>t.jsx(Re,{message:i,author:i.authorUserId?P.get(i.authorUserId)??null:null,own:i.authorUserId===e.currentUserId,onOpenAiThread:e.onOpenAiThread,onOpenAgentConversation:e.onOpenAgentConversation,onEdit:e.onEditMessage,onDelete:e.onDeleteMessage,onRetry:e.onRetryMessage,onDismissFailed:e.onDismissFailedMessage,membersById:P,messagesById:q,onReply:F,onOpenReplyMenu:ae,onJumpToMessage:W,connection:e.connection},i.id)):t.jsx("div",{className:"team-chat-empty",children:"No messages yet"})]}),t.jsxs("div",{className:"team-chat-composer-shell conversation-composer-shell",children:[j&&$?t.jsx(je,{authorLabel:$,target:j,onCancel:()=>m(null),onJump:()=>W(j.id)}):null,t.jsx(U,{mode:"dock",surface:"team",teamUseModel:n,teamUseModelLocked:!!j,teamMentionMembers:e.members.filter(i=>i.userId!==e.currentUserId),actionCatalog:ee,onTeamUseModelChange:d,prompt:l,contextWindowStatus:e.contextWindowStatus,busy:e.busy,running:!1,focusRequestId:b,submissionScopeKey:`team:${e.detail?.thread.id??"none"}`,showProjectFooter:!1,connection:e.connection,providerSettings:e.providerSettings,provider:I,model:_,projectTarget:D,workspaceTarget:z,codexPermissionMode:e.codexPermissionMode,codexReasoningEffort:e.codexReasoningEffort,openPondCommandAccessMode:e.openPondCommandAccessMode,onProviderChange:e.onProviderChange,onProviderSetupOpen:e.onOpenProviderSettings,onProjectTargetChange:()=>{},onWorkspaceTargetChange:()=>{},onModelChange:e.onModelChange,onCodexPermissionModeChange:e.onCodexPermissionModeChange,onCodexReasoningEffortChange:e.onCodexReasoningEffortChange,onOpenPondCommandAccessModeChange:e.onOpenPondCommandAccessModeChange,onPromptChange:s,showToast:e.showToast,onSubmit:async(i,f)=>se(i??[],f??null),onStop:()=>!1})]})]}),t.jsx(Te,{menu:C,onClose:ne,onReply:F}),t.jsx(xe,{state:O,onResolve:A})]})}function We(e){const[l,s]=o.useState(""),n=e.agentConversation,d=o.useRef(null),r=o.useRef(null),m=o.useRef(null),C=n.messages.at(-1)?.sequence??0,h=["pending","queued","running"].includes(n.run.status);o.useEffect(()=>{const c=d.current;c&&(c.scrollTop=c.scrollHeight)},[C,n.run.status]),o.useEffect(()=>{r.current?.focus();const c=g=>{g.key==="Escape"&&(g.preventDefault(),e.onCloseAgentConversation())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[e.onCloseAgentConversation]);async function b(c){const g=m.current??crypto.randomUUID();m.current=g;const y=await e.onSendAgentTurn({body:c??l,clientRequestId:g});return y&&(m.current=null,s("")),y}return t.jsxs("aside",{className:"workspace-diff-panel team-ai-thread-panel","aria-label":`${n.agent.name} run`,children:[e.onResizeStart?t.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize agent run panel",onPointerDown:e.onResizeStart}):null,t.jsxs("header",{children:[t.jsxs("div",{children:[t.jsx(T,{size:15}),t.jsx("strong",{children:n.agent.name}),t.jsx("span",{children:n.run.status})]}),t.jsx("button",{ref:r,type:"button",className:"team-chat-icon-button","aria-label":"Close agent run",onClick:e.onCloseAgentConversation,children:t.jsx(R,{size:16})})]}),t.jsxs("div",{className:"team-ai-thread-messages",ref:d,role:"log","aria-live":"polite","aria-relevant":"additions text",tabIndex:0,children:[n.messages.map(c=>t.jsxs("article",{className:`team-ai-message ${c.role}`,children:[t.jsxs("div",{className:"team-ai-message-author",children:[c.role==="assistant"?t.jsx(T,{size:14}):null,t.jsx("strong",{children:c.role==="user"?"Team member":n.agent.name})]}),t.jsx(E,{connection:e.connection,content:c.body})]},c.id)),n.messages.length===0?t.jsx("div",{className:"team-chat-empty",children:"The agent run is starting."}):null]}),t.jsx("div",{className:"team-ai-thread-composer",children:t.jsx(U,{mode:"dock",surface:"team",teamUseModel:!1,teamUseModelLocked:!0,prompt:l,contextWindowStatus:e.contextWindowStatus,busy:e.busy||h,running:h,submissionScopeKey:`team-agent:${n.conversationId}`,showProjectFooter:!1,connection:e.connection,providerSettings:e.providerSettings,provider:e.provider,model:e.model,projectTarget:D,workspaceTarget:z,codexPermissionMode:e.codexPermissionMode,codexReasoningEffort:e.codexReasoningEffort,openPondCommandAccessMode:e.openPondCommandAccessMode,onProviderChange:e.onProviderChange,onProviderSetupOpen:e.onOpenProviderSettings,onProjectTargetChange:()=>{},onWorkspaceTargetChange:()=>{},onModelChange:e.onModelChange,onCodexPermissionModeChange:e.onCodexPermissionModeChange,onCodexReasoningEffortChange:e.onCodexReasoningEffortChange,onOpenPondCommandAccessModeChange:e.onOpenPondCommandAccessModeChange,onPromptChange:c=>{m.current=null,s(c)},showToast:e.showToast,onSubmit:async(c,g,y,a)=>b(a?.promptOverride),onStop:()=>!1})})]})}function He(e){const[l,s]=o.useState(""),n=e.aiThread,d=new Map(e.members.map(a=>[a.userId,a])),r=n.turns.at(-1)??null,m=o.useRef(null),C=n.messages.at(-1)?.sequence??0,h=o.useRef(null),b=Q.has(e.provider)?e.provider:"codex",c=b===e.provider?e.model:"gpt-5.6-sol",g=!!(n.activeTurn&&(n.activeTurn.status==="pending"||n.activeTurn.status==="running"));o.useEffect(()=>{const a=m.current;a&&(a.scrollTop=a.scrollHeight)},[C,n.activeTurn?.partialBody]),o.useEffect(()=>{h.current?.focus();const a=x=>{x.key==="Escape"&&(x.preventDefault(),e.onCloseAiThread())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e.onCloseAiThread]);async function y(a){const x=await e.onSendAiTurn({body:a??l,providerId:b,modelId:c});return x&&s(""),x}return t.jsxs("aside",{className:"workspace-diff-panel team-ai-thread-panel","aria-label":"AI thread",children:[e.onResizeStart?t.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-label":"Resize AI thread panel","aria-orientation":"vertical",onPointerDown:e.onResizeStart}):null,t.jsxs("header",{children:[t.jsxs("div",{children:[t.jsx(N,{size:15}),t.jsx("strong",{children:"AI thread"}),t.jsxs("span",{children:[n.messages.length," messages"]})]}),t.jsx("button",{ref:h,type:"button",className:"team-chat-icon-button","data-tooltip":"Close thread","aria-label":"Close thread",onClick:e.onCloseAiThread,children:t.jsx(R,{size:16})})]}),t.jsxs("div",{className:"team-ai-thread-messages",ref:m,role:"log","aria-live":"polite","aria-relevant":"additions text",tabIndex:0,children:[n.messages.map(a=>t.jsxs("article",{className:`team-ai-message ${a.role}`,children:[t.jsxs("div",{className:"team-ai-message-author",children:[a.role==="assistant"?t.jsx(T,{size:14}):null,t.jsx("strong",{children:a.role==="assistant"?"Model":a.createdByUserId?d.get(a.createdByUserId)?.name??"Team member":"Team member"})]}),t.jsx(E,{connection:e.connection,content:a.body})]},a.id)),n.activeTurn?.partialBody?t.jsxs("article",{className:"team-ai-message assistant streaming",children:[t.jsxs("div",{className:"team-ai-message-author",children:[t.jsx(T,{size:14}),t.jsx("strong",{children:"Model"}),t.jsx("span",{children:n.activeTurn.status})]}),t.jsx(E,{connection:e.connection,content:n.activeTurn.partialBody})]}):n.activeTurn?t.jsx("div",{className:"team-ai-running",children:n.activeTurn.status==="pending"?"Starting model...":"Model is responding..."}):r&&["failed","interrupted","cancelled"].includes(r.status)?t.jsx("div",{className:`team-ai-turn-state ${r.status}`,children:r.status==="failed"?"Model response failed":r.status==="interrupted"?"Model response was interrupted":"Model response was cancelled"}):null]}),t.jsx("div",{className:"team-ai-thread-composer",children:t.jsx(U,{mode:"dock",surface:"team",teamUseModel:!0,teamUseModelLocked:!0,prompt:l,contextWindowStatus:e.contextWindowStatus,busy:g,running:g,submissionScopeKey:`team-ai:${n.conversationId}`,showProjectFooter:!1,connection:e.connection,providerSettings:e.providerSettings,provider:b,model:c,projectTarget:D,workspaceTarget:z,codexPermissionMode:e.codexPermissionMode,codexReasoningEffort:e.codexReasoningEffort,openPondCommandAccessMode:e.openPondCommandAccessMode,onProviderChange:e.onProviderChange,onProviderSetupOpen:e.onOpenProviderSettings,onProjectTargetChange:()=>{},onWorkspaceTargetChange:()=>{},onModelChange:e.onModelChange,onCodexPermissionModeChange:e.onCodexPermissionModeChange,onCodexReasoningEffortChange:e.onCodexReasoningEffortChange,onOpenPondCommandAccessModeChange:e.onOpenPondCommandAccessModeChange,onPromptChange:s,showToast:e.showToast,onSubmit:async(a,x,O,A)=>y(A?.promptOverride),onStop:e.onStopAiTurn})})]})}export{We as TeamAgentConversationPanel,He as TeamAiThreadPanel,_e as TeamChatProView,Fe as TeamChatView,ke as restoreFailedTeamChatPrompt};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as O,j as X}from"./index-BK8GmZmB.js";import{a$ as Zr,bE as cs,bF as Qr,bG as ds,bH as en,bI as tn,bJ as sn,X as rn,P as us,C as nn}from"./App-Dg6mZIQk.js";var on=2,an=1,ln=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=o.top+o.bottom,h=o.right+o.left,a=s-l,d=r-h-t;return{cols:Math.max(on,Math.floor(d/e.css.cell.width)),rows:Math.max(an,Math.floor(a/e.css.cell.height))}}};var lr=Object.defineProperty,hn=Object.getOwnPropertyDescriptor,cn=(e,t)=>{for(var i in t)lr(e,i,{get:t[i],enumerable:!0})},J=(e,t,i,s)=>{for(var r=s>1?void 0:s?hn(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&lr(t,i,r),r},E=(e,t)=>(i,s)=>t(i,s,e),_s="Terminal input",gi={get:()=>_s,set:e=>_s=e},fs="Too much output to announce, navigate to rows manually to read",vi={get:()=>fs,set:e=>fs=e};function dn(e){return e.replace(/\r?\n/g,"\r")}function un(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function _n(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function fn(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");hr(r,t,i,s)}}function hr(e,t,i,s){e=dn(e),e=un(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function cr(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function ps(e,t,i,s,r){cr(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Ge(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Qt(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var pn=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let l=e.charCodeAt(n);56320<=l&&l<=57343?t[s++]=(o-55296)*1024+l-56320+65536:(t[s++]=o,t[s++]=l);continue}o!==65279&&(t[s++]=o)}return s}},gn=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,l,h=0,a=0;if(this.interim[0]){let u=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let _=0,g;for(;(g=this.interim[++_]&63)&&_<4;)f<<=6,f|=g;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,M=k-_;for(;a<M;){if(a>=i)return 0;if(g=e[a++],(g&192)!==128){a--,u=!0;break}else this.interim[_++]=g,f<<=6,f|=g&63}u||(k===2?f<128?a--:t[s++]=f:k===3?f<2048||f>=55296&&f<=57343||f===65279||(t[s++]=f):f<65536||f>1114111||(t[s++]=f)),this.interim.fill(0)}let d=i-4,c=a;for(;c<i;){for(;c<d&&!((r=e[c])&128)&&!((n=e[c+1])&128)&&!((o=e[c+2])&128)&&!((l=e[c+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=l,c+=4;if(r=e[c++],r<128)t[s++]=r;else if((r&224)===192){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(h=(r&31)<<6|n&63,h<128){c--;continue}t[s++]=h}else if((r&240)===224){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(h=(r&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[s++]=h}else if((r&248)===240){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(l=e[c++],(l&192)!==128){c--;continue}if(h=(r&7)<<18|(n&63)<<12|(o&63)<<6|l&63,h<65536||h>1114111)continue;t[s++]=h}}return s}},dr="",Je=" ",Lt=class ur{constructor(){this.fg=0,this.bg=0,this.extended=new Yt}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new ur;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Yt=class _r{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new _r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Re=class fr extends Lt{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Yt,this.combinedData=""}static fromCharData(t){let i=new fr;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ge(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},gs="di$target",mi="di$dependencies",si=new Map;function vn(e){return e[mi]||[]}function ue(e){if(si.has(e))return si.get(e);let t=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");mn(t,i,r)};return t._id=e,si.set(e,t),t}function mn(e,t,i){t[gs]===t?t[mi].push({id:e,index:i}):(t[mi]=[{id:e,index:i}],t[gs]=t)}var me=ue("BufferService"),pr=ue("CoreMouseService"),at=ue("CoreService"),Sn=ue("CharsetService"),Qi=ue("InstantiationService"),gr=ue("LogService"),Se=ue("OptionsService"),vr=ue("OscLinkService"),wn=ue("UnicodeService"),Pt=ue("DecorationService"),Si=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Re,o=i.getTrimmedLength(),l=-1,h=-1,a=!1;for(let d=0;d<o;d++)if(!(h===-1&&!i.hasContent(d))){if(i.loadCell(d,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=d,l=n.extended.urlId;continue}else a=n.extended.urlId!==l;else h!==-1&&(a=!0);if(a||h!==-1&&d===o-1){let c=this._oscLinkService.getLinkData(l)?.uri;if(c){let u={start:{x:h+1,y:e},end:{x:d+(!a&&d===o-1?1:0),y:e}},f=!1;if(!r?.allowNonHttpProtocols)try{let _=new URL(c);["http:","https:"].includes(_.protocol)||(f=!0)}catch{f=!0}f||s.push({text:c,range:u,activate:(_,g)=>r?r.activate(_,g,u):bn(_,g),hover:(_,g)=>r?.hover?.(_,g,u),leave:(_,g)=>r?.leave?.(_,g,u)})}a=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=d,l=n.extended.urlId):(h=-1,l=-1)}}t(s)}};Si=J([E(0,me),E(1,Se),E(2,vr)],Si);function bn(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
1
|
+
import{r as O,j as X}from"./index-BxWTVKtn.js";import{a$ as Zr,bE as cs,bF as Qr,bG as ds,bH as en,bI as tn,bJ as sn,X as rn,P as us,C as nn}from"./App-CuhaCsfb.js";var on=2,an=1,ln=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=o.top+o.bottom,h=o.right+o.left,a=s-l,d=r-h-t;return{cols:Math.max(on,Math.floor(d/e.css.cell.width)),rows:Math.max(an,Math.floor(a/e.css.cell.height))}}};var lr=Object.defineProperty,hn=Object.getOwnPropertyDescriptor,cn=(e,t)=>{for(var i in t)lr(e,i,{get:t[i],enumerable:!0})},J=(e,t,i,s)=>{for(var r=s>1?void 0:s?hn(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&lr(t,i,r),r},E=(e,t)=>(i,s)=>t(i,s,e),_s="Terminal input",gi={get:()=>_s,set:e=>_s=e},fs="Too much output to announce, navigate to rows manually to read",vi={get:()=>fs,set:e=>fs=e};function dn(e){return e.replace(/\r?\n/g,"\r")}function un(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function _n(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function fn(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");hr(r,t,i,s)}}function hr(e,t,i,s){e=dn(e),e=un(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function cr(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function ps(e,t,i,s,r){cr(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Ge(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Qt(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var pn=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let l=e.charCodeAt(n);56320<=l&&l<=57343?t[s++]=(o-55296)*1024+l-56320+65536:(t[s++]=o,t[s++]=l);continue}o!==65279&&(t[s++]=o)}return s}},gn=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,l,h=0,a=0;if(this.interim[0]){let u=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let _=0,g;for(;(g=this.interim[++_]&63)&&_<4;)f<<=6,f|=g;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,M=k-_;for(;a<M;){if(a>=i)return 0;if(g=e[a++],(g&192)!==128){a--,u=!0;break}else this.interim[_++]=g,f<<=6,f|=g&63}u||(k===2?f<128?a--:t[s++]=f:k===3?f<2048||f>=55296&&f<=57343||f===65279||(t[s++]=f):f<65536||f>1114111||(t[s++]=f)),this.interim.fill(0)}let d=i-4,c=a;for(;c<i;){for(;c<d&&!((r=e[c])&128)&&!((n=e[c+1])&128)&&!((o=e[c+2])&128)&&!((l=e[c+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=l,c+=4;if(r=e[c++],r<128)t[s++]=r;else if((r&224)===192){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(h=(r&31)<<6|n&63,h<128){c--;continue}t[s++]=h}else if((r&240)===224){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(h=(r&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[s++]=h}else if((r&248)===240){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(l=e[c++],(l&192)!==128){c--;continue}if(h=(r&7)<<18|(n&63)<<12|(o&63)<<6|l&63,h<65536||h>1114111)continue;t[s++]=h}}return s}},dr="",Je=" ",Lt=class ur{constructor(){this.fg=0,this.bg=0,this.extended=new Yt}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new ur;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Yt=class _r{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new _r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Re=class fr extends Lt{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Yt,this.combinedData=""}static fromCharData(t){let i=new fr;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ge(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},gs="di$target",mi="di$dependencies",si=new Map;function vn(e){return e[mi]||[]}function ue(e){if(si.has(e))return si.get(e);let t=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");mn(t,i,r)};return t._id=e,si.set(e,t),t}function mn(e,t,i){t[gs]===t?t[mi].push({id:e,index:i}):(t[mi]=[{id:e,index:i}],t[gs]=t)}var me=ue("BufferService"),pr=ue("CoreMouseService"),at=ue("CoreService"),Sn=ue("CharsetService"),Qi=ue("InstantiationService"),gr=ue("LogService"),Se=ue("OptionsService"),vr=ue("OscLinkService"),wn=ue("UnicodeService"),Pt=ue("DecorationService"),Si=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Re,o=i.getTrimmedLength(),l=-1,h=-1,a=!1;for(let d=0;d<o;d++)if(!(h===-1&&!i.hasContent(d))){if(i.loadCell(d,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=d,l=n.extended.urlId;continue}else a=n.extended.urlId!==l;else h!==-1&&(a=!0);if(a||h!==-1&&d===o-1){let c=this._oscLinkService.getLinkData(l)?.uri;if(c){let u={start:{x:h+1,y:e},end:{x:d+(!a&&d===o-1?1:0),y:e}},f=!1;if(!r?.allowNonHttpProtocols)try{let _=new URL(c);["http:","https:"].includes(_.protocol)||(f=!0)}catch{f=!0}f||s.push({text:c,range:u,activate:(_,g)=>r?r.activate(_,g,u):bn(_,g),hover:(_,g)=>r?.hover?.(_,g,u),leave:(_,g)=>r?.leave?.(_,g,u)})}a=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=d,l=n.extended.urlId):(h=-1,l=-1)}}t(s)}};Si=J([E(0,me),E(1,Se),E(2,vr)],Si);function bn(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
2
2
|
|
|
3
3
|
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var ei=ue("CharSizeService"),Ue=ue("CoreBrowserService"),es=ue("MouseService"),qe=ue("RenderService"),yn=ue("SelectionService"),mr=ue("CharacterJoinerService"),_t=ue("ThemeService"),Sr=ue("LinkProviderService"),Cn=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?vs.isErrorNoTelemetry(e)?new vs(e.message+`
|
|
4
4
|
|
package/dist/web/assets/{TrainingCreationPanel-GSIwP6f1.js → TrainingCreationPanel-CgIBVGha.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h,j as e}from"./index-
|
|
1
|
+
import{r as h,j as e}from"./index-BxWTVKtn.js";import{bl as f,as as b,q as d,i as x,X as j}from"./App-CuhaCsfb.js";/* empty css */function C({creation:s,training:r,compact:i=!1,onOpenTraining:t}){const[o,g]=h.useState(""),[c,u]=h.useState(""),n=s.state,a=!!r.busyAction;return h.useEffect(()=>{g(""),u("")},[s.id,n]),e.jsxs("section",{className:i?`composer-create-strip ${k(n)} training-create-strip`:"training-approval","aria-label":"Training task status",children:[i?e.jsxs("div",{className:"composer-create-strip-heading",children:[n==="planning"||n==="materializing"||n==="validating"?e.jsx(f,{className:"composer-create-spin",size:15}):n==="failed"?e.jsx(b,{size:15}):e.jsx(d,{size:15}),e.jsx("span",{children:v(n)}),e.jsx("small",{children:"training"})]}):null,n==="awaiting_disclosure_approval"?e.jsxs("div",{className:i?"composer-create-plan-summary":"training-creation-content",children:[i?null:e.jsx("strong",{children:"Review selected evidence with the authoring model?"}),e.jsxs("p",{children:["Approve sends excerpts from ",s.request.sourceIds.length," explicitly selected source",s.request.sourceIds.length===1?"":"s"," to ",s.request.analysisModel?.providerId,"/",s.request.analysisModel?.modelId," so it can propose a Taskset and grader. This does not start training."]}),e.jsxs("div",{className:i?"composer-create-actions":"training-inline-actions",children:[e.jsxs("button",{className:i?void 0:"training-button",disabled:a,onClick:()=>{r.actions.approveDisclosure(s.id,!0)},children:[e.jsx(x,{size:13}),e.jsx("span",{children:"Approve evidence"})]}),e.jsxs("button",{className:i?void 0:"training-button secondary",disabled:a,onClick:()=>{r.actions.approveDisclosure(s.id,!1)},children:[e.jsx(j,{size:13}),e.jsx("span",{children:"Decline"})]}),i&&t?e.jsxs("button",{disabled:a,onClick:t,children:[e.jsx(d,{size:13}),e.jsx("span",{children:"Open Training"})]}):null]})]}):n==="awaiting_materialization_approval"&&s.proposal?e.jsxs("div",{className:i?"composer-create-plan-summary":"training-creation-content",children:[i?null:e.jsx("strong",{children:s.proposal.name}),e.jsx("p",{children:s.proposal.objective}),e.jsxs("div",{className:"training-creation-plan-facts",children:[e.jsx("span",{children:s.proposal.taskKind.replaceAll("_"," ")}),e.jsxs("span",{children:[s.proposal.proposedGraders.length," grader",s.proposal.proposedGraders.length===1?"":"s"]}),e.jsx("span",{children:s.proposal.proposedMethod.replaceAll("_"," ")})]}),s.request.mode==="customize"?e.jsxs("div",{className:"training-question-answer",children:[e.jsx("input",{value:c,onChange:l=>u(l.target.value),placeholder:"Revise tasks, graders, fixtures, or policy"}),e.jsx("button",{className:i?void 0:"training-button secondary",disabled:!c.trim()||a,onClick:async()=>{const l=c;u(""),await r.actions.chatCreation(s.id,l)},children:"Revise"})]}):null,e.jsxs("div",{className:i?"composer-create-actions":"training-inline-actions",children:[e.jsxs("button",{className:i?void 0:"training-button",disabled:a,onClick:()=>{r.actions.materialize(s.id,!0)},children:[e.jsx(x,{size:13}),e.jsx("span",{children:"Materialize Taskset"})]}),t?e.jsxs("button",{className:i?void 0:"training-button secondary",disabled:a,onClick:t,children:[e.jsx(d,{size:13}),e.jsx("span",{children:"Review details"})]}):null,e.jsxs("button",{className:i?void 0:"training-button secondary",disabled:a,onClick:()=>{r.actions.materialize(s.id,!1)},children:[e.jsx(j,{size:13}),e.jsx("span",{children:"Cancel"})]})]})]}):n==="awaiting_questions"?e.jsx("div",{className:i?"composer-create-question":"training-creation-content",children:(()=>{const l=s.blockingQuestions.find(p=>!p.answer);return l?e.jsxs(e.Fragment,{children:[e.jsx("p",{children:l.prompt}),e.jsxs("div",{className:"training-question-answer",children:[e.jsx("input",{value:o,onChange:p=>g(p.target.value)}),e.jsx("button",{className:i?void 0:"training-button",disabled:!o.trim()||a,onClick:()=>{r.actions.answerQuestions(s.id,{[l.id]:o})},children:"Continue"})]})]}):null})()}):e.jsxs("div",{className:i?"composer-create-status-body":"training-creation-content",children:[e.jsx("p",{children:m(s)}),i&&t?e.jsx("div",{className:"composer-create-actions",children:e.jsxs("button",{onClick:t,children:[e.jsx(d,{size:13}),e.jsx("span",{children:"Open Training"})]})}):null]})]})}function T({creation:s}){return e.jsxs("section",{className:"chat-create-receipt","aria-label":"Training status",children:[e.jsxs("div",{className:"chat-create-receipt-heading",children:[e.jsx(d,{size:14}),e.jsx("span",{children:v(s.state)}),e.jsx("small",{children:"training"})]}),e.jsx("p",{children:s.request.objective??m(s)}),e.jsxs("div",{className:"chat-create-receipt-facts",children:[e.jsxs("span",{children:[s.request.sourceIds.length," selected source",s.request.sourceIds.length===1?"":"s"]}),e.jsx("span",{children:s.request.mode==="customize"?"guided plan":"fast draft"})]})]})}function v(s){return s==="awaiting_disclosure_approval"?"Training evidence review":s==="awaiting_materialization_approval"?"Training plan ready":s==="awaiting_questions"?"Training question":s==="materializing"?"Materializing Taskset":s==="ready"?"Taskset ready":s==="failed"?"Training plan failed":s==="cancelled"?"Training plan cancelled":"Preparing training plan"}function m(s){return s.blockedReason?s.blockedReason:s.state==="ready"?"The reviewed Taskset was materialized. Training still requires a separate approval.":s.state==="cancelled"?"Taskset creation was cancelled.":s.state==="planning"?"The authoring model is proposing tasks, graders, fixtures, and policy boundaries.":`Task Creator is ${s.state.replaceAll("_"," ")}.`}function k(s){return s==="ready"?"success":s==="failed"||s==="cancelled"?"danger":s==="awaiting_disclosure_approval"||s==="awaiting_materialization_approval"||s==="awaiting_questions"?"warning":"info"}export{C as TrainingCreationPanel,T as TrainingStatusReceipt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./index-
|
|
1
|
+
import{j as s}from"./index-BxWTVKtn.js";import{bk as p,bK as j}from"./App-CuhaCsfb.js";import{M as x}from"./minimize-2-Bs7MVN3C.js";/* empty css */function k({training:r,sessionId:t,expanded:i,onOpenTraining:d,onResizeStart:o,onToggleExpanded:l}){const n=r.payload?.sources.filter(e=>e.sessionId===t)??[],c=new Set(n.map(e=>e.id)),a=r.payload?.creations.find(e=>e.request.sourceIds.some(h=>c.has(h)))??null;return s.jsxs("aside",{className:`workspace-diff-panel training-draft-panel ${i?"expanded":""}`,"aria-label":"Training task draft",children:[i?null:s.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize task draft",onPointerDown:o}),s.jsxs("div",{className:"workspace-diff-topbar",children:[s.jsx("div",{className:"workspace-diff-tabs",children:s.jsxs("button",{type:"button",className:"workspace-diff-tab active",children:[s.jsx(p,{size:14}),s.jsx("span",{children:"Task draft"})]})}),s.jsx("div",{className:"workspace-diff-toolbar-actions",children:s.jsx("button",{className:"diff-icon-button",type:"button",onClick:l,"aria-label":i?"Dock task draft":"Expand task draft",children:i?s.jsx(x,{size:14}):s.jsx(j,{size:14})})})]}),s.jsxs("div",{className:"training-draft-body",children:[s.jsx("span",{className:"training-eyebrow",children:"Selected chat"}),s.jsx("h2",{children:n[0]?.title??"Not added to training"}),s.jsxs("dl",{className:"training-definition",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Sources"}),s.jsx("dd",{children:n.length})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Status"}),s.jsx("dd",{children:a?.state.replaceAll("_"," ")??"No draft"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Method"}),s.jsx("dd",{children:a?.proposal?.proposedMethod??"Pending"})]})]}),a?.proposal?s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:a.proposal.name}),s.jsx("p",{children:a.proposal.objective})]}):s.jsxs("p",{children:["Add this chat with the sidebar action or run ",s.jsx("code",{children:"/train"}),"."]}),a?.blockedReason?s.jsx("p",{className:"training-draft-warning",children:a.blockedReason}):null,s.jsx("button",{className:"training-button secondary",type:"button",onClick:d,children:"Open Training"})]})]})}export{k as TrainingDraftPanel};
|
package/dist/web/assets/{UsageSettingsSection-DmzStI9q.js → UsageSettingsSection-CSRjJUSa.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as f,j as l}from"./index-
|
|
1
|
+
import{r as f,j as l}from"./index-BxWTVKtn.js";import{aq as ia,bl as kt,bB as la,a$ as oa,G as Te}from"./App-CuhaCsfb.js";import{A as sa}from"./arrow-up-right-H0pvnH2s.js";import{w as ca,c as me,s as ua,i as le,a as _e,u as jt,r as Fe,b as ze,S as da,d as oe,e as ma,p as At,f as fa,g as va,h as ha,j as pa,k as ga,l as ue,m as ya,n as nt,o as ba,q as xa,t as ka,v as ja,x as Aa,y as je,z as $e,A as Le,B as Pa,C as Pt,R as Sa,D as Ia,E as z,F as Ta,G as wa,H as ne,I as Oa,J,K as Q,L as St,M as It,N as Tt,O as Ca,P as Na,Q as rt,T as Ma,U as it,V as Ea,W as pe,X as Ue,Y as Da,Z as wt,_ as $a,$ as La,a0 as Ba,a1 as We,a2 as $,a3 as Ot,a4 as Ra,a5 as qa,a6 as Ka,a7 as _a,a8 as Fa,a9 as za,aa as Ct,ab as Ua,ac as Wa,ad as Ha,ae as lt,af as Nt,ag as Ga,ah as Va,ai as Ya,aj as Xa,ak as Za,al as Ja,am as Qa,an as en,ao as ot,ap as tn,aq as an,ar as nn,as as rn,at as ln,au as on,av as sn}from"./CartesianChart-BstFbsdn.js";const Mt=Math.cos,ge=Math.sin,R=Math.sqrt,ye=Math.PI,Ae=2*ye,He={draw(e,t){const a=R(t/ye);e.moveTo(a,0),e.arc(0,0,a,0,Ae)}},cn={draw(e,t){const a=R(t/5)/2;e.moveTo(-3*a,-a),e.lineTo(-a,-a),e.lineTo(-a,-3*a),e.lineTo(a,-3*a),e.lineTo(a,-a),e.lineTo(3*a,-a),e.lineTo(3*a,a),e.lineTo(a,a),e.lineTo(a,3*a),e.lineTo(-a,3*a),e.lineTo(-a,a),e.lineTo(-3*a,a),e.closePath()}},Et=R(1/3),un=Et*2,dn={draw(e,t){const a=R(t/un),n=a*Et;e.moveTo(0,-a),e.lineTo(n,0),e.lineTo(0,a),e.lineTo(-n,0),e.closePath()}},mn={draw(e,t){const a=R(t),n=-a/2;e.rect(n,n,a,a)}},fn=.8908130915292852,Dt=ge(ye/10)/ge(7*ye/10),vn=ge(Ae/10)*Dt,hn=-Mt(Ae/10)*Dt,pn={draw(e,t){const a=R(t*fn),n=vn*a,r=hn*a;e.moveTo(0,-a),e.lineTo(n,r);for(let i=1;i<5;++i){const o=Ae*i/5,u=Mt(o),d=ge(o);e.lineTo(d*a,-u*a),e.lineTo(u*n-d*r,d*n+u*r)}e.closePath()}},we=R(3),gn={draw(e,t){const a=-R(t/(we*3));e.moveTo(0,a*2),e.lineTo(-we*a,-a),e.lineTo(we*a,-a),e.closePath()}},N=-.5,M=R(3)/2,Be=1/R(12),yn=(Be/2+1)*3,bn={draw(e,t){const a=R(t/yn),n=a/2,r=a*Be,i=n,o=a*Be+a,u=-i,d=o;e.moveTo(n,r),e.lineTo(i,o),e.lineTo(u,d),e.lineTo(N*n-M*r,M*n+N*r),e.lineTo(N*i-M*o,M*i+N*o),e.lineTo(N*u-M*d,M*u+N*d),e.lineTo(N*n+M*r,N*r-M*n),e.lineTo(N*i+M*o,N*o-M*i),e.lineTo(N*u+M*d,N*d-M*u),e.closePath()}};function xn(e,t){let a=null,n=ca(r);e=typeof e=="function"?e:me(e||He),t=typeof t=="function"?t:me(t===void 0?64:+t);function r(){let i;if(a||(a=i=n()),e.apply(this,arguments).draw(a,+t.apply(this,arguments)),i)return a=null,i+""||null}return r.type=function(i){return arguments.length?(e=typeof i=="function"?i:me(i),r):e},r.size=function(i){return arguments.length?(t=typeof i=="function"?i:me(+i),r):t},r.context=function(i){return arguments.length?(a=i??null,r):a},r}var kn=["type","size","sizeType"];function Re(){return Re=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Re.apply(null,arguments)}function st(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),a.push.apply(a,n)}return a}function ct(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?st(Object(a),!0).forEach(function(n){jn(e,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):st(Object(a)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))})}return e}function jn(e,t,a){return(t=An(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function An(e){var t=Pn(e,"string");return typeof t=="symbol"?t:t+""}function Pn(e,t){if(typeof e!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var n=a.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sn(e,t){if(e==null)return{};var a,n,r=In(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)===-1&&{}.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function In(e,t){if(e==null)return{};var a={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;a[n]=e[n]}return a}var $t={symbolCircle:He,symbolCross:cn,symbolDiamond:dn,symbolSquare:mn,symbolStar:pn,symbolTriangle:gn,symbolWye:bn},Tn=Math.PI/180,wn=e=>{var t="symbol".concat(jt(e));return $t[t]||He},On=(e,t,a)=>{if(t==="area")return e;switch(a){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*Tn;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Cn=(e,t)=>{$t["symbol".concat(jt(e))]=t},Lt=e=>{var t=e.type,a=t===void 0?"circle":t,n=e.size,r=n===void 0?64:n,i=e.sizeType,o=i===void 0?"area":i,u=Sn(e,kn),d=ct(ct({},u),{},{type:a,size:r,sizeType:o}),s="circle";typeof a=="string"&&(s=a);var c=()=>{var b=wn(s),p=xn().type(b).size(On(r,o,s)),x=p();if(x!==null)return x},m=d.className,v=d.cx,y=d.cy,h=ua(d);return le(v)&&le(y)&&le(r)?f.createElement("path",Re({},h,{className:_e("recharts-symbols",m),transform:"translate(".concat(v,", ").concat(y,")"),d:c()})):null};Lt.registerSymbol=Cn;function be(){return be=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},be.apply(null,arguments)}function ut(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),a.push.apply(a,n)}return a}function Bt(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?ut(Object(a),!0).forEach(function(n){Nn(e,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ut(Object(a)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))})}return e}function Nn(e,t,a){return(t=Mn(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function Mn(e){var t=En(e,"string");return typeof t=="symbol"?t:t+""}function En(e,t){if(typeof e!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var n=a.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var E=32,Dn={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle",labelStyle:{}};function $n(e){if(typeof e=="object"&&e!==null&&"strokeDasharray"in e)return String(e.strokeDasharray)}function Ln(e){var t=e.data,a=e.iconType,n=e.inactiveColor,r=E/2,i=E/6,o=E/3,u=t.inactive?n:t.color,d=a??t.type;if(d==="none")return null;if(d==="plainline")return f.createElement("line",{strokeWidth:4,fill:"none",stroke:u,strokeDasharray:$n(t.payload),x1:0,y1:r,x2:E,y2:r,className:"recharts-legend-icon"});if(d==="line")return f.createElement("path",{strokeWidth:4,fill:"none",stroke:u,d:"M0,".concat(r,"h").concat(o,`
|
|
2
2
|
A`).concat(i,",").concat(i,",0,1,1,").concat(2*o,",").concat(r,`
|
|
3
3
|
H`).concat(E,"M").concat(2*o,",").concat(r,`
|
|
4
4
|
A`).concat(i,",").concat(i,",0,1,1,").concat(o,",").concat(r),className:"recharts-legend-icon"});if(d==="rect")return f.createElement("path",{stroke:"none",fill:u,d:"M0,".concat(E/8,"h").concat(E,"v").concat(E*3/4,"h").concat(-E,"z"),className:"recharts-legend-icon"});if(f.isValidElement(t.legendIcon)){var s=Bt({},t);return delete s.legendIcon,f.cloneElement(t.legendIcon,s)}return f.createElement(Lt,{fill:u,cx:r,cy:r,size:E,sizeType:"diameter",type:d})}function Bn(e){var t=e.payload,a=e.iconSize,n=e.layout,r=e.formatter,i=e.inactiveColor,o=e.iconType,u=e.labelStyle,d={x:0,y:0,width:E,height:E},s={display:n==="horizontal"?"inline-block":"block",marginRight:10},c={display:"inline-block",verticalAlign:"middle",marginRight:4};return t.map((m,v)=>{var y=m.formatter||r,h=_e({"recharts-legend-item":!0,["legend-item-".concat(v)]:!0,inactive:m.inactive});if(m.type==="none")return null;var b=typeof u=="object"?Bt({},u):{};b.color=m.inactive?i:b.color||m.color;var p=y?y(m.value,m,v):m.value;return f.createElement("li",be({className:h,style:s,key:"legend-item-".concat(v)},ze(e,m,v)),f.createElement(da,{width:a,height:a,viewBox:d,style:c,"aria-label":m.value==null?"legend icon":"".concat(m.value," legend icon")},f.createElement(Ln,{data:m,iconType:o,inactiveColor:i})),f.createElement("span",{className:"recharts-legend-item-text",style:b},p))})}var Rn=e=>{var t=Fe(e,Dn),a=t.payload,n=t.layout,r=t.align;if(!a||!a.length)return null;var i={padding:0,margin:0,textAlign:n==="horizontal"?r:"left"};return f.createElement("ul",{className:"recharts-default-legend",style:i},f.createElement(Bn,be({},t,{payload:a})))};function qn(){return oe(ma)}var Kn=["contextPayload"];function qe(){return qe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},qe.apply(null,arguments)}function _n(e,t){return Wn(e)||Un(e,t)||zn(e,t)||Fn()}function Fn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as f,j as e}from"./index-BK8GmZmB.js";import{bK as X,q as y,al as Y,bB as B,G as w,c8 as Z}from"./App-Dg6mZIQk.js";import{M as ee,r as _,s as te,T as ie}from"./MarkdownText-CLnvdLVg.js";import{F as W}from"./folder-open-BFy7KXWm.js";import{M as ne}from"./minimize-2-34MApatV.js";import{P as E}from"./MainPane-SMqq5YAM.js";import"./cloud-upload-B9L-_gy0.js";import"./arrow-up-right-C60QSULo.js";import"./square-Coz7UQqd.js";import"./play-C4PtpamL.js";function Ce({chatMessages:i,connection:r,contextWindowStatus:l,expanded:s,runtimeEvents:c,sessionId:d,showToast:u,onResizeStart:S,onToggleExpanded:L,onUseOutput:P,onHandoffOutput:T,onReviseOutput:D,onAgentPackageInstalled:I}){const[k,K]=f.useState("outputs"),[j,x]=f.useState(null),[o,m]=f.useState(null),[v,N]=f.useState(""),[V,q]=f.useState({}),A=f.useMemo(()=>oe(c),[c]),U=f.useMemo(()=>ae(A),[A]),R=f.useMemo(()=>se(i),[i]),$=f.useMemo(()=>re(i),[i]),O=f.useMemo(()=>le(i),[i]);f.useEffect(()=>()=>{o?.objectUrl&&URL.revokeObjectURL(o.objectUrl)},[o?.objectUrl]);async function b(t){if(!r||!d||t.kind!=="file")return null;x(p(t));try{const n=await w.workspaceTool(r,d,{action:"work_output_read",source:"ui_button",args:{outputId:t.id,revision:t.revision}});if(!n.ok)throw new Error(n.output);const a=pe(n.data),h=typeof a.contentsBase64=="string"?a.contentsBase64:"";if(!h)throw new Error("The output did not include file data.");return new File([de(h)],t.title,{type:t.contentType})}catch(n){return u(n instanceof Error?n.message:"Could not load the output.","error"),null}finally{x(null)}}async function G(t){const n=await b(t);if(!n)return;o?.objectUrl&&URL.revokeObjectURL(o.objectUrl);const a=t.kind==="file"&&(t.contentType.startsWith("text/")||t.contentType==="application/json");N(""),m({output:t,file:n,text:a?await n.text():null,objectUrl:a?null:URL.createObjectURL(n)})}async function H(t){const n=await b(t);n&&(P(n),u("Added the output to the task as input.","success"))}async function z(t,n){const a=n.kind==="file"?await b(n):null;n.kind==="file"&&!a||await T(t,n,a)}async function J(t){if(!(!r||!d)&&window.confirm(`Delete ${t.title} revision ${t.revision} from this device?`)){x(p(t));try{const n=await w.workspaceTool(r,d,{action:"work_output_delete",source:"ui_button",args:{outputId:t.id,revision:t.revision}});if(!n.ok)throw new Error(n.output);o?.output.id===t.id&&m(null),u("Work output deleted.","success")}catch(n){u(n instanceof Error?n.message:"Could not delete the output.","error")}finally{x(null)}}}async function Q(t){if(!r||!d||!window.confirm(`Add ${t.title} version ${t.versionId} to your active Agents profile?`))return;const n=async a=>w.workspaceTool(r,d,{action:"work_agent_package_install",source:"ui_button",args:{outputId:t.id,revision:t.revision,overwrite:a}});x(p(t));try{let a;try{a=await n(!1)}catch(h){if(!(h instanceof Error?h.message:"Agent installation failed.").includes("already exists")||!window.confirm(`${t.agentId} already exists. Replace its active checkout with this immutable version?`))throw h;a=await n(!0)}if(!a.ok)throw new Error(a.output);await I?.(),u(`${t.title} was added to Agents. Its package remains available in this Work task.`,"success")}catch(a){u(a instanceof Error?a.message:"Could not add the Agent package.","error")}finally{x(null)}}return e.jsxs("aside",{className:`workspace-diff-panel work-sidebar-panel ${s?"expanded":""}`,"aria-label":"Work details",children:[s?null:e.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize Work details",onPointerDown:S}),e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Work details",children:[["outputs","Outputs"],["activity","Activity"],["context","Context"]].map(([t,n])=>e.jsx("button",{type:"button",className:`workspace-diff-tab ${k===t?"active":""}`,role:"tab","aria-selected":k===t,onClick:()=>K(t),children:n},t))}),e.jsx("div",{className:"workspace-diff-toolbar-actions",children:e.jsx("button",{type:"button",className:"diff-icon-button",title:s?"Dock sidebar":"Expand sidebar","aria-label":s?"Dock sidebar":"Expand sidebar",onClick:L,children:s?e.jsx(ne,{size:14}):e.jsx(X,{size:14})})})]}),e.jsxs("div",{className:"work-sidebar-body",children:[k==="outputs"?o?e.jsxs("div",{className:"work-output-preview",children:[e.jsxs("header",{children:[e.jsx("button",{type:"button",onClick:()=>{o.objectUrl&&URL.revokeObjectURL(o.objectUrl),m(null)},children:"Outputs"}),e.jsxs("strong",{children:[o.output.title," · revision ",o.output.revision]})]}),o.text!==null?e.jsx(ee,{content:o.text}):o.output.kind==="file"&&o.output.contentType.startsWith("image/")&&o.objectUrl?e.jsx("img",{src:o.objectUrl,alt:o.output.title}):o.output.kind==="file"&&o.output.contentType==="application/pdf"&&o.objectUrl?e.jsx("iframe",{src:o.objectUrl,title:o.output.title}):o.output.kind==="file"&&o.output.contentType.startsWith("audio/")&&o.objectUrl?e.jsx("audio",{controls:!0,src:o.objectUrl}):o.output.kind==="file"&&o.output.contentType.startsWith("video/")&&o.objectUrl?e.jsx("video",{controls:!0,src:o.objectUrl}):e.jsx("p",{children:"This file type uses its native application for detailed review."}),e.jsxs("section",{className:"work-output-annotation",children:[e.jsx("label",{htmlFor:"work-output-revision-note",children:"Revision note"}),e.jsx("textarea",{id:"work-output-revision-note",value:v,onChange:t=>N(t.target.value),placeholder:"Describe the exact change to make in the next revision."}),e.jsx("button",{type:"button",disabled:!v.trim(),onClick:()=>{D(o.output,o.file,v.trim()),u(`Prepared revision ${o.output.revision+1}.`,"success")},children:"Revise this version"})]})]}):U.length>0?e.jsx("div",{className:"work-output-list",children:U.map(t=>{const n=t.revisions.find(a=>a.revision===V[t.id])??t.revisions[0];return e.jsxs("article",{className:"work-output-card",children:[e.jsxs("header",{children:[e.jsx(y,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:n.title}),t.revisions.length>1?e.jsxs("label",{className:"work-output-version",children:[e.jsx("span",{children:"Version"}),e.jsx("select",{value:n.revision,onChange:a=>q(h=>({...h,[t.id]:Number(a.target.value)})),children:t.revisions.map(a=>e.jsxs("option",{value:a.revision,children:["Revision ",a.revision]},p(a)))})]}):e.jsxs("small",{children:["Revision ",n.revision]}),e.jsx("small",{children:ce(n)})]})]}),n.validation.length>0?e.jsxs("div",{className:"work-output-validation",children:[e.jsx(Y,{size:13}),e.jsxs("span",{children:[n.validation.filter(a=>a.status==="passed").length," ","checks passed"]})]}):null,e.jsxs("div",{className:"work-output-actions",children:[n.kind==="file"&&n.location.kind==="local"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>{_(M(n))},children:[e.jsx(W,{size:13}),"Reveal"]}),e.jsx("button",{type:"button",onClick:async()=>{const a=await te(M(n),n.title);a.ok?u("Saved a copy of the Work output.","success"):a.canceled||u("Could not save a copy of the Work output.","error")},children:"Save as"})]}):null,n.kind==="file"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{G(n)},children:"Preview"}),e.jsxs("button",{type:"button",disabled:j===p(n),onClick:()=>{H(n)},children:[e.jsx(E,{size:13}),"Use as input"]})]}):n.kind==="agent_package"?e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{Q(n)},children:"Add to Agents"}):"url"in n&&n.url?e.jsx("button",{type:"button",onClick:()=>window.open(n.url,"_blank","noopener,noreferrer"),children:"Open"}):null,n.kind==="file"&&n.location.kind==="local"?e.jsxs("button",{type:"button",className:"danger",disabled:j===p(n),onClick:()=>{J(n)},children:[e.jsx(ie,{size:13}),"Delete"]}):null,e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{z("chat",n)},children:"Continue in Chat"}),e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{z("work",n)},children:"Continue in repository Work"})]})]},t.id)})}):$.length>0?e.jsx("div",{className:"work-output-list",children:$.map(t=>e.jsxs("article",{className:"work-output-card",children:[e.jsxs("header",{children:[e.jsx(y,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:t.title}),e.jsx("small",{children:C(t.sizeBytes)})]})]}),e.jsx("div",{className:"work-output-actions",children:e.jsxs("button",{type:"button",onClick:()=>{_(t.path)},children:[e.jsx(W,{size:13}),"Reveal"]})})]},t.path))}):e.jsx(F,{icon:y,title:"No saved outputs yet",detail:"Finished files and connected results will appear here."}):null,k==="activity"?R.length>0?e.jsx("div",{className:"work-activity-list",children:R.map(t=>e.jsxs("details",{className:`work-activity-row ${t.state??""}`,children:[e.jsxs("summary",{children:[e.jsx(B,{size:14}),e.jsx("span",{children:t.label}),e.jsx("small",{children:t.state??"completed"})]}),e.jsx("p",{children:t.content}),t.detail?e.jsx("pre",{children:t.detail}):null]},t.id))}):e.jsx(F,{icon:B,title:"No activity yet",detail:"Commands, tool receipts, and checks appear while Work runs."}):null,k==="context"?e.jsxs("div",{className:"work-context",children:[e.jsxs("section",{children:[e.jsx("h3",{children:"Model context"}),e.jsx("p",{children:l.summary}),e.jsx("small",{children:l.tokensLabel})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Task inputs and sources"}),O.length>0?e.jsx("ul",{children:O.map(t=>e.jsxs("li",{children:[e.jsx(E,{size:13}),e.jsxs("span",{children:[e.jsx("strong",{children:t.title}),e.jsx("small",{children:t.detail})]})]},t.key))}):e.jsx("p",{children:"No attached files or cited sources yet."})]})]}):null]})]})}function se(i){return i.flatMap(r=>r.activities??[]).filter(r=>r.kind!=="reasoning").reverse()}function re(i){const r=new Map;for(const l of i)for(const s of l.activities??[])for(const c of s.artifacts??[])!c.path||c.sizeBytes===null||r.set(c.path,{path:c.path,title:c.title,sizeBytes:c.sizeBytes});return[...r.values()].sort((l,s)=>s.path.localeCompare(l.path))}function oe(i){const r=new Map,l=new Set;for(const s of i){const c=g(s.data);if(s.action==="work_output_delete"&&s.status==="completed"){for(const d of c){const u=p(d);l.add(u),r.delete(u)}continue}if(s.action!=="work_output_read")for(const d of c){const u=p(d);l.has(u)||r.set(u,d)}}return[...r.values()].sort((s,c)=>c.createdAt.localeCompare(s.createdAt)||c.revision-s.revision)}function p(i){return`${i.id}:${i.revision}`}function ae(i){const r=new Map;for(const l of i){const s=r.get(l.id)??[];s.push(l),r.set(l.id,s)}return[...r.entries()].map(([l,s])=>({id:l,revisions:s.sort((c,d)=>d.revision-c.revision||d.createdAt.localeCompare(c.createdAt))})).sort((l,s)=>s.revisions[0].createdAt.localeCompare(l.revisions[0].createdAt))}function g(i,r=[],l=new Set,s=0){if(s>8||i==null)return r;const c=Z.safeParse(i);if(c.success){const d=`${c.data.id}:${c.data.revision}`;return l.has(d)||(l.add(d),r.push(c.data)),r}if(Array.isArray(i)){for(const d of i)g(d,r,l,s+1);return r}if(typeof i=="object")for(const d of Object.values(i))g(d,r,l,s+1);return r}function le(i){const r=new Map;for(const l of i){for(const s of l.attachments??[])r.set(`attachment:${s.id}`,{key:`attachment:${s.id}`,title:s.name,detail:`${s.mediaType} · ${C(s.sizeBytes)}`});for(const s of l.sources??[])r.set(`source:${s.id}`,{key:`source:${s.id}`,title:s.title,detail:s.sourceName??ue(s.url)})}return[...r.values()]}function F({icon:i,title:r,detail:l}){return e.jsxs("div",{className:"work-sidebar-empty",children:[e.jsx(i,{size:22}),e.jsx("strong",{children:r}),e.jsx("p",{children:l})]})}function ce(i){return i.kind==="deployment"?"Deployment":i.kind==="source_change"?"Source change":i.kind==="external_resource"?i.provider:i.kind==="agent_package"?`${i.actions.length} action${i.actions.length===1?"":"s"}`:i.location.kind==="local"?C(i.sizeBytes):i.location.kind==="managed"?"Managed file":i.location.provider}function C(i){return i<1024?`${i} B`:i<1024*1024?`${Math.round(i/1024)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}function de(i){const r=window.atob(i),l=new ArrayBuffer(r.length),s=new Uint8Array(l);for(let c=0;c<r.length;c+=1)s[c]=r.charCodeAt(c);return l}function M(i){return i.kind==="file"&&i.location.kind==="local"?i.location.path:""}function ue(i){try{return new URL(i).hostname||i}catch{return i}}function pe(i){return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}export{Ce as WorkSidebarPanel,re as visibleChatFileArtifacts,se as visibleWorkActivities,oe as workOutputsFromEvents};
|
|
1
|
+
import{r as f,j as e}from"./index-BxWTVKtn.js";import{bK as X,q as y,al as Y,bB as B,G as w,c8 as Z}from"./App-CuhaCsfb.js";import{M as ee,r as _,s as te,T as ie}from"./MarkdownText-gJMuefaJ.js";import{F as W}from"./folder-open-sLZJxLQy.js";import{M as ne}from"./minimize-2-Bs7MVN3C.js";import{P as E}from"./MainPane-CakOBCHw.js";import"./cloud-upload-CJPYPVl8.js";import"./arrow-up-right-H0pvnH2s.js";import"./square-oy7f5Ce6.js";import"./play-CXkxUZeU.js";function Ce({chatMessages:i,connection:r,contextWindowStatus:l,expanded:s,runtimeEvents:c,sessionId:d,showToast:u,onResizeStart:S,onToggleExpanded:L,onUseOutput:P,onHandoffOutput:T,onReviseOutput:D,onAgentPackageInstalled:I}){const[k,K]=f.useState("outputs"),[j,x]=f.useState(null),[o,m]=f.useState(null),[v,N]=f.useState(""),[V,q]=f.useState({}),A=f.useMemo(()=>oe(c),[c]),U=f.useMemo(()=>ae(A),[A]),R=f.useMemo(()=>se(i),[i]),$=f.useMemo(()=>re(i),[i]),O=f.useMemo(()=>le(i),[i]);f.useEffect(()=>()=>{o?.objectUrl&&URL.revokeObjectURL(o.objectUrl)},[o?.objectUrl]);async function b(t){if(!r||!d||t.kind!=="file")return null;x(p(t));try{const n=await w.workspaceTool(r,d,{action:"work_output_read",source:"ui_button",args:{outputId:t.id,revision:t.revision}});if(!n.ok)throw new Error(n.output);const a=pe(n.data),h=typeof a.contentsBase64=="string"?a.contentsBase64:"";if(!h)throw new Error("The output did not include file data.");return new File([de(h)],t.title,{type:t.contentType})}catch(n){return u(n instanceof Error?n.message:"Could not load the output.","error"),null}finally{x(null)}}async function G(t){const n=await b(t);if(!n)return;o?.objectUrl&&URL.revokeObjectURL(o.objectUrl);const a=t.kind==="file"&&(t.contentType.startsWith("text/")||t.contentType==="application/json");N(""),m({output:t,file:n,text:a?await n.text():null,objectUrl:a?null:URL.createObjectURL(n)})}async function H(t){const n=await b(t);n&&(P(n),u("Added the output to the task as input.","success"))}async function z(t,n){const a=n.kind==="file"?await b(n):null;n.kind==="file"&&!a||await T(t,n,a)}async function J(t){if(!(!r||!d)&&window.confirm(`Delete ${t.title} revision ${t.revision} from this device?`)){x(p(t));try{const n=await w.workspaceTool(r,d,{action:"work_output_delete",source:"ui_button",args:{outputId:t.id,revision:t.revision}});if(!n.ok)throw new Error(n.output);o?.output.id===t.id&&m(null),u("Work output deleted.","success")}catch(n){u(n instanceof Error?n.message:"Could not delete the output.","error")}finally{x(null)}}}async function Q(t){if(!r||!d||!window.confirm(`Add ${t.title} version ${t.versionId} to your active Agents profile?`))return;const n=async a=>w.workspaceTool(r,d,{action:"work_agent_package_install",source:"ui_button",args:{outputId:t.id,revision:t.revision,overwrite:a}});x(p(t));try{let a;try{a=await n(!1)}catch(h){if(!(h instanceof Error?h.message:"Agent installation failed.").includes("already exists")||!window.confirm(`${t.agentId} already exists. Replace its active checkout with this immutable version?`))throw h;a=await n(!0)}if(!a.ok)throw new Error(a.output);await I?.(),u(`${t.title} was added to Agents. Its package remains available in this Work task.`,"success")}catch(a){u(a instanceof Error?a.message:"Could not add the Agent package.","error")}finally{x(null)}}return e.jsxs("aside",{className:`workspace-diff-panel work-sidebar-panel ${s?"expanded":""}`,"aria-label":"Work details",children:[s?null:e.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize Work details",onPointerDown:S}),e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Work details",children:[["outputs","Outputs"],["activity","Activity"],["context","Context"]].map(([t,n])=>e.jsx("button",{type:"button",className:`workspace-diff-tab ${k===t?"active":""}`,role:"tab","aria-selected":k===t,onClick:()=>K(t),children:n},t))}),e.jsx("div",{className:"workspace-diff-toolbar-actions",children:e.jsx("button",{type:"button",className:"diff-icon-button",title:s?"Dock sidebar":"Expand sidebar","aria-label":s?"Dock sidebar":"Expand sidebar",onClick:L,children:s?e.jsx(ne,{size:14}):e.jsx(X,{size:14})})})]}),e.jsxs("div",{className:"work-sidebar-body",children:[k==="outputs"?o?e.jsxs("div",{className:"work-output-preview",children:[e.jsxs("header",{children:[e.jsx("button",{type:"button",onClick:()=>{o.objectUrl&&URL.revokeObjectURL(o.objectUrl),m(null)},children:"Outputs"}),e.jsxs("strong",{children:[o.output.title," · revision ",o.output.revision]})]}),o.text!==null?e.jsx(ee,{content:o.text}):o.output.kind==="file"&&o.output.contentType.startsWith("image/")&&o.objectUrl?e.jsx("img",{src:o.objectUrl,alt:o.output.title}):o.output.kind==="file"&&o.output.contentType==="application/pdf"&&o.objectUrl?e.jsx("iframe",{src:o.objectUrl,title:o.output.title}):o.output.kind==="file"&&o.output.contentType.startsWith("audio/")&&o.objectUrl?e.jsx("audio",{controls:!0,src:o.objectUrl}):o.output.kind==="file"&&o.output.contentType.startsWith("video/")&&o.objectUrl?e.jsx("video",{controls:!0,src:o.objectUrl}):e.jsx("p",{children:"This file type uses its native application for detailed review."}),e.jsxs("section",{className:"work-output-annotation",children:[e.jsx("label",{htmlFor:"work-output-revision-note",children:"Revision note"}),e.jsx("textarea",{id:"work-output-revision-note",value:v,onChange:t=>N(t.target.value),placeholder:"Describe the exact change to make in the next revision."}),e.jsx("button",{type:"button",disabled:!v.trim(),onClick:()=>{D(o.output,o.file,v.trim()),u(`Prepared revision ${o.output.revision+1}.`,"success")},children:"Revise this version"})]})]}):U.length>0?e.jsx("div",{className:"work-output-list",children:U.map(t=>{const n=t.revisions.find(a=>a.revision===V[t.id])??t.revisions[0];return e.jsxs("article",{className:"work-output-card",children:[e.jsxs("header",{children:[e.jsx(y,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:n.title}),t.revisions.length>1?e.jsxs("label",{className:"work-output-version",children:[e.jsx("span",{children:"Version"}),e.jsx("select",{value:n.revision,onChange:a=>q(h=>({...h,[t.id]:Number(a.target.value)})),children:t.revisions.map(a=>e.jsxs("option",{value:a.revision,children:["Revision ",a.revision]},p(a)))})]}):e.jsxs("small",{children:["Revision ",n.revision]}),e.jsx("small",{children:ce(n)})]})]}),n.validation.length>0?e.jsxs("div",{className:"work-output-validation",children:[e.jsx(Y,{size:13}),e.jsxs("span",{children:[n.validation.filter(a=>a.status==="passed").length," ","checks passed"]})]}):null,e.jsxs("div",{className:"work-output-actions",children:[n.kind==="file"&&n.location.kind==="local"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>{_(M(n))},children:[e.jsx(W,{size:13}),"Reveal"]}),e.jsx("button",{type:"button",onClick:async()=>{const a=await te(M(n),n.title);a.ok?u("Saved a copy of the Work output.","success"):a.canceled||u("Could not save a copy of the Work output.","error")},children:"Save as"})]}):null,n.kind==="file"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{G(n)},children:"Preview"}),e.jsxs("button",{type:"button",disabled:j===p(n),onClick:()=>{H(n)},children:[e.jsx(E,{size:13}),"Use as input"]})]}):n.kind==="agent_package"?e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{Q(n)},children:"Add to Agents"}):"url"in n&&n.url?e.jsx("button",{type:"button",onClick:()=>window.open(n.url,"_blank","noopener,noreferrer"),children:"Open"}):null,n.kind==="file"&&n.location.kind==="local"?e.jsxs("button",{type:"button",className:"danger",disabled:j===p(n),onClick:()=>{J(n)},children:[e.jsx(ie,{size:13}),"Delete"]}):null,e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{z("chat",n)},children:"Continue in Chat"}),e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{z("work",n)},children:"Continue in repository Work"})]})]},t.id)})}):$.length>0?e.jsx("div",{className:"work-output-list",children:$.map(t=>e.jsxs("article",{className:"work-output-card",children:[e.jsxs("header",{children:[e.jsx(y,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:t.title}),e.jsx("small",{children:C(t.sizeBytes)})]})]}),e.jsx("div",{className:"work-output-actions",children:e.jsxs("button",{type:"button",onClick:()=>{_(t.path)},children:[e.jsx(W,{size:13}),"Reveal"]})})]},t.path))}):e.jsx(F,{icon:y,title:"No saved outputs yet",detail:"Finished files and connected results will appear here."}):null,k==="activity"?R.length>0?e.jsx("div",{className:"work-activity-list",children:R.map(t=>e.jsxs("details",{className:`work-activity-row ${t.state??""}`,children:[e.jsxs("summary",{children:[e.jsx(B,{size:14}),e.jsx("span",{children:t.label}),e.jsx("small",{children:t.state??"completed"})]}),e.jsx("p",{children:t.content}),t.detail?e.jsx("pre",{children:t.detail}):null]},t.id))}):e.jsx(F,{icon:B,title:"No activity yet",detail:"Commands, tool receipts, and checks appear while Work runs."}):null,k==="context"?e.jsxs("div",{className:"work-context",children:[e.jsxs("section",{children:[e.jsx("h3",{children:"Model context"}),e.jsx("p",{children:l.summary}),e.jsx("small",{children:l.tokensLabel})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Task inputs and sources"}),O.length>0?e.jsx("ul",{children:O.map(t=>e.jsxs("li",{children:[e.jsx(E,{size:13}),e.jsxs("span",{children:[e.jsx("strong",{children:t.title}),e.jsx("small",{children:t.detail})]})]},t.key))}):e.jsx("p",{children:"No attached files or cited sources yet."})]})]}):null]})]})}function se(i){return i.flatMap(r=>r.activities??[]).filter(r=>r.kind!=="reasoning").reverse()}function re(i){const r=new Map;for(const l of i)for(const s of l.activities??[])for(const c of s.artifacts??[])!c.path||c.sizeBytes===null||r.set(c.path,{path:c.path,title:c.title,sizeBytes:c.sizeBytes});return[...r.values()].sort((l,s)=>s.path.localeCompare(l.path))}function oe(i){const r=new Map,l=new Set;for(const s of i){const c=g(s.data);if(s.action==="work_output_delete"&&s.status==="completed"){for(const d of c){const u=p(d);l.add(u),r.delete(u)}continue}if(s.action!=="work_output_read")for(const d of c){const u=p(d);l.has(u)||r.set(u,d)}}return[...r.values()].sort((s,c)=>c.createdAt.localeCompare(s.createdAt)||c.revision-s.revision)}function p(i){return`${i.id}:${i.revision}`}function ae(i){const r=new Map;for(const l of i){const s=r.get(l.id)??[];s.push(l),r.set(l.id,s)}return[...r.entries()].map(([l,s])=>({id:l,revisions:s.sort((c,d)=>d.revision-c.revision||d.createdAt.localeCompare(c.createdAt))})).sort((l,s)=>s.revisions[0].createdAt.localeCompare(l.revisions[0].createdAt))}function g(i,r=[],l=new Set,s=0){if(s>8||i==null)return r;const c=Z.safeParse(i);if(c.success){const d=`${c.data.id}:${c.data.revision}`;return l.has(d)||(l.add(d),r.push(c.data)),r}if(Array.isArray(i)){for(const d of i)g(d,r,l,s+1);return r}if(typeof i=="object")for(const d of Object.values(i))g(d,r,l,s+1);return r}function le(i){const r=new Map;for(const l of i){for(const s of l.attachments??[])r.set(`attachment:${s.id}`,{key:`attachment:${s.id}`,title:s.name,detail:`${s.mediaType} · ${C(s.sizeBytes)}`});for(const s of l.sources??[])r.set(`source:${s.id}`,{key:`source:${s.id}`,title:s.title,detail:s.sourceName??ue(s.url)})}return[...r.values()]}function F({icon:i,title:r,detail:l}){return e.jsxs("div",{className:"work-sidebar-empty",children:[e.jsx(i,{size:22}),e.jsx("strong",{children:r}),e.jsx("p",{children:l})]})}function ce(i){return i.kind==="deployment"?"Deployment":i.kind==="source_change"?"Source change":i.kind==="external_resource"?i.provider:i.kind==="agent_package"?`${i.actions.length} action${i.actions.length===1?"":"s"}`:i.location.kind==="local"?C(i.sizeBytes):i.location.kind==="managed"?"Managed file":i.location.provider}function C(i){return i<1024?`${i} B`:i<1024*1024?`${Math.round(i/1024)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}function de(i){const r=window.atob(i),l=new ArrayBuffer(r.length),s=new Uint8Array(l);for(let c=0;c<r.length;c+=1)s[c]=r.charCodeAt(c);return l}function M(i){return i.kind==="file"&&i.location.kind==="local"?i.location.path:""}function ue(i){try{return new URL(i).hostname||i}catch{return i}}function pe(i){return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}export{Ce as WorkSidebarPanel,re as visibleChatFileArtifacts,se as visibleWorkActivities,oe as workOutputsFromEvents};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspaceMonacoEditor-BR4qxMgU.js","assets/index-BxWTVKtn.js","assets/index-dSmk3FLJ.css","assets/WorkspaceMonacoEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e,r,_ as xa}from"./index-BxWTVKtn.js";import{T as ba,F as ga,a as ja,M as va,f as ka,i as Os,h as wa,j as ya,e as Us,I as Sa}from"./MarkdownText-gJMuefaJ.js";import{c as be,q as rt,ax as Hs,as as on,a$ as Ee,G as z,bR as Ft,bn as Et,bl as Oe,an as ns,bS as Na,aU as Ca,bT as $a,aV as Ra,F as Fa,p as cn,i as Ea,X as Vs,P as Pa,aW as Aa,av as La,aw as Da,bK as Ta,bU as _a,al as Gs,bV as Ma,bb as za,bW as as,bX as Wa,bY as is,bZ as Ia,g as Ba,H as dn,E as Oa,b_ as Jt,b$ as Ua,c0 as ls,bu as Ce,c1 as Ha,c2 as Ks,c3 as Va,c4 as Ga,c5 as qs,c6 as Ka,c7 as qa}from"./App-CuhaCsfb.js";import{t as Xa,a as Za,b as Qa,m as Ya,s as Ja,d as ei,f as ti,c as si}from"./training-model-data-CKOkpBBL.js";import{F as St}from"./folder-open-sLZJxLQy.js";import{I as Xs}from"./info-Dc81lEfw.js";import{M as ni}from"./minimize-2-Bs7MVN3C.js";import{S as ai}from"./save-DpezrtH2.js";import{C as ii}from"./clipboard-BZzZ82Bk.js";const li=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],ri=be("text-align-start",li);const oi=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],ci=be("chevrons-up",oi);const di=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ui=be("columns-2",di);const fi=[["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"}]],pi=be("eye-off",fi);const hi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],mi=be("panel-top",hi);const xi=[["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"}]],bi=be("plug",xi);const gi=[["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"}]],ji=be("redo-2",gi);const vi=[["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"}]],ki=be("undo-2",vi);function wi({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(rt,{size:15,"aria-hidden":"true"}),e.jsx("span",{children:i})]}),e.jsx("span",{className:`goal-details-state ${Bi(t?.run.state??null)}`,children:u})]}),e.jsx("div",{className:"goal-details-body",children:t?e.jsx(yi,{runtime:t}):s||n?e.jsx(Ni,{goalRuntime:s,subagentRuntime:n,onRunSubagentLifecycleAction:a}):e.jsx(Ii,{})})]})}function yi({runtime:t}){const s=t.run,n=s.plan,a=Hs(n?.metadata)??Hs(s.metadata),i=s.questions,u=i.filter(o=>o.status==="pending"),c=s.sourceRefs,d=s.checkRefs,p=s.state,x=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(p)],["Operation",s.operation],["Target",Z(s.target.kind)],["Name",s.target.displayName??s.target.id??"Pending"],["Target ID",s.target.id??"Pending"],["Default action",x??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(b=>b.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(yt,{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(yt,{refs:n.checks.map(o=>({id:o.name,primary:o.name,secondary:`${o.required?"Required":"Optional"}: ${o.command}`}))})}):null,c.length||d.length?e.jsx(V,{title:"Run Refs",children:e.jsx(yt,{refs:[...c.map(o=>({id:`source:${o}`,primary:o,secondary:"Source ref"})),...d.map(o=>({id:`check:${o}`,primary:o,secondary:"Check ref"}))]})}):null,e.jsx(Si,{run:s}),s.blockedReason?e.jsx(V,{title:"Blocked",children:e.jsxs("div",{className:"goal-details-alert",children:[e.jsx(on,{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 Si({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(yt,{refs:[...s,...a]})})}function Ni({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(Ci,{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 Ci({runtime:t,onRunSubagentLifecycleAction:s}){const[n,a]=r.useState(null),[i,u]=r.useState(null);Ee(i);const c=async(d,p)=>{if(!s)return;const x=`${d}:${p}`;a(x),u(null);try{await s({runId:d,action:p})}catch(o){u(o instanceof Error?o.message:String(o))}finally{a(o=>o===x?null:o)}};return e.jsxs(e.Fragment,{children:[e.jsxs(V,{title:"Subagents",children:[e.jsx(it,{rows:[["Latest update",Li(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",Di(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(d=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${d.status}`,children:d.status}),e.jsxs("div",{children:[e.jsx("strong",{children:Nt(d.roleId)}),e.jsx("p",{children:d.message})]})]},`${d.runId}:${d.message}`))}):null,e.jsx("ul",{className:"goal-details-list",children:t.runs.slice(0,8).map(d=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${d.status}`,children:d.status}),e.jsxs("div",{children:[e.jsx("strong",{children:Nt(d.roleId)}),e.jsx("p",{children:d.objective}),d.report?.summary?e.jsx("small",{children:d.report.summary}):null,s?e.jsx(Ri,{pendingAction:n,run:d,onRun:c}):null]})]},d.id))})]}),t.finalResults.length>0?e.jsx($i,{results:t.finalResults}):null]})}function $i({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:Nt(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: ",$e(s.findings,3)]}):null,s.changedFiles.length>0?e.jsxs("small",{children:["Files: ",$e(s.changedFiles,4)]}):null,s.testsRun.length>0?e.jsxs("small",{children:["Tests: ",$e(s.testsRun,3)]}):null,s.validationAttempts.length>0?e.jsxs("small",{children:["Validation: ",$e(s.validationAttempts,2)]}):null,s.refs.length>0?e.jsxs("small",{children:["Refs: ",$e(s.refs.map(Ti),4)]}):null,s.blockers.length>0?e.jsxs("small",{children:["Blockers: ",$e(s.blockers,3)]}):null,s.workspaceRetention?e.jsxs("small",{children:["Workspace: ",Mi(s.workspaceRetention)]}):null,s.importantMessages.length>0?e.jsxs("small",{children:["Messages: ",$e(s.importantMessages.map(_i),2)]}):null]},s.runId))})})}function Ri({pendingAction:t,run:s,onRun:n}){const a=Fi(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...":Ei(i)},i)})})}function Fi(t){const s=[],n=Pi(t),a=Ai(t);return n&&s.push("cleanup"),a&&s.push("archive"),s}function Ei(t){return t==="cleanup"?"Clean":t==="archive"?"Archive":"Clean + archive"}function Pi(t){if(!un(t))return!1;const s=lt(t.metadata);if(!s?.subagentWorkspace&&!s?.workspaceHandoff)return!1;const n=lt(s.lifecycleCleanup),a=lt(n?.workspaceCleanup),i=fn(a?.status);return i!=="removed"&&i!=="deleted"&&i!=="retained"&&i!=="skipped"}function Ai(t){if(!t.childSessionId||!un(t))return!1;const s=lt(lt(t.metadata)?.childSessionArchive),n=fn(s?.status);return n!=="archived"&&n!=="already_archived"}function un(t){return t.status==="completed"||t.status==="failed"||t.status==="cancelled"}function Li(t){const s=t.latestMeaningfulUpdate;return s?`${Nt(s.roleId)} ${s.status}: ${s.message}`:"No structured update"}function Di(t,s){if(t<=0&&s<=0)return"0 tokens";const n=`${s} ${s===1?"request":"requests"}`;return`${zi(t)} tokens · ${n}`}function Nt(t){return t.slice(0,1).toUpperCase()+t.slice(1).replace(/[-_]+/g," ")}function Ti(t){return`${t.kind}: ${t.label}`}function _i(t){return`${Z(t.kind)}: ${t.body}`}function Mi(t){const s=t.expiresAt?`until ${Wi(t.expiresAt)}`:"for inspection",n=t.trigger?` · ${Z(t.trigger)}`:"";return`retained ${s}${n}`}function $e(t,s){const n=t.slice(0,s),a=t.length-n.length;return a>0?`${n.join(", ")} +${a}`:n.join(", ")}function zi(t){if(t<1e3)return String(t);if(t>=1e6){const n=t/1e6;return`${Zs(n,n<10?2:1)}M`}const s=t/1e3;return`${Zs(s,s<10?1:0)}k`}function Wi(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Zs(t,s){return t.toFixed(s).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")}function Ii(){return e.jsxs("div",{className:"goal-details-empty",children:[e.jsx(rt,{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 yt({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 lt(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function fn(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 Bi(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 Oi({sandboxId:t,connection:s}){const[n,a]=r.useState(null),[i,u]=r.useState([]),[c,d]=r.useState(null),[p,x]=r.useState(null),[o,b]=r.useState(null),[S,k]=r.useState(null);Ee(o,{prefix:"Sandbox"}),Ee(S,{prefix:"Sandbox integrations"});const N=n?.integrationLeases??[],F=r.useMemo(()=>i.filter(v=>v.status==="active"),[i]),_=r.useMemo(()=>Hi(n),[n]),W=r.useCallback(async()=>{if(!s){b("OpenPond App server is not connected.");return}if(!t){a(null),u([]),b(null);return}d("summary"),b(null);try{const v=await z.sandbox(s,t),R=await z.integrationConnections(s,Qs(v.sandbox));a(v.sandbox),u(R.connections),k(null)}catch(v){b(v instanceof Error?v.message:String(v))}finally{d(null)}},[s,t]),G=r.useCallback(async()=>{if(!(!s||!n)){x("load"),k(null);try{const[v,R]=await Promise.all([z.integrationConnections(s,Qs(n)),z.sandboxIntegrationLeases(s,n.id)]);u(v.connections),a(R.sandbox)}catch(v){k(v instanceof Error?v.message:String(v))}finally{x(null)}}},[s,n]),H=r.useCallback(async v=>{if(!s||!n)return;const R=Ft(v.provider),D=R?Et(R):null,M=D?.leasePolicy.allowedCapabilityIds??[];if(!R||!D?.leasePolicy.leaseable||M.length===0){k(`${ie(v.provider)} cannot be attached to this sandbox.`);return}x(`attach:${v.id}`),k(null);try{const E=await z.attachSandboxIntegrationConnection(s,n.id,{connectionId:v.id,provider:v.provider,capabilities:M,...v.scopes.length>0?{scopes:v.scopes}:{},...D.leasePolicy.defaultTtlSeconds?{ttlSeconds:D.leasePolicy.defaultTtlSeconds}:{},required:!1});a(E.sandbox)}catch(E){k(E instanceof Error?E.message:String(E))}finally{x(null)}},[s,n]),I=r.useCallback(async v=>{if(!(!s||!n)){x(`remove:${v}`),k(null);try{const R=await z.removeSandboxIntegrationLease(s,n.id,v);a(R.sandbox)}catch(R){k(R instanceof Error?R.message:String(R))}finally{x(null)}}},[s,n]);return r.useEffect(()=>{W()},[W]),t?e.jsxs("div",{className:"sandbox-summary-tab",children:[e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Sandbox"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[n?e.jsx("span",{children:n.state}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh summary","aria-label":"Refresh summary",disabled:c!==null,onClick:()=>{W()},children:c==="summary"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(ns,{size:14})})]})]}),n?e.jsxs("dl",{className:"sandbox-workspace-kv",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Sandbox"}),e.jsx("dd",{children:Ys(n.id)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Spend"}),e.jsxs("dd",{children:[es(n.reservation.capturedUsd)," / ",es(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:pn(n.updatedAt)})]}),_?e.jsxs("div",{children:[e.jsx("dt",{children:"Receipt"}),e.jsxs("dd",{children:[Ys(_.id)," / ",es(_.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:p!==null||!n,onClick:()=>{G()},children:p==="load"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(ns,{size:14})})]})]}),N.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:N.map(v=>e.jsxs("div",{className:"sandbox-workspace-integration-row",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:ie(v.provider)}),e.jsxs("small",{children:[v.required?"required":"optional"," / ",Ki(v)," / ",Ui(v)]})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:`Revoke ${ie(v.provider)} lease`,"aria-label":`Revoke ${ie(v.provider)} lease`,disabled:p!==null,onClick:()=>{I(v.leaseId)},children:p===`remove:${v.leaseId}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(ba,{size:14})}),e.jsxs("div",{className:"sandbox-workspace-chip-row",children:[v.capabilities.slice(0,5).map(R=>e.jsx("span",{children:Gi(v.provider,R)},R)),v.capabilities.length>5?e.jsxs("span",{children:["+",v.capabilities.length-5]}):null]})]},v.leaseId))}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No active integration leases."}),F.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:F.map(v=>{const R=N.some(E=>E.provider===v.provider),M=Vi(v)?.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:qi(v)}),e.jsx("small",{children:Xi(v,M)})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:R?`${ie(v.provider)} already attached`:`Attach ${ie(v.provider)}`,"aria-label":R?`${ie(v.provider)} already attached`:`Attach ${ie(v.provider)}`,disabled:R||p!==null||M===0,onClick:()=>{H(v)},children:p===`attach:${v.id}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(bi,{size:14})})]},v.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 Qs(t){return{status:"active"}}function Ui(t){return t.proxyUrl?"runtime proxy available":"metadata only, no runtime proxy"}function Hi(t){return t?.receipts?.at(-1)??null}function Vi(t){const s=Ft(t.provider);return s?Et(s):null}function ie(t){const s=Ft(t),n=s?Et(s):null;return n?n.label:t==="microsoft_teams"?"Microsoft Teams":t?t.replace(/_/g," "):"Integration"}function Gi(t,s){const n=Ft(t);return(n?Et(n):null)?.capabilities.find(i=>i.id===s)?.label??s}function Ki(t){return t.expiresAt?`expires ${pn(t.expiresAt)}`:"active"}function qi(t){const s=t.providerAccountName?.trim();return s?`${ie(t.provider)} / ${s}`:ie(t.provider)}function Xi(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 Ys(t){return t.length>10?`${t.slice(0,8)}...`:t}function pn(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 es(t){const s=Number(t??0);return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:s>=10?2:4}).format(Number.isFinite(s)?s:0)}function Zi({summary:t}){const s=Xa(t.taskset),n=t.taskset.learningSignals.demonstrations.filter(d=>d.approved).length,a=t.taskset.tasks.filter(d=>d.split==="frozen_eval").length,i=t.plan?.recipe.method==="sft"||t.plan?.recipe.method==="grpo"?t.plan.recipe:null,u=Za(t.taskset,t.plan),c=t.job?Qa(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:Ya(t.taskset.name)}),e.jsx("span",{children:t.job?Ja(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(U,{label:"Primary recommendation",value:s.toUpperCase()}),e.jsx(U,{label:"Training stage",value:u}),e.jsx(U,{label:"Base model",value:i?.baseModel.id??"Not selected"}),e.jsx(U,{label:"Compute",value:t.plan?ei(t.plan.destinationId):"Not selected"}),e.jsx(U,{label:"Started",value:ti(t.job?.startedAt??null)}),e.jsx(U,{label:"Duration",value:si(t.job?.startedAt??null,c)})]})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Data"}),e.jsxs("dl",{children:[e.jsx(U,{label:"Training examples",value:String(n)}),e.jsx(U,{label:"Test examples",value:String(a)}),e.jsx(U,{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(U,{label:"RL loss",value:i.loss.method==="gspo-token"?"GSPO-token":i.loss.method.toUpperCase()}):null,e.jsx(U,{label:"LoRA rank",value:String(i.lora.rank)}),e.jsx(U,{label:"Learning rate",value:String(i.optimizer.learningRate)}),e.jsx(U,{label:"Optimizer steps",value:String(i.optimizer.maxSteps)}),e.jsx(U,{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(U,{label:"Adapter",value:t.lineage?`${u} ready`:"Not created"}),e.jsx(U,{label:"Evaluation",value:t.lineage?.frozenEvaluationArtifactId?"Completed":"Not completed"}),e.jsx(U,{label:"Artifacts",value:String(t.artifacts.length)})]})]})]})}function U({label:t,value:s}){return e.jsxs("div",{children:[e.jsx("dt",{children:t}),e.jsx("dd",{children:s})]})}function Qi(t){const s=Js("","","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 d=0;d<i.length;d+=1){const p=i[d];c=c?`${c}/${p}`:p;const x=!a&&d===i.length-1?"file":"folder",o=`${x}:${p}`;let b=u.childMap.get(o);b||(b=Js(p,c,x),u.childMap.set(o,b),u.children.push(b)),u=b}}return hn(s.children)}function Js(t,s,n){return{name:t,path:s,type:n,children:[],childMap:new Map}}function hn(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:hn(s.children)}))}function rs({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(Na,{size:14}):e.jsx(Ca,{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($a,{size:14}):e.jsx(Ra,{size:14})})]})}function Yi({changedByPath:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:d,onToggleFolder:p}){const x=r.useMemo(()=>Qi(a),[a]);return e.jsxs("div",{className:"workspace-file-tree-view",children:[e.jsxs("div",{className:"workspace-file-tree-header",children:[e.jsx(St,{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:x.map(o=>e.jsx(mn,{changedByPath:t,expandedFolderPaths:s,node:o,rootPath:n,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:d,onToggleFolder:p},`${o.type}:${o.path}`))})]})}function mn({changedByPath:t,depth:s=0,expandedFolderPaths:n,node:a,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:d,onSetFileBookmarkStatus:p,onToggleFolder:x}){const o=i?`${i}/${a.path}`:a.path,b=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":b,style:{paddingLeft:k},onClick:()=>x(o),children:[b?e.jsx(St,{size:14}):e.jsx(Fa,{size:14}),e.jsx("span",{children:a.name})]}),b&&a.children.map(N=>e.jsx(mn,{changedByPath:t,depth:s+1,expandedFolderPaths:n,node:N,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:d,onSetFileBookmarkStatus:p,onToggleFolder:x},`${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:()=>d(o),children:[e.jsx(ga,{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]})]})]}),/\.html?$/i.test(o)&&e.jsx("button",{type:"button",className:"workspace-file-tree-bookmark-actions",title:"View source","aria-label":`View source for ${a.name}`,onClick:()=>d(o,{source:!0}),children:"</>"}),p?e.jsx(rs,{className:"workspace-file-tree-bookmark-actions",currentStatus:c?.(o)??null,onSetStatus:N=>p(o,N)}):null]})}function en({diff:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:d,onToggleFolder:p}){const x=t?.files??[],o=r.useMemo(()=>new Map(x.map(k=>[k.path,k])),[x]),b=n?.replace(/^\/+|\/+$/g,"")||null,S=r.useMemo(()=>{if(!b)return a;const k=`${b}/`;return a.filter(N=>N.startsWith(k)).map(N=>N.slice(k.length)).filter(Boolean)},[b,a]);return e.jsx("div",{className:"workspace-diff-files-view",children:e.jsx(Yi,{changedByPath:o,expandedFolderPaths:s,rootPath:b,repoFiles:S,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:d,onToggleFolder:p})})}function Ji({collapsed:t,editorControlsVisible:s,hideWhiteSpace:n,loadFullFiles:a,renderMarkdown:i,wordDiffs:u,wordWrap:c,onClose:d,onCopyGitApply:p,onRefresh:x,onToggleCollapsed:o,onToggleEditorControlsVisible:b,onToggleHideWhiteSpace:S,onToggleLoadFullFiles:k,onToggleRenderMarkdown:N,onToggleWordDiffs:F,onToggleWordWrap:_}){return e.jsxs("div",{className:"workspace-diff-options-menu",role:"menu",children:[e.jsx(de,{icon:e.jsx(ns,{size:14}),label:"Refresh",onClick:x,onClose:d}),e.jsx(de,{checked:c,icon:e.jsx(ja,{size:14}),label:"Enable word wrap",onClick:_,onClose:d}),e.jsx(de,{checked:t,icon:e.jsx(ci,{size:14}),label:"Collapse all diffs",onClick:o,onClose:d}),e.jsx("div",{className:"workspace-diff-menu-divider"}),e.jsx(de,{checked:s,icon:e.jsx(mi,{size:14}),label:"Show editor controls",onClick:b,onClose:d}),e.jsx(de,{checked:i,icon:e.jsx(cn,{size:14}),label:"Render Markdown",onClick:N,onClose:d}),e.jsx(de,{checked:!a,icon:e.jsx(rt,{size:14}),label:"Show diffs first",onClick:k,onClose:d}),e.jsx(de,{checked:u,icon:e.jsx(ri,{size:14}),label:"Enable word diffs",onClick:F,onClose:d}),e.jsx(de,{checked:n,icon:e.jsx(pi,{size:14}),label:"Hide white space",onClick:S,onClose:d}),e.jsx(de,{icon:e.jsx(ii,{size:14}),label:"Copy git apply command",onClick:p,onClose:d})]})}function de({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(Ea,{size:14})]})}function el({addMenuOpen:t,expanded:s,filteredFiles:n,dirtyFilePaths:a,openFiles:i,goalDetailsAvailable:u,searchOpen:c,searchQuery:d,selectedPath:p,sideChatTabs:x=[],summaryAvailable:o,sourceStatus:b,sourceSwitcher:S,visibleTab:k,getFileBookmarkStatus:N,onCloseFileTab:F,onCloseSideChat:_,onCloseSearch:W,onOpenFile:G,onOpenBrowser:H,onOpenSearch:I,onOpenSideChat:v,onSearchQueryChange:R,onSetFileBookmarkStatus:D,onSelectFile:M,onSelectFiles:E,onSelectGoal:te,onSelectSummary:q,onSelectSideChat:X,onToggleAddMenu:B,onToggleExpanded:Q}){const se=r.useRef(null);r.useEffect(()=>{if(!t&&!c)return;function w(){t&&B(),c&&W()}function O(T){se.current?.contains(T.target)||w()}function A(T){T.key==="Escape"&&w()}return document.addEventListener("pointerdown",O),document.addEventListener("keydown",A),()=>{document.removeEventListener("pointerdown",O),document.removeEventListener("keydown",A)}},[t,W,B,c]);function Y(w){if(w.key==="Escape"){W();return}w.key==="Enter"&&n[0]&&G(n[0])}function re(w){if(!["ArrowRight","ArrowLeft","Home","End"].includes(w.key))return;const O=w.target;if(!(O instanceof HTMLButtonElement)||O.getAttribute("role")!=="tab")return;const A=Array.from(w.currentTarget.querySelectorAll('button[role="tab"]')),T=A.indexOf(O);if(T<0||A.length===0)return;w.preventDefault();const Pt=Ma(T,A.length,w.key),Pe=A[Pt];if(!Pe)return;Pe.focus(),Pe.click();const ot=Pe.id;ot&&window.requestAnimationFrame(()=>document.getElementById(ot)?.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:re,children:[u?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="goal"?"active":""}`,role:"tab","aria-selected":k==="goal",onClick:te,children:[e.jsx(rt,{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(Xs,{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:E,children:[e.jsx(St,{size:14}),e.jsx("span",{children:"Files"})]}),i.map(w=>e.jsxs("div",{className:`workspace-diff-tab file ${k==="file"&&p===w.path?"active":""}`,children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab","aria-selected":k==="file"&&p===w.path,title:w.path,onClick:()=>M(w.path),children:[e.jsx(rt,{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()})]}),D?e.jsx(rs,{className:"workspace-diff-tab-bookmark-actions",currentStatus:N?.(w.path)??null,onSetStatus:O=>D(w.path,O)}):null,e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${w.path}`,onClick:O=>F(w.path,O),children:e.jsx(Vs,{size:12})})]},w.path)),x.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:()=>X?.(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:O=>{O.stopPropagation(),_(w.id)},children:e.jsx(Vs,{size:12})}):null]},w.id)),e.jsxs("div",{className:"workspace-diff-add-anchor",ref:se,children:[e.jsx("button",{type:"button",className:`workspace-diff-add-tab ${t||c?"active":""}`,title:"Add","aria-label":"Add to right sidebar",onClick:B,children:e.jsx(Pa,{size:15})}),t&&e.jsxs("div",{className:"workspace-diff-add-menu",role:"menu",children:[v?e.jsxs("button",{type:"button",role:"menuitem",onClick:v,children:[e.jsx(Aa,{size:14}),e.jsx("span",{children:"New task"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:E,children:[e.jsx(St,{size:14}),e.jsx("span",{children:"Files"}),e.jsx("kbd",{})]}),o&&q?e.jsxs("button",{type:"button",role:"menuitem",onClick:q,children:[e.jsx(Xs,{size:14}),e.jsx("span",{children:"Summary"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:I,children:[e.jsx(La,{size:14}),e.jsx("span",{children:"Open file"}),e.jsx("kbd",{children:"Ctrl+P"})]}),H?e.jsxs("button",{type:"button",role:"menuitem",onClick:H,children:[e.jsx(Da,{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:d,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||b?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,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:Q,children:s?e.jsx(ni,{size:14}):e.jsx(Ta,{size:14})})]})}function tl({canCheckActiveFile:t,canSaveActiveFile:s,collapsed:n,editorControlsVisible:a,editorDiagnosticStatus:i,editorDiagnosticsChecking:u,hideWhiteSpace:c,loadFullFiles:d,menuOpen:p,renderMarkdown:x,showEditorCommandBar:o,showRenderMarkdownToggle:b,splitView:S,wordDiffs:k,wordWrap:N,onCopyGitApply:F,onEditorCheck:_,onEditorRedo:W,onEditorSave:G,onEditorUndo:H,onRefresh:I,onToggleCollapsed:v,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:D,onToggleLoadFullFiles:M,onToggleMenu:E,onToggleRenderMarkdown:te,onToggleSplitView:q,onToggleWordDiffs:X,onToggleWordWrap:B}){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":p,onClick:()=>E(),children:e.jsx(_a,{size:15})}),p&&e.jsx(Ji,{collapsed:n,editorControlsVisible:a,hideWhiteSpace:c,loadFullFiles:d,renderMarkdown:x,wordDiffs:k,wordWrap:N,onClose:()=>E(!1),onCopyGitApply:F,onRefresh:I,onToggleCollapsed:v,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:D,onToggleLoadFullFiles:M,onToggleRenderMarkdown:te,onToggleWordDiffs:X,onToggleWordWrap:B})]}),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(ai,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Undo","aria-label":"Undo",onClick:H,children:e.jsx(ki,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Redo","aria-label":"Redo",onClick:W,children:e.jsx(ji,{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(Gs,{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(on,{size:13}):e.jsx(Gs,{size:13}),e.jsx("span",{children:i.label})]})]}),b&&e.jsx("button",{type:"button",className:`diff-icon-button ${x?"active":""}`,title:x?"Show Markdown source":"Render Markdown","aria-label":x?"Show Markdown source":"Render Markdown","aria-pressed":x,onClick:te,children:e.jsx(cn,{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(ui,{size:14})})]})})}const sl={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 os(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 sl[n]??"text"}function nl(t,s){return t?s==="markdown"?al(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 al(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 il(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:il(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 Ct({language:t,text:s}){return e.jsx(e.Fragment,{children:nl(s,t).map((n,a)=>e.jsx("span",{className:`syntax-token ${n.kind}`,children:n.text},`${a}-${n.text}`))})}function ll({path:t,contentBase64:s}){const n=t.replace(/\\/g,"/").split("/").pop()||"document",a=r.useMemo(()=>{try{const d=atob(s.replace(/\s/g,"")),p=Uint8Array.from(d,x=>x.charCodeAt(0));return new Blob([p],{type:rl(t)})}catch{return null}},[s,t]),[i,u]=r.useState(null);r.useEffect(()=>{if(!a)return;const d=URL.createObjectURL(a);return u({blob:a,url:d}),()=>URL.revokeObjectURL(d)},[a]);const c=i?.blob===a?i.url:null;return a?c?e.jsxs("div",{className:"workspace-document-preview",children:[e.jsxs("div",{className:"workspace-document-preview-card",children:[e.jsx("strong",{children:n}),e.jsx("span",{children:/\.pdf$/i.test(t)?"PDF document":"Word document"}),e.jsx("a",{href:c,download:n,"aria-label":"Download document",title:"Download document",children:e.jsx(za,{size:16,"aria-hidden":"true"})})]}),e.jsx("iframe",{src:c,title:`${t} preview`})]}):e.jsx("div",{className:"workspace-diff-code-empty",role:"status",children:"Loading document…"}):e.jsx("div",{className:"workspace-diff-code-empty",children:"Document preview unavailable."})}function rl(t){return/\.pdf$/i.test(t)?"application/pdf":/\.docx$/i.test(t)?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"application/msword"}const ol=`
|
|
3
|
+
|
|
4
|
+
[file truncated]`,cl=r.lazy(()=>xa(()=>import("./WorkspaceMonacoEditor-BR4qxMgU.js").then(t=>t.jc),__vite__mapDeps([0,1,2,3]))),ts=6,dl=18,Re=22,tn=44,ul=160,sn=12;function $t({path:t,workspaceName:s,workspaceRootPath:n,onSelectPath:a}){const i=is(t,n),u=Ia(i),c=u?fl(i):s?.trim()||"Workspace",p=(u&&c!=="/"&&i.startsWith(`${c}/`)?i.slice(c.length+1):i).split("/").filter(Boolean),x=!!(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}),p.map((o,b)=>{const S=b===p.length-1,k=p.slice(0,b+1).join("/");return e.jsxs("span",{className:"workspace-file-breadcrumb-segment",children:[e.jsx(Ba,{size:13}),a&&x&&!S?e.jsx("button",{type:"button",onClick:()=>a(k),children:o}):e.jsx("span",{children:o})]},`${b}-${o}`)})]})}function fl(t){const s=/^[A-Za-z]:\//.exec(t);return s?s[0].slice(0,-1):"/"}function pl({collapsed:t=!1,diagnostics:s=[],draftContent:n,editable:a=!1,editorRef:i,error:u,file:c,hideWhiteSpace:d=!1,headerActions:p,imageSrc:x,loading:o,loadFullFiles:b,onOpenImage:S,onSelectBreadcrumbPath:k,onDraftContentChange:N,onLspAction:F,onSave:_,renderMarkdown:W,saveError:G,saving:H=!1,splitView:I=!1,wordDiffs:v=!1,wordWrap:R,workspaceName:D,workspaceRootPath:M}){Ee(u,{prefix:"File preview"}),Ee(G,{prefix:"Save failed"});const E=n??c.content??"",te=r.useMemo(()=>E.split(`
|
|
5
|
+
`).slice(0,800),[E]),q=os(c.path),X=n!=null||c.content!=null,B=E.endsWith(ol),Q=W&&X&&as(c.path),se=X&&Wa(c.path)&&xl(E);return x?e.jsxs("div",{className:"workspace-file-preview",children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx($t,{path:c.path,workspaceName:D,workspaceRootPath:M,onSelectPath:k}),e.jsxs("span",{className:"diff-addition",children:["+",c.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",c.deletions]})]}),p]}),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:x})})})]}):!b&&c.patch||!X&&c.patch?I?e.jsx(ml,{collapsed:t,file:c,hideWhiteSpace:d,onSelectBreadcrumbPath:k,wordDiffs:v,wordWrap:R,headerActions:p,workspaceName:D,workspaceRootPath:M}):e.jsx(hl,{collapsed:t,file:c,hideWhiteSpace:d,wordWrap:R,workspaceName:D,workspaceRootPath:M,onSelectBreadcrumbPath:k,headerActions:p}):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($t,{path:c.path,workspaceName:D,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:[H?e.jsx("span",{className:"workspace-file-save-state",children:"Saving"}):null,p]})]}),X?Q?e.jsx("div",{className:"workspace-markdown-preview",children:e.jsx(va,{content:E})}):se?e.jsx(ll,{path:c.path,contentBase64:E}):a&&!B?e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"workspace-diff-code-empty",children:"Loading editor"}),children:e.jsx(cl,{diagnostics:s,filePath:c.path,onChange:Y=>N?.(Y),onLspAction:F,onSave:()=>_?.(),ref:i,value:E,wordWrap:R})}):e.jsx("div",{className:"workspace-file-code",children:te.map((Y,re)=>e.jsxs("div",{className:"workspace-file-code-row",children:[e.jsx("span",{children:re+1}),e.jsx("code",{children:e.jsx(Ct,{language:q,text:Y||" "})})]},`${re}-${Y}`))}):e.jsx("div",{className:"workspace-diff-code-empty",children:o?"Loading file content":"No file content available."})]})}function hl({collapsed:t=!1,file:s,hideWhiteSpace:n=!1,wordWrap:a,workspaceName:i,workspaceRootPath:u,onSelectBreadcrumbPath:c,headerActions:d}){const p=r.useMemo(()=>bn(s.patch,n),[s.patch,n]),x=os(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($t,{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]})]}),d]}),t?e.jsx("div",{className:"workspace-diff-code-empty",children:"Diff collapsed"}):e.jsx(xn,{ariaLabel:`${s.path} diff`,className:"workspace-diff-code",emptyMessage:"No patch available.",rows:p,renderRow:(o,b)=>o.kind==="spacer"?e.jsx("div",{className:"workspace-diff-spacer",role:"row",children:o.label},`${o.label}-${b}`):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(Ct,{language:x,text:o.newContent||o.oldContent||" "})})]},`${o.oldLine}-${o.newLine}-${b}`),wordWrap:a})]})}function ml({collapsed:t,file:s,hideWhiteSpace:n,wordDiffs:a,wordWrap:i,workspaceName:u,workspaceRootPath:c,onSelectBreadcrumbPath:d,headerActions:p}){const x=r.useMemo(()=>bn(s.patch,n),[s.patch,n]),o=os(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($t,{path:s.path,workspaceName:u,workspaceRootPath:c,onSelectPath:d}),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:[p,e.jsx(ka,{size:14})]})]}),t?e.jsx("div",{className:"workspace-diff-code-empty",children:"Diff collapsed"}):e.jsx(xn,{ariaLabel:`${s.path} split diff`,className:"workspace-split-code",emptyMessage:"No patch available.",rows:x,renderRow:(b,S)=>b.kind==="spacer"?e.jsx("div",{className:"workspace-diff-spacer split",role:"row",children:b.label},`${b.label}-${S}`):e.jsxs("div",{className:`workspace-split-row ${b.kind}`,role:"row",children:[e.jsx("span",{className:"workspace-diff-line-number old",role:"cell",children:b.oldLine}),e.jsx("code",{className:"old",role:"cell",children:e.jsx(Ct,{language:o,text:b.oldContent||" "})}),e.jsx("span",{className:"workspace-diff-line-number new",role:"cell",children:b.newLine}),e.jsx("code",{className:"new",role:"cell",children:e.jsx(Ct,{language:o,text:b.newContent||" "})})]},`${b.oldLine}-${b.newLine}-${S}`),wordWrap:i})]})}function xl(t){return t.length>0&&/^[A-Za-z0-9+/=\s]+$/.test(t)}function xn({ariaLabel:t,className:s,emptyMessage:n,rows:a,renderRow:i,wordWrap:u}){const c=!u&&a.length>ul,{endIndex:d,offsetTop:p,scrollRef:x,startIndex:o,totalHeight:b}=bl(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:x,role:"table","aria-label":t,"aria-rowcount":a.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(${p}px)`},children:a.slice(o,d).map((S,k)=>i(S,o+k))})})}):e.jsx("div",{className:s,role:"table","aria-label":t,children:a.map(i)})}function bl(t,s){const n=r.useRef(null),[a,i]=r.useState({height:Re*tn,scrollTop:0}),u=r.useCallback(()=>{const x=n.current;x&&i({height:x.clientHeight||Re*tn,scrollTop:x.scrollTop})},[]);if(r.useEffect(()=>{if(!s)return;const x=n.current;if(!x)return;u();let o=0;const b=()=>{if(typeof window>"u"){u();return}window.cancelAnimationFrame(o),o=window.requestAnimationFrame(u)};x.addEventListener("scroll",b,{passive:!0});const S=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>b());return S?.observe(x),()=>{x.removeEventListener("scroll",b),S?.disconnect(),typeof window<"u"&&window.cancelAnimationFrame(o)}},[s,u]),!s)return{endIndex:t,offsetTop:0,scrollRef:n,startIndex:0,totalHeight:t*Re};const c=Math.ceil(a.height/Re),d=Math.max(0,Math.floor(a.scrollTop/Re)-sn);return{endIndex:Math.min(t,d+c+sn*2),offsetTop:d*Re,scrollRef:n,startIndex:d,totalHeight:t*Re}}function bn(t,s){if(!t.trim())return[];const n=[];let a=0,i=0,u=null,c=null,d=!1,p=[];function x(){n.push(...gl(p)),p=[]}function o(){d&&(x(),u=a,c=i,d=!1)}for(const b of t.split(`
|
|
6
|
+
`)){const S=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(b);if(S){o();const F=Number(S[1]),_=Number(S[2]);if(u!==null&&c!==null){const W=Math.max(F-u,_-c,0);W>0&&n.push({kind:"spacer",label:gn(W)})}a=F,i=_,d=!0;continue}if(b.startsWith("diff --git")||b.startsWith("index ")||b.startsWith("--- ")||b.startsWith("+++ ")||!d||b.startsWith("\\ No newline"))continue;const k=b.slice(1)||" ";if(s&&!k.trim())continue;if(b.startsWith("+")){x(),n.push({kind:"addition",oldLine:"",newLine:String(i||""),oldContent:"",newContent:k}),i+=1;continue}if(b.startsWith("-")){x(),n.push({kind:"deletion",oldLine:String(a||""),newLine:"",oldContent:k,newContent:""}),a+=1;continue}const N=b.startsWith(" ")?b.slice(1)||" ":b||" ";s&&!N.trim()||(p.push({kind:"context",oldLine:String(a||""),newLine:String(i||""),oldContent:N,newContent:N}),a+=1,i+=1)}return o(),n}function gl(t){if(t.length<dl)return t;const s=t.length-ts*2;return s<=0?t:[...t.slice(0,ts),{kind:"spacer",label:gn(s)},...t.slice(-ts)]}function gn(t){return`${t} unmodified ${t===1?"line":"lines"}`}const Rt=`
|
|
7
|
+
|
|
8
|
+
[file truncated]`,jl="openpond.sandboxSourceReadback.v1";async function vl(t,s,n,a=[]){let i;try{i=await z.sandboxDownloadFile(t,s,n,{maxBytes:256*1024})}catch(c){const d=c instanceof Error?c.message:String(c);if(!kl(d))throw c;const p=Sl(a,s,n);if(p)return p;const x=!!cs(a,s)?.artifact,o=await z.sandbox(t,s).catch(()=>null);throw new Error(wl(n,o?.sandbox??null,d,{hasReadbackArtifact:x}))}const u=i.file.isBinary?i.file.contentsBase64||null:`${i.contents}${i.file.truncated?Rt:""}`;return{path:i.file.path,status:"",additions:0,deletions:0,patch:"",content:u}}function kl(t){return t.includes("sandbox_not_ready")&&t.includes("placement_stale")||t.includes("sandbox_not_running")}function wl(t,s,n="sandbox_not_ready:placement_stale",a={}){const i=s?Nl(s):null,u=t||"this file";if(a.hasReadbackArtifact)return`Sandbox file content is unavailable because the stopped runtime placement is stale. The latest source checkpoint has a saved readback artifact, but ${u} was not captured as text. Resume the sandbox to inspect it. ${n}`;if(!i)return`Sandbox file content is unavailable because the stopped runtime placement is stale. Resume the sandbox to inspect ${u}. ${n}`;const c=i.preservedSha?i.preservedSha.slice(0,12):null,d=i.sourceRef?` (${i.sourceRef})`:"";return`Sandbox file content is unavailable because the stopped runtime placement is stale. The latest source checkpoint is saved${c?` at ${c}`:""}${d}, but this Desktop app cannot read file bodies from preserved source refs yet. Resume the sandbox to inspect ${u}.`}function yl(t,s){if(!s)return null;const n=cs(t,s);if(!n)return null;const a=vn(n.artifact),i=new Map;for(const d of ds(a))i.set(d.path,d);for(const d of kn(n.artifact)){const p=jn(n.artifact,d.path);p&&i.set(d.path,p)}const u=[...i.values()].sort((d,p)=>d.path.localeCompare(p.path)),c=[...new Set(u.map(d=>d.path))].sort((d,p)=>d.localeCompare(p));return{appId:s,repoPath:"",initialized:!0,dirty:!1,filesChanged:u.length,additions:u.reduce((d,p)=>d+p.additions,0),deletions:u.reduce((d,p)=>d+p.deletions,0),repoFiles:c,files:u,error:null,updatedAt:Ue(le(n.artifact)?.createdAt)??n.event.timestamp}}function Sl(t,s,n){if(!s)return null;const a=cs(t,s);return a?jn(a.artifact,n):null}function cs(t,s){for(let n=t.length-1;n>=0;n-=1){const a=t[n];if(a?.name!=="workspace_action_result")continue;const i=le(a.data),u=le(i?.sourcePreservation),c=le(u?.sourceReadbackArtifact);if(c&&c.schemaVersion===jl&&c.sandboxId===s)return{artifact:c,event:a}}return null}function jn(t,s){const n=ds(vn(t)).find(u=>u.path===s),a=kn(t).find(u=>u.path===s);if(!n&&!a)return null;const i=typeof a?.content=="string"?`${a.content}${a.truncated?Rt:""}`:null;return{path:a?.path??n?.path??s,status:n?.status??"M",additions:n?.additions??0,deletions:n?.deletions??0,patch:n?.patch??"",content:i}}function vn(t){const s=le(t.patch);return typeof s?.text=="string"?s.text:""}function kn(t){return(Array.isArray(t.files)?t.files:[]).map(n=>{const a=le(n),i=Ue(a?.path);return i?{path:i,...typeof a?.content=="string"?{content:a.content}:{},...a?.truncated===!0?{truncated:!0}:{}}:null}).filter(n=>!!n)}function Nl(t){const s=le(t.metadata)??{},n=le(s.sourcePreservation)??le(s.sourcePreserve),a=le(s.sourceChangeDetection),i=Ue(n?.preservedSha)??Ue(a?.preservedSha)??null,u=Ue(n?.sourceRef)??Ue(a?.sourceRef)??(typeof t.repoRef=="string"?t.repoRef:null);return!i&&!u?null:{preservedSha:i,sourceRef:u}}function le(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Ue(t){return typeof t=="string"&&t.trim()?t.trim():null}async function Cl(t,s,n,a){const i=await z.sandboxUploadFile(t,s,{path:n,contents:a});return await z.preserveSandboxSource(t,s,{message:"Auto-preserve source after right sidebar save"}),{path:i.file.path,status:"M",additions:0,deletions:0,patch:"",content:a}}function $l(t){return t.filter(s=>s.type==="file").map(s=>s.path).sort((s,n)=>s.localeCompare(n))}function Rl(t,s){const n=new Map;for(const a of ds(t?.diff??""))n.set(a.path,a);for(const a of Fl(s?.porcelain??""))n.has(a.path)||n.set(a.path,a);return[...n.values()].sort((a,i)=>a.path.localeCompare(i.path))}function ds(t){const s=[];let n=null;const a=()=>{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 i of t.split(`
|
|
10
|
+
`)){if(i.startsWith("diff --git ")){a(),n={path:Pl(i)??"changed-file",status:"M",additions:0,deletions:0,patchLines:[i]};continue}if(n){if(n.patchLines.push(i),i.startsWith("+++ ")){const u=nn(i.slice(4));u&&(n.path=u);continue}if(i.startsWith("--- ")){const u=nn(i.slice(4));u&&n.path==="changed-file"&&(n.path=u);continue}i.startsWith("new file mode ")&&(n.status="A"),i.startsWith("deleted file mode ")&&(n.status="D"),i.startsWith("rename to ")&&(n.status="R",n.path=i.slice(10).trim()||n.path),i.startsWith("+")&&!i.startsWith("+++")&&(n.additions+=1),i.startsWith("-")&&!i.startsWith("---")&&(n.deletions+=1)}}return a(),s}function Fl(t){const s=[];for(const n of t.split(`
|
|
11
|
+
`)){if(!n.trim())continue;const a=El(n);a&&s.push({path:a,status:n.slice(0,2).trim()||"M",additions:0,deletions:0,patch:"",content:null})}return s}function El(t){const s=t.slice(3).trim();return s?s.split(" -> ").pop()?.trim()||s:null}function Pl(t){const s=/^diff --git a\/(.+) b\/(.+)$/.exec(t.trim());return s?.[2]??s?.[1]??null}function nn(t){const s=t.trim();return!s||s==="/dev/null"?null:s.startsWith("a/")||s.startsWith("b/")?s.slice(2):s}const wn="openpond.workspace.editorControlsVisible";function an(){try{return dn.getItem(wn)==="true"}catch{return!1}}function Al(t){try{dn.setItem(wn,String(t))}catch{}}function Ll({activeDiagnostics:t,activeServers:s,editorDiagnosticsChecking:n,editorLspEnabled:a,showEditorCommandBar:i}){if(!i)return null;if(!a)return{label:"LSP off",severity:"unavailable"};if(n)return{label:"Checking",severity:"info"};const u=t.filter(x=>x.severity==="error").length;if(u>0)return{label:`${u} error${u===1?"":"s"}`,severity:"error"};const c=t.filter(x=>x.severity==="warning").length;if(c>0)return{label:`${c} warning${c===1?"":"s"}`,severity:"warning"};const d=t.length;if(d>0)return{label:`${d} note${d===1?"":"s"}`,severity:"info"};if(!s)return null;const p=s.find(x=>x.status!=="connected");return p?{label:p.id==="none"?"No LSP":`${p.id} unavailable`,severity:"unavailable"}:{label:"No issues",severity:"none"}}const ln=3e3,Dl=2e3,rn=[],Tl=[];function _l({appId:t,workspaceId:s,workspaceKind:n,connection:a,runtimeEvents:i,diff:u,editorPreferences:c,loading:d,workspaceName:p,workspaceInitialized:x,workspaceError:o,expanded:b,fileRootPath:S,filesWithPreview:k=!1,openFileRequest:N,readOnly:F=!1,sideChatTabs:_,sourceSwitcher:W,tabRequest:G,viewState:H,onRefresh:I,onResizeStart:v,onToggleExpanded:R,onOpenBrowser:D,onOpenBrowserUrl:M,onViewStateChange:E,onCloseSideChat:te,onOpenSideChat:q,onSelectSideChat:X,goalDetails:B,sandboxFileSource:Q,trainingSummary:se,sidebarFileBookmarks:Y=[],sidebarFileSourceSessionId:re=null,onSetSidebarFileStatus:w}){return e.jsx(Bl,{appId:t,workspaceId:s,workspaceKind:n,connection:a,runtimeEvents:i??[],diff:u,editorPreferences:c??null,loading:d,workspaceName:p,workspaceInitialized:x,workspaceError:o,expanded:b,fileRootPath:S??null,filesWithPreview:k,openFileRequest:N,readOnly:F,sideChatTabs:_??[],sourceSwitcher:W??null,tabRequest:G??null,viewState:H??null,onRefresh:I,onResizeStart:v,onToggleExpanded:R,onOpenBrowser:D,onOpenBrowserUrl:M,onViewStateChange:E,onCloseSideChat:te,onOpenSideChat:q,onSelectSideChat:X,goalDetails:B??null,sandboxFileSource:Q??null,trainingSummary:se??null,sidebarFileBookmarks:Y,sidebarFileSourceSessionId:re,onSetSidebarFileStatus:w})}function Ml(t,s,n,a){return t&&s?.content!=null?{...t,content:s.content}:s&&!t&&ss(s)?s:t&&ss(t)?t:s&&ss(s)?s:t??s??n??ls(a)}function ss(t){return!!(t.patch||t.content!=null)}function zl({changedFiles:t,checkpointStatus:s,dirty:n,error:a,loading:i,preservedReadback:u,sandboxMode:c,sourcePending:d}){if(d)return{label:"sandbox pending",tone:"loading"};if(i)return{label:"refreshing",tone:"loading"};if(c&&u&&s)return s;if(a)return{label:"status unavailable",tone:"error"};if(c&&s?.tone==="error"||c&&s&&!n&&t===0)return s;if(n||t>0){const p=Math.max(1,t),x=p===1?"change":"changes";return{label:c?`${p} unpreserved ${x}`:`${p} local ${x}`,tone:"dirty"}}return{label:c?"sandbox clean":"local clean",tone:"clean"}}function Wl(t,s){if(!s)return null;for(let n=t.length-1;n>=0;n-=1){const a=t[n];if(a?.name!=="workspace_action_result")continue;const i=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:null,u=i?.sourcePreservation&&typeof i.sourcePreservation=="object"&&!Array.isArray(i.sourcePreservation)?i.sourcePreservation:null;if(u?.attempted===!0&&u.sandboxId===s)return u.ok!==!0?{label:"checkpoint failed",tone:"error"}:u.preserved===!0?{label:"checkpoint saved",tone:"clean"}:{label:"checkpoint clean",tone:"clean"}}return null}function Il(t){const s=t.split("/").filter(Boolean);return s.map((n,a)=>s.slice(0,a+1).join("/"))}function Bl({appId:t,workspaceId:s,workspaceKind:n,connection:a,runtimeEvents:i,diff:u,editorPreferences:c,loading:d,workspaceName:p,workspaceInitialized:x,workspaceError:o,expanded:b,fileRootPath:S,filesWithPreview:k,openFileRequest:N,readOnly:F,sideChatTabs:_,sourceSwitcher:W,tabRequest:G,viewState:H,onRefresh:I,onResizeStart:v,onToggleExpanded:R,onOpenBrowser:D,onOpenBrowserUrl:M,onViewStateChange:E,onCloseSideChat:te,onOpenSideChat:q,onSelectSideChat:X,goalDetails:B,sandboxFileSource:Q,trainingSummary:se,sidebarFileBookmarks:Y,sidebarFileSourceSessionId:re,onSetSidebarFileStatus:w}){const O=H??qa(),[A,T]=r.useState(O.activeTab),[Pt,Pe]=r.useState(!1),[ot,oe]=r.useState(!1),[yn,ne]=r.useState(!1),[At,Lt]=r.useState(""),[J,He]=r.useState(()=>[...O.openFilePaths]),[j,ge]=r.useState(O.selectedPath),[us,Sn]=r.useState(!1),[fs,Nn]=r.useState(!1),[Ae,Cn]=r.useState(!1),[Dt,$n]=r.useState(!0),[ps,hs]=r.useState(an);Oa(()=>hs(an()));const[ms,Rn]=r.useState(!1),[xs,Fn]=r.useState(!1),[bs,En]=r.useState(!1),[ae,Le]=r.useState({}),[ct,dt]=r.useState(()=>new Set),[gs,ut]=r.useState({}),[ue,Ve]=r.useState({}),[js,Tt]=r.useState(()=>new Set),[Ge,Ke]=r.useState(null),[Pn,_t]=r.useState(!1),[vs,qe]=r.useState(null),[ks,Mt]=r.useState({}),[An,zt]=r.useState({}),[Ln,Wt]=r.useState(null),[Dn,je]=r.useState(null),[ws,It]=r.useState(null),[Tn,ve]=r.useState(null);Ee(o,{prefix:"Workspace"}),Ee(vs,{prefix:"Sandbox files"});const[Bt,ft]=r.useState(null),[_n,Xe]=r.useState({}),[pt,Ot]=r.useState(null),[De,ht]=r.useState(null),[mt,xt]=r.useState(null),ee=c??Ga.editor,ys=r.useRef(ae),Ut=r.useRef(Jt(O)),Ht=r.useRef(Jt(O)),Ss=r.useRef(null),Vt=r.useRef(I),ce=r.useRef(!1),Ze=r.useRef(null),Qe=r.useRef(0),fe=r.useRef(null),Ye=r.useRef(null),P=Q?.sandboxId?.trim()||null,C=!!Q,Te=!!se||C&&!!P,bt=C?`sandbox:${P??"pending"}`:`workspace:${t??"none"}`,Ns=C?!!P:!!t,Cs=r.useRef(bt),pe=!!(B?.createRuntime||B?.goalRuntime||B?.subagentRuntime),_e=r.useCallback(async(l={})=>{if(C){if(!a){Ke(null),qe("OpenPond App server is not connected.");return}if(!P){Ke(null),qe(null);return}l.silent||_t(!0);try{const[m,f,g]=await Promise.allSettled([z.sandboxFiles(a,P,{recursive:!0,maxEntries:Dl}),z.sandboxGitStatus(a,P),z.sandboxGitDiff(a,P,{})]);if(m.status==="rejected")throw m.reason;const y=$l(m.value.files),h=f.status==="fulfilled"?f.value.status:null,$=g.status==="fulfilled"?g.value.diff:null,L=Rl($,h),at=L.reduce((Qt,Yt)=>Qt+Yt.additions,0),ma=L.reduce((Qt,Yt)=>Qt+Yt.deletions,0);Ke({appId:P,repoPath:"",initialized:!0,dirty:h?!h.clean:L.length>0,filesChanged:L.length,additions:at,deletions:ma,repoFiles:y,files:L,error:null,updatedAt:new Date().toISOString()}),qe(null)}catch(m){Ke(null),qe(m instanceof Error?m.message:String(m))}finally{l.silent||_t(!1)}}},[a,P,C]),$s=r.useMemo(()=>yl(i,P),[i,P]),Rs=!!(Ge&&((Ge.files?.length??0)>0||(Ge.repoFiles?.length??0)>0)),Mn=C&&!Rs&&!!$s,he=C?Rs?Ge:$s??Ge:u,Je=he?.repoPath??null,zn=r.useMemo(()=>Wl(i,P),[i,P]),Me=he?.files??rn,Fs=he?.files??rn,ke=r.useMemo(()=>new Map(Fs.map(l=>[l.path,l])),[Fs]),we=r.useMemo(()=>new Map(Me.map(l=>[l.path,l])),[Me]),ze=he?.repoFiles??(Me.length>0?Me.map(l=>l.path):Tl),We=r.useMemo(()=>Me.filter(l=>!Ua(l,ze)),[ze,Me]),ye=r.useMemo(()=>mt&&!ze.includes(mt)?[mt,...ze]:ze,[ze,mt]),Es=r.useMemo(()=>J.map(l=>ke.get(l)??ae[l]??we.get(l)??ls(l)),[ke,we,ae,J]),gt=r.useMemo(()=>{const l={};for(const m of J){if(Ce(m))continue;const f=ke.get(m)??ae[m]??we.get(m)??ls(m);f.content!=null&&(l[m]=f.content)}return l},[ke,we,ae,J]),Ie=r.useMemo(()=>{const l=new Set;for(const[m,f]of Object.entries(ue))f.content!==f.savedContent&&l.add(m);return l},[ue]),Wn=r.useMemo(()=>{const l=At.trim().toLowerCase(),m=ye;return l?m.filter(f=>f.toLowerCase().includes(l)):m},[ye,At]),Gt=r.useMemo(()=>({activeTab:A,openFilePaths:J,selectedPath:j}),[A,J,j]);r.useEffect(()=>{ys.current=ae},[ae]),r.useEffect(()=>{Ze.current=pt},[pt]),r.useEffect(()=>{Ve(l=>{let m=!1;const f={...l},g=new Set(J),y=u?.updatedAt?Date.parse(u.updatedAt):null;for(const[h,$]of Object.entries(f))g.has(h)||$.content!==$.savedContent||(delete f[h],m=!0);for(const[h,$]of Object.entries(gt)){const L=f[h];if(!L){f[h]={content:$,savedContent:$},m=!0;continue}if(L.content===L.savedContent&&L.savedContent!==$){if(L.savedAt&&(y===null||y<L.savedAt))continue;f[h]={content:$,savedContent:$},m=!0}}return m?f:l})},[u?.updatedAt,gt,J]),r.useEffect(()=>{Vt.current=I},[I]),r.useEffect(()=>{if(!H)return;const l=Ha(H,Je);Ks(Ut.current,l)||(Ut.current=l,Ht.current=l,T(l.activeTab),He(l.openFilePaths),ge(l.selectedPath))},[H,Je]),r.useEffect(()=>{if(ct.size>0||Ks(Ht.current,Gt))return;const l=Jt(Gt);Ht.current=l,Ut.current=l,E?.(l)},[Gt,E,ct]),r.useEffect(()=>{F||C||!a||!t||!x||u||o||ce.current||(ce.current=!0,Promise.resolve(Vt.current({silent:!0})).catch(()=>{}).finally(()=>{ce.current=!1}))},[t,a,u,F,C,o,x]),r.useEffect(()=>(Cs.current!==bt&&(Cs.current=bt,fe.current?.abort(new Error("lsp_diagnostics_source_changed")),fe.current=null,He([]),ge(null),Le({}),dt(new Set),ut({}),Ve({}),Tt(new Set),Ke(null),qe(null),_t(!1),Mt({}),zt({}),Wt(null),je(null),ve(null),ft(null),Xe({}),Ot(null),ht(null),xt(null)),()=>{fe.current?.abort(new Error("lsp_diagnostics_unmounted")),fe.current=null}),[bt]),r.useEffect(()=>{if(!(!N||Ss.current===N.id)&&!(!N.file&&!Ns)){if(Ss.current=N.id,N.file){In(N.file,N.imageUrl,N.source);return}jt(N.path,{source:N.source})}},[Ns,N]),r.useEffect(()=>{if(!C||(_e(),!a||!P))return;let l=!1;async function m(){if(!(l||ce.current)&&!(typeof document<"u"&&document.visibilityState==="hidden")){ce.current=!0;try{await _e({silent:!0})}finally{ce.current=!1}}}const f=window.setInterval(()=>{m()},ln),g=()=>{m()};return window.addEventListener("focus",g),()=>{l=!0,window.clearInterval(f),window.removeEventListener("focus",g)}},[a,_e,P,C]),r.useEffect(()=>{if(F||C||!a||!t||!x)return;let l=!1;async function m(){if(!(l||ce.current)&&!(typeof document<"u"&&document.visibilityState==="hidden")){ce.current=!0;try{await Vt.current({silent:!0})}catch{}finally{ce.current=!1}}}const f=window.setInterval(()=>{m()},ln),g=()=>{m()};return window.addEventListener("focus",g),()=>{l=!0,window.clearInterval(f),window.removeEventListener("focus",g)}},[t,a,F,C,x]),r.useEffect(()=>{if(C||!a||!t||n==="local_project"){xt(null);return}let l=!1;return z.workspaceTemplateConfig(a,t).then(m=>{l||xt(m.exists?m.configPath??Va:null)}).catch(()=>{l||xt(null)}),()=>{l=!0}},[t,a,C,n]),r.useEffect(()=>{!j||ye.includes(j)||J.includes(j)||ge(We[0]?.path??null)},[We,J,ye,j]),r.useEffect(()=>{B?.active&&pe&&T("goal")},[B?.active,pe]),r.useEffect(()=>{G&&T(G.tab)},[G]),r.useEffect(()=>{!pe&&A==="goal"&&T("files")},[A,pe]),r.useEffect(()=>{!Te&&A==="summary"&&T("files")},[A,Te]);const K=A==="file"||k&&A==="files"?j:null;r.useEffect(()=>{if(!a||!K)return;if(Ce(K)){ve(null),je(h=>h===K?null:h);return}const l=Bt?.path===K,m=et(K);if(F&&(m?.content!=null||m?.patch)){ve(null),je(h=>h===K?null:h);return}if(!l&&(m?.content!=null||m?.patch&&!Ae)){ve(null),je(h=>h===K?null:h);return}let f=!1;const g=ys.current[K];return g?.content==null&&(Ae||!g?.patch)&&je(K),ve(null),(C?P?vl(a,P,K,i):Promise.reject(new Error(Q?.emptyMessage??"No sandbox filesystem is available.")):t?z.workspaceFile(a,t,K):Promise.reject(new Error("Workspace files are unavailable."))).then(h=>{f||Le($=>{const L=$[h.path];return L?.content===h.content&&L.patch===h.patch&&L.status===h.status?$:{...$,[h.path]:h}})}).catch(h=>{f||ve(h instanceof Error?h.message:String(h))}).finally(()=>{f||(je(h=>h===K?null:h),ft(h=>h&&h.id===Bt?.id&&h.path===K?null:h))}),()=>{f=!0}},[A,t,a,Bt,Ae,F,i,Q?.emptyMessage,P,C,K]);function jt(l,m){It(null);const f=C?P:t;if(Os(l)&&!m?.source&&a&&f){wa(a,f,l,C?"sandbox":"local").then(M).catch(y=>It(y instanceof Error?y.message:"Could not open HTML preview."));return}const g=is(l,Je);g&&(dt(y=>{if(!y.has(g))return y;const h=new Set(y);return h.delete(g),h}),Le(y=>{if(!(g in y))return y;const h={...y};return delete h[g],h}),ut(y=>{if(!(g in y))return y;const h={...y};return delete h[g],h}),ft({id:Date.now(),path:g}),k||He(y=>y.includes(g)?y:[...y,g]),ge(g),T(k?"files":"file"),!C&&a&&t&&Ce(g)&&ht(g),oe(!1),ne(!1),Lt(""))}function In(l,m,f=!1){if(Os(l.path)&&l.content!=null&&!f&&a){ya(a,l.path,l.content).then(M).catch(h=>It(h instanceof Error?h.message:"Could not open HTML preview."));return}const g=is(l.path,Je);if(!g)return;const y={...l,path:g};Le(h=>({...h,[g]:y})),dt(h=>{const $=new Set(h);return $.add(g),$}),ut(h=>{if(!m){if(!(g in h))return h;const $={...h};return delete $[g],$}return h[g]===m?h:{...h,[g]:m}}),ft(null),ve(null),je(null),k||He(h=>h.includes(g)?h:[...h,g]),ge(g),T(k?"files":"file"),oe(!1),ne(!1),Lt("")}const Bn=r.useCallback(()=>{hs(l=>{const m=!l;return Al(m),m})},[]),et=l=>Ml(ke.get(l),ae[l],we.get(l),l),On=r.useCallback((l,m)=>{Ve(f=>{const g=f[l],y=g?.savedContent??gt[l]??et(l).content??"";return{...f,[l]:{content:m,savedContent:y,savedAt:g?.savedAt}}}),Xe(f=>{if(!(l in f))return f;const g={...f};return delete g[l],g})},[ke,we,ae,gt]),Be=r.useCallback(async(l,m={})=>{if(C||!a||!t||Ce(l))return;const f=et(l),g=m.content??ue[l]?.content??f.content??void 0;if(g?.endsWith(Rt))return;const y=Qe.current+1;Qe.current=y,fe.current?.abort(new Error("lsp_diagnostics_superseded"));const h=new AbortController;fe.current=h,Wt(l);try{const $=await z.workspaceLspTouch(a,t,{path:l,content:g,waitForDiagnostics:m.waitForDiagnostics??!0},{signal:h.signal});if(y!==Qe.current)return;Mt(L=>({...L,[$.path]:$.diagnostics})),zt(L=>({...L,[$.path]:$.servers}))}catch($){if(h.signal.aborted||y!==Qe.current)return;const L=$ instanceof Error?$.message:String($);Mt(at=>({...at,[l]:[]})),zt(at=>({...at,[l]:[{id:"lsp",root:"",status:"error",message:L}]}))}finally{if(fe.current===h&&(fe.current=null),h.signal.aborted)return;y===Qe.current&&Wt($=>$===l?null:$)}},[t,a,ke,we,ue,ae,C]),Un=r.useCallback(async l=>{if(C||!a||!t)throw new Error("Workspace LSP is unavailable.");return z.workspaceLspAction(a,t,l)},[t,a,C]),tt=r.useCallback(async l=>{if(!a||!t&&!P||Ze.current===l)return;const m=ue[l];if(!m||m.content===m.savedContent)return;const f=m.content,g=Date.now();Ze.current=l,Ot(l),Xe(y=>{if(!(l in y))return y;const h={...y};return delete h[l],h});try{const y=C?await Cl(a,P,l,f):await z.saveWorkspaceFile(a,t,{path:l,content:f});Le(h=>({...h,[y.path]:y})),Ve(h=>{const $=h[l];return $?{...h,[l]:{content:$.content,savedContent:f,savedAt:g}}:h}),ee.languageServers!=="off"&&ee.checkOnSave&&await Be(l,{content:f,waitForDiagnostics:!0}),C?await _e({silent:!0}):await I({silent:!0})}catch(y){Xe(h=>({...h,[l]:y instanceof Error?y.message:String(y)}))}finally{Ze.current===l&&(Ze.current=null),Ot(y=>y===l?null:y)}},[ee.checkOnSave,ee.languageServers,t,a,ue,I,Be,_e,P,C]),Ps=j?et(j):null,st=!!(j&&ct.has(j)),Se=j?ue[j]?.content??Ps?.content??null:null,Hn=!!(Ps?.patch&&!Ae),Kt=!!(!F&&!st&&A==="file"&&!Hn&&j&&Se!=null&&!Ce(j)&&!(Dt&&as(j))&&!Se.endsWith(Rt));r.useEffect(()=>{if(ee.languageServers==="off"||!ee.diagnosticsWhileEditing||!j||!Kt||Se==null)return;const l=window.setTimeout(()=>{Be(j,{content:Se,waitForDiagnostics:!0})},700);return()=>window.clearTimeout(l)},[ee.diagnosticsWhileEditing,ee.languageServers,Be,Se,Kt,j]),r.useEffect(()=>{function l(m){!(m.ctrlKey||m.metaKey)||m.key.toLowerCase()!=="s"||A!=="file"||!j||(m.preventDefault(),Ie.has(j)&&tt(j))}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[A,Ie,tt,j]);const Vn=r.useCallback(()=>{j&&(Ye.current?Ye.current.save():tt(j))},[tt,j]),Gn=r.useCallback(()=>{Ye.current?.undo()},[]),Kn=r.useCallback(()=>{Ye.current?.redo()},[]),qn=r.useCallback(()=>{j&&ee.languageServers!=="off"&&Be(j,{content:Se??void 0,waitForDiagnostics:!0})},[ee.languageServers,Be,Se,j]);function Xn(l,m){if(m.stopPropagation(),!(Ie.has(l)&&!window.confirm(`Discard unsaved changes to ${l}?`))&&(Ie.has(l)&&(Ve(f=>{if(!(l in f))return f;const g={...f};return delete g[l],g}),Xe(f=>{if(!(l in f))return f;const g={...f};return delete g[l],g})),He(f=>f.filter(g=>g!==l)),ct.has(l)&&Le(f=>{if(!(l in f))return f;const g={...f};return delete g[l],g}),ut(f=>{if(!(l in f))return f;const g={...f};return delete g[l],g}),dt(f=>{if(!f.has(l))return f;const g=new Set(f);return g.delete(l),g}),j===l)){const f=Es.find(g=>g.path!==l)??null;ge(f?.path??We[0]?.path??null),f||T("files")}}function Zn(){T("files"),oe(!1),ne(!1)}function As(l){Tt(m=>{const f=new Set(m);return f.has(l)?f.delete(l):f.add(l),f})}function Qn(l){l&&Tt(m=>{const f=new Set(m);for(const g of Il(l))f.add(g);return f}),T("files"),oe(!1),ne(!1)}function Yn(){const m=`git apply <<'PATCH'
|
|
12
|
+
${We.map(f=>f.patch).filter(Boolean).join(`
|
|
13
|
+
`)}
|
|
14
|
+
PATCH`;navigator.clipboard?.writeText(m)}const Jn=We.length>0,ea=ye.length>0,ta=J.length>0,sa=pe||Te||Jn||ea||ta,me=A==="goal"&&pe?"goal":A==="summary"&&Te?"summary":A==="file"&&j?"file":"files",na=me==="files"?"No files to show":"No local changes",aa=n==="local_project"&&!x&&!o,Ls=C?Pn:d,Ds=C?vs:o,ia=zl({changedFiles:he?.filesChanged??We.length,checkpointStatus:zn,dirty:!!he?.dirty,error:Ds,loading:Ls,preservedReadback:Mn,sandboxMode:C,sourcePending:C&&!P}),la=Ls?"Loading workspace files":Ds?"Workspace files are unavailable":C&&!P?Q?.emptyMessage??"No sandbox filesystem is available.":aa?"Loading workspace files":x?na:"No local files to show",Ts=j?gs[j]??null:null,ra=!Ts&&!C&&j&&Ce(j)?j:null,_s=De?gs[De]??null:null,oa=!_s&&!C&&De&&Ce(De)?De:null,ca=Us(a,t,ra),da=Us(a,t,oa),qt=Ts??ca,Ms=_s??da,zs=me==="file"||k&&me==="files"?j:null,ua=!!(zs&&as(zs)),Ws=j?ks[j]??[]:[],Is=j?An[j]??null:null,Xt=!!(j&&Ln===j),Zt=ps&&Kt,nt=!F&&!st&&!C&&ee.languageServers!=="off",fa=r.useMemo(()=>Ll({activeDiagnostics:Ws,activeServers:Is,editorDiagnosticsChecking:Xt,editorLspEnabled:nt,showEditorCommandBar:Zt}),[Ws,Is,Xt,nt,Zt]),pa=r.useCallback(async l=>{if(!a)throw new Error("OpenPond server connection is unavailable.");await z.runSubagentLifecycleAction(a,l.runId,{action:l.action,reason:"User requested from Goal details."}),await I({silent:!0})},[a,I]),xe=C?"sandbox":n==="local_project"?"local":null,vt=r.useMemo(()=>{const l=new Map;if(!xe||!s)return l;for(const m of Y)m.workspaceKind!==xe||m.workspaceId!==s||l.set(m.path,m);return l},[Y,xe,s]),kt=r.useCallback(l=>{try{return vt.get(qs(l))?.status??null}catch{return null}},[vt]),wt=r.useCallback((l,m)=>{if(!xe||!s||!p||!w)return;let f;try{f=qs(l)}catch{return}const g=vt.get(f),y=new Date().toISOString(),h=g??{id:Ka({workspaceKind:xe,workspaceId:s,path:f}),workspaceKind:xe,workspaceId:s,workspaceName:p,path:f,status:"pinned",order:null,sourceSessionId:re,available:!0,createdAt:y,updatedAt:y};w(h,m)},[w,vt,re,xe,s,p]),Ne=!!(xe&&s&&p&&w),ha=j&&Ne&&!st?e.jsx(rs,{currentStatus:kt(j),onSetStatus:l=>wt(j,l)}):null,Bs=j?e.jsx(pl,{diagnostics:nt?ks[j]??[]:[],draftContent:ue[j]?.content,editorRef:Ye,editable:!F&&!st&&!qt,error:Tn,file:et(j),collapsed:fs,hideWhiteSpace:xs,headerActions:ha,imageSrc:qt,loading:Dn===j,loadFullFiles:Ae,saveError:_n[j]??null,saving:pt===j,onOpenImage:()=>{qt&&ht(j)},onDraftContentChange:l=>On(j,l),onLspAction:nt?Un:void 0,onSave:()=>{tt(j)},onSelectBreadcrumbPath:Qn,renderMarkdown:Dt,splitView:bs,wordDiffs:ms,wordWrap:us,workspaceName:p,workspaceRootPath:Je}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:`workspace-diff-panel ${b?"expanded":""}`,id:"right-sidebar-files-panel",role:"tabpanel","aria-label":"Workspace diffs",children:[!b&&e.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize diff panel",onPointerDown:v}),e.jsx(el,{addMenuOpen:ot,expanded:b,filteredFiles:Wn,openFiles:Es,dirtyFilePaths:Ie,goalDetailsAvailable:pe,searchOpen:yn,searchQuery:At,selectedPath:j,sideChatTabs:_,summaryAvailable:Te,sourceStatus:ia,sourceSwitcher:W,visibleTab:me,getFileBookmarkStatus:Ne?kt:void 0,onCloseFileTab:Xn,onCloseSideChat:te,onCloseSearch:()=>ne(!1),onOpenFile:jt,onOpenBrowser:D?()=>{oe(!1),ne(!1),D()}:void 0,onOpenSearch:()=>{oe(!1),ne(!0)},onOpenSideChat:q?()=>{oe(!1),ne(!1),q()}:void 0,onSearchQueryChange:Lt,onSetFileBookmarkStatus:Ne?wt:void 0,onSelectFile:l=>{ge(l),T("file")},onSelectFiles:Zn,onSelectGoal:()=>T("goal"),onSelectSummary:()=>{T("summary"),oe(!1),ne(!1)},onSelectSideChat:X,onToggleAddMenu:()=>{oe(l=>!l),ne(!1)},onToggleExpanded:R}),ws&&e.jsx("div",{className:"workspace-diff-empty",role:"alert",children:ws}),me==="goal"&&pe?e.jsx(wi,{createRuntime:B?.createRuntime??null,goalRuntime:B?.goalRuntime??null,subagentRuntime:B?.subagentRuntime??null,onRunSubagentLifecycleAction:a?pa:void 0}):me==="summary"&&Te?se?e.jsx(Zi,{summary:se}):e.jsx(Oi,{sandboxId:P,connection:a}):sa?e.jsxs(e.Fragment,{children:[e.jsx(tl,{canSaveActiveFile:!!(!F&&!st&&j&&Ie.has(j)&&pt!==j),canCheckActiveFile:nt,collapsed:fs,editorControlsVisible:ps,editorDiagnosticStatus:fa,editorDiagnosticsChecking:Xt,hideWhiteSpace:xs,loadFullFiles:Ae,menuOpen:Pt,renderMarkdown:Dt,showEditorCommandBar:Zt,showRenderMarkdownToggle:ua,splitView:bs,wordDiffs:ms,wordWrap:us,onCopyGitApply:Yn,onEditorCheck:qn,onEditorRedo:Kn,onEditorSave:Vn,onEditorUndo:Gn,onRefresh:()=>{C?_e():I()},onToggleCollapsed:()=>Nn(l=>!l),onToggleEditorControlsVisible:Bn,onToggleHideWhiteSpace:()=>Fn(l=>!l),onToggleLoadFullFiles:()=>Cn(l=>!l),onToggleMenu:l=>Pe(m=>l??!m),onToggleRenderMarkdown:()=>$n(l=>!l),onToggleSplitView:()=>En(l=>!l),onToggleWordDiffs:()=>Rn(l=>!l),onToggleWordWrap:()=>Sn(l=>!l)}),me==="files"&&(k?e.jsxs("div",{className:"workspace-diff-files-preview-layout",children:[e.jsx(en,{diff:he,expandedFolderPaths:js,rootPath:S,repoFiles:ye,selectedPath:j,getFileBookmarkStatus:Ne?kt:void 0,onOpenFile:jt,onSetFileBookmarkStatus:Ne?wt:void 0,onToggleFolder:As}),Bs??e.jsx("div",{className:"workspace-diff-files-preview-empty",children:"Select a file to review its changes."})]}):e.jsx(en,{diff:he,expandedFolderPaths:js,rootPath:S,repoFiles:ye,selectedPath:j,getFileBookmarkStatus:Ne?kt:void 0,onOpenFile:jt,onSetFileBookmarkStatus:Ne?wt:void 0,onToggleFolder:As})),me==="file"&&j&&Bs]}):e.jsx("div",{className:"workspace-diff-empty",children:e.jsx("span",{children:la})})]}),e.jsx(Sa,{open:!!Ms,src:Ms,title:De??"",onClose:()=>ht(null)})]})}const Ql=Object.freeze(Object.defineProperty({__proto__:null,WorkspaceDiffPanel:_l},Symbol.toStringTag,{value:"Module"}));export{ui as C,_l as W,Ql as a};
|