openpond 0.2.51 → 0.2.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/app-server.js +1 -1
  2. package/dist/chunks/{app-server-runtime-4YKIZB22.js → app-server-runtime-NITNSHYS.js} +1 -1
  3. package/dist/chunks/{chunk-42GOV5ZU.js → chunk-AV3WI7JZ.js} +1 -1
  4. package/dist/chunks/{chunk-OC6UWKBL.js → chunk-CFLMKFOE.js} +1 -1
  5. package/dist/chunks/{chunk-UBFRWC6I.js → chunk-FQZFLNLY.js} +1 -1
  6. package/dist/chunks/{chunk-JCCU3VFK.js → chunk-HJEY5LBD.js} +1 -1
  7. package/dist/chunks/{chunk-TBNBCOW7.js → chunk-L3V4QKRV.js} +1 -1
  8. package/dist/chunks/chunk-PVSUQGWK.js +9 -0
  9. package/dist/chunks/{chunk-ZCWHVLJ4.js → chunk-T5T7NCHJ.js} +1 -1
  10. package/dist/chunks/{chunk-2ZJJFBIA.js → chunk-USMZT5FZ.js} +12 -12
  11. package/dist/chunks/{chunk-KXEG7HCG.js → chunk-XC7AHL57.js} +114 -113
  12. package/dist/chunks/{chunk-O7VGFMDO.js → chunk-ZBZBV5TB.js} +1 -1
  13. package/dist/chunks/{cli-ZLDLOKPL.js → cli-ZYFSCHZK.js} +1 -1
  14. package/dist/chunks/{dist-BLBZENVB.js → dist-5VFPYEIV.js} +1 -1
  15. package/dist/chunks/{hosted-experiment-improvement-NTYYSPQX.js → hosted-experiment-improvement-MGBPXXW2.js} +1 -1
  16. package/dist/chunks/{hosted-harness-runtime-FZZLWLBR.js → hosted-harness-runtime-WOLADXXP.js} +1 -1
  17. package/dist/chunks/{hosted-profile-compiler-JODGZCA7.js → hosted-profile-compiler-NBMUCZVS.js} +1 -1
  18. package/dist/chunks/{hosted-profile-evaluation-preparation-F2SPAEKK.js → hosted-profile-evaluation-preparation-I6H6RFT6.js} +1 -1
  19. package/dist/chunks/{src-STK4YHBI.js → src-MGP3OYHL.js} +115 -115
  20. package/dist/chunks/{workspaces-XIQNPAP7.js → workspaces-MFZ3OO6O.js} +1 -1
  21. package/dist/cli.js +1 -1
  22. package/dist/web/assets/App-Dg6mZIQk.js +234 -0
  23. package/dist/web/assets/{AppDialog-1iGodoot.js → AppDialog-gcj3rrTZ.js} +1 -1
  24. package/dist/web/assets/{AppTerminalPanel-udtBdWFn.js → AppTerminalPanel-Be-E4qZF.js} +2 -2
  25. package/dist/web/assets/{AppsView-DhKsU4yi.js → AppsView-BdyPNSpT.js} +1 -1
  26. package/dist/web/assets/{BrowserSidebar-BnOyqIQT.js → BrowserSidebar-CcQxU0uO.js} +1 -1
  27. package/dist/web/assets/{CartesianChart-C24DAywn.js → CartesianChart-CN5hB6rV.js} +1 -1
  28. package/dist/web/assets/{CollaborationTabs-DgmOF5Fe.js → CollaborationTabs-BiDPHgXG.js} +1 -1
  29. package/dist/web/assets/{CommandMenu-CUNGtHwS.js → CommandMenu-B2qJCgWH.js} +1 -1
  30. package/dist/web/assets/{CommunityView-CE7qeJnr.js → CommunityView-D1aOQKfS.js} +1 -1
  31. package/dist/web/assets/{ComposerCreateImproveStrip-BixNsg2a.js → ComposerCreateImproveStrip-f1tdD0QS.js} +1 -1
  32. package/dist/web/assets/{GetStartedView-B8gCwmBX.js → GetStartedView-CPYs0fYN.js} +1 -1
  33. package/dist/web/assets/{HostedModelLearningReview-CitgUNfC.js → HostedModelLearningReview-DVfJyUW_.js} +1 -1
  34. package/dist/web/assets/{HostedModelLearningSettings-WUaqzNsa.js → HostedModelLearningSettings-IEKRXOkG.js} +1 -1
  35. package/dist/web/assets/{LabModelVersionDetailPage-Cx0kL69J.js → LabModelVersionDetailPage-DkIa0oG_.js} +1 -1
  36. package/dist/web/assets/{LabSkillSidebar-DRggqZ1j.js → LabSkillSidebar-BUlU1Ti-.js} +1 -1
  37. package/dist/web/assets/{LabsRoute-BujTZhqC.js → LabsRoute-8cKFNq19.js} +4 -4
  38. package/dist/web/assets/{MainChatThread-CyA_644R.js → MainChatThread-C5GwaIl_.js} +2 -2
  39. package/dist/web/assets/MainPane-SMqq5YAM.js +19 -0
  40. package/dist/web/assets/{MarkdownText-DJI5LwT0.js → MarkdownText-CLnvdLVg.js} +21 -21
  41. package/dist/web/assets/{NativeSkillSidebar-CkFpWxjd.js → NativeSkillSidebar-B9bVb00x.js} +1 -1
  42. package/dist/web/assets/{NewExperienceSwitcher-DXcRHHsu.js → NewExperienceSwitcher-CelgG7Ua.js} +1 -1
  43. package/dist/web/assets/{NewProjectDialog-gDzX_ZIJ.js → NewProjectDialog-eEnsg9s2.js} +1 -1
  44. package/dist/web/assets/{OutputsPage-J_k-_N82.js → OutputsPage-ByvsTUW-.js} +1 -1
  45. package/dist/web/assets/{ProjectsPage-BsyZmvlg.js → ProjectsPage-Cl2zFh8X.js} +1 -1
  46. package/dist/web/assets/{RightChatPanelStack-Bz8puMUB.js → RightChatPanelStack-MnGscF87.js} +1 -1
  47. package/dist/web/assets/{RightSidebarHomePanel-DmorYb6p.js → RightSidebarHomePanel-C6NXMYuy.js} +1 -1
  48. package/dist/web/assets/{ScheduledWorkPage-BFDzQUyL.js → ScheduledWorkPage-DCb6d7Lg.js} +1 -1
  49. package/dist/web/assets/{SettingsView-BB7wCdbr.js → SettingsView-BMFfrxmo.js} +3 -3
  50. package/dist/web/assets/{TeamChatView-CZ3b7rq2.js → TeamChatView-DW_v2B9E.js} +1 -1
  51. package/dist/web/assets/{TerminalOverlay-Ck43Qri3.js → TerminalOverlay-BJ7qsr9F.js} +1 -1
  52. package/dist/web/assets/{TrainingCreationPanel-ejqPZm3g.js → TrainingCreationPanel-GSIwP6f1.js} +1 -1
  53. package/dist/web/assets/{TrainingDraftPanel-Cy2AQxxL.js → TrainingDraftPanel-DorY6I29.js} +1 -1
  54. package/dist/web/assets/{UsageSettingsSection-B7nyMItm.js → UsageSettingsSection-DmzStI9q.js} +1 -1
  55. package/dist/web/assets/{WorkSidebarPanel-BfjAc097.js → WorkSidebarPanel-zsJrGaaL.js} +1 -1
  56. package/dist/web/assets/WorkspaceDiffPanel-CiFsZjMm.js +14 -0
  57. package/dist/web/assets/{WorkspaceEnvironmentMenu-B-K9XgFB.js → WorkspaceEnvironmentMenu-vJw9hE0y.js} +1 -1
  58. package/dist/web/assets/{WorkspaceGitDialogs-BJVFx_L3.js → WorkspaceGitDialogs-BpL-xtRX.js} +1 -1
  59. package/dist/web/assets/{WorkspaceMonacoEditor-p-FWMXoZ.js → WorkspaceMonacoEditor-CJ3x0GHH.js} +3 -3
  60. package/dist/web/assets/{arrow-up-right-CFGI2YSt.js → arrow-up-right-C60QSULo.js} +1 -1
  61. package/dist/web/assets/{chunk-UHVJOMWN-BAlur2vw.js → chunk-UHVJOMWN-BxgPi0yP.js} +1 -1
  62. package/dist/web/assets/{clipboard-DIIxBort.js → clipboard-QIy0Jd_K.js} +1 -1
  63. package/dist/web/assets/{cloud-upload-BaQFNCTp.js → cloud-upload-B9L-_gy0.js} +1 -1
  64. package/dist/web/assets/{cssMode-6LOkSggB.js → cssMode-ffPyPUW9.js} +1 -1
  65. package/dist/web/assets/{folder-open-DZSxfPtr.js → folder-open-BFy7KXWm.js} +1 -1
  66. package/dist/web/assets/{folder-plus-21v4D_Vx.js → folder-plus-C3iGtUOI.js} +1 -1
  67. package/dist/web/assets/{git-commit-horizontal-CgGixL64.js → git-commit-horizontal-DsTniKvi.js} +1 -1
  68. package/dist/web/assets/{htmlMode-B5uRraNd.js → htmlMode-7ytlsiyK.js} +1 -1
  69. package/dist/web/assets/{index-DOMrqhcz.js → index-BK8GmZmB.js} +2 -2
  70. package/dist/web/assets/index-C0H85uUI.css +1 -0
  71. package/dist/web/assets/{info-BGTcmow7.js → info-C8mwoaIJ.js} +1 -1
  72. package/dist/web/assets/{jsonMode-D3m8N4Gi.js → jsonMode-BT35NJi4.js} +1 -1
  73. package/dist/web/assets/{lspLanguageFeatures-DoyipLsB.js → lspLanguageFeatures-BKAwIewO.js} +1 -1
  74. package/dist/web/assets/{minimize-2-B01qSko4.js → minimize-2-34MApatV.js} +1 -1
  75. package/dist/web/assets/{monaco.contribution-BJyfaGX2.js → monaco.contribution-9diduNNi.js} +2 -2
  76. package/dist/web/assets/{monaco.contribution-Bc22foTx.js → monaco.contribution-CxtX0z-m.js} +2 -2
  77. package/dist/web/assets/{monaco.contribution-DuRhJ6zU.js → monaco.contribution-DVnPUDsR.js} +2 -2
  78. package/dist/web/assets/{monaco.contribution--U8v3jpa.js → monaco.contribution-Dj4R5U8Z.js} +2 -2
  79. package/dist/web/assets/{monitor-eZP8ZTHe.js → monitor-4JxqJ7wz.js} +1 -1
  80. package/dist/web/assets/{play-CGsWFR_B.js → play-C4PtpamL.js} +1 -1
  81. package/dist/web/assets/{python-BNrLZWud.js → python-0GVncePC.js} +1 -1
  82. package/dist/web/assets/{save-BLgjrccP.js → save-DjB16eou.js} +1 -1
  83. package/dist/web/assets/{square-CI1qNtvE.js → square-Coz7UQqd.js} +1 -1
  84. package/dist/web/assets/{toggleHighContrast-B_GcTCnw.js → toggleHighContrast-D-3108_3.js} +1 -1
  85. package/dist/web/assets/{tsMode-CmruH_ys.js → tsMode-CV4ktqqR.js} +1 -1
  86. package/dist/web/assets/{upload-DnlgGS2x.js → upload-D007T9Hm.js} +1 -1
  87. package/dist/web/assets/{useLocalAgentSchedules-BBhGUfK-.js → useLocalAgentSchedules-BXjFbAVS.js} +1 -1
  88. package/dist/web/assets/{useProviderSettings-DfhdkKdC.js → useProviderSettings-SY7mp-5B.js} +1 -1
  89. package/dist/web/assets/{useSessionTurnCache-BwscKl5i.js → useSessionTurnCache-Bee6zbC_.js} +1 -1
  90. package/dist/web/assets/{wifi-off-Dz-4EDCc.js → wifi-off-BbNZc0za.js} +1 -1
  91. package/dist/web/assets/{workers-Bi9u46cp.js → workers-DNQ5ne3z.js} +1 -1
  92. package/dist/web/assets/{yaml-DVTkiRnh.js → yaml-BfAho-gB.js} +1 -1
  93. package/dist/web/index.html +2 -2
  94. package/package.json +1 -1
  95. package/dist/chunks/chunk-7K72KS5C.js +0 -9
  96. package/dist/web/assets/App-BI-uOpnP.js +0 -234
  97. package/dist/web/assets/MainPane-LaEtxydD.js +0 -19
  98. package/dist/web/assets/WorkspaceDiffPanel-D9hAV8l7.js +0 -14
  99. package/dist/web/assets/index-DJcUXSsN.css +0 -1
@@ -1,3 +1,3 @@
1
- import{j as t,r as o}from"./index-DOMrqhcz.js";/* empty css */import{fA as G,X as R,aq as le,fB as re,fC as X,an as Y,at as de,aW as N,B as T,G as ce,a$ as me,b1 as ue,fD as ge,fE as he,fF as fe,b8 as xe,fG as ve,fH as Ce}from"./App-BI-uOpnP.js";import{R as L,m as U}from"./MainPane-LaEtxydD.js";import{T as ye,M as E}from"./MarkdownText-DJI5LwT0.js";import"./cloud-upload-BaQFNCTp.js";import"./arrow-up-right-CFGI2YSt.js";import"./square-CI1qNtvE.js";import"./folder-open-DZSxfPtr.js";import"./play-CGsWFR_B.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}
1
+ import{j as t,r as o}from"./index-BK8GmZmB.js";/* empty css */import{fA as G,X as R,aq as le,fB as re,fC as X,an as Y,at as de,aW as N,B as T,G as ce,a$ as me,b1 as ue,fD as ge,fE as he,fF as fe,b8 as xe,fG as ve,fH as Ce}from"./App-Dg6mZIQk.js";import{R as L,m as U}from"./MainPane-SMqq5YAM.js";import{T as ye,M as E}from"./MarkdownText-CLnvdLVg.js";import"./cloud-upload-B9L-_gy0.js";import"./arrow-up-right-C60QSULo.js";import"./square-Coz7UQqd.js";import"./folder-open-BFy7KXWm.js";import"./play-C4PtpamL.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-DOMrqhcz.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-BI-uOpnP.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-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}?
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
 
@@ -1 +1 @@
1
- import{r as h,j as e}from"./index-DOMrqhcz.js";import{bl as f,as as b,q as d,i as x,X as j}from"./App-BI-uOpnP.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
+ import{r as h,j as e}from"./index-BK8GmZmB.js";import{bl as f,as as b,q as d,i as x,X as j}from"./App-Dg6mZIQk.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-DOMrqhcz.js";import{bk as p,bK as j}from"./App-BI-uOpnP.js";import{M as x}from"./minimize-2-B01qSko4.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};
1
+ import{j as s}from"./index-BK8GmZmB.js";import{bk as p,bK as j}from"./App-Dg6mZIQk.js";import{M as x}from"./minimize-2-34MApatV.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};
@@ -1,4 +1,4 @@
1
- import{r as f,j as l}from"./index-DOMrqhcz.js";import{aq as ia,bl as kt,bB as la,a$ as oa,G as Te}from"./App-BI-uOpnP.js";import{A as sa}from"./arrow-up-right-CFGI2YSt.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-C24DAywn.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,`
1
+ import{r as f,j as l}from"./index-BK8GmZmB.js";import{aq as ia,bl as kt,bB as la,a$ as oa,G as Te}from"./App-Dg6mZIQk.js";import{A as sa}from"./arrow-up-right-C60QSULo.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-CN5hB6rV.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-DOMrqhcz.js";import{bK as X,q as y,al as Y,bB as B,G as w,c8 as Z}from"./App-BI-uOpnP.js";import{M as ee,d as _,s as te,T as ie}from"./MarkdownText-DJI5LwT0.js";import{F as W}from"./folder-open-DZSxfPtr.js";import{M as ne}from"./minimize-2-B01qSko4.js";import{P as E}from"./MainPane-LaEtxydD.js";import"./cloud-upload-BaQFNCTp.js";import"./arrow-up-right-CFGI2YSt.js";import"./square-CI1qNtvE.js";import"./play-CGsWFR_B.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-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};
@@ -0,0 +1,14 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspaceMonacoEditor-CJ3x0GHH.js","assets/index-BK8GmZmB.js","assets/index-C0H85uUI.css","assets/WorkspaceMonacoEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as l,_ as xa}from"./index-BK8GmZmB.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-CLnvdLVg.js";import{c as be,q as lt,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,bW as as,bX as za,bY as is,bZ as Wa,g as Ia,H as dn,E as Ba,b_ as Jt,b$ as Oa,c0 as rs,bu as Ce,c1 as Ua,c2 as Ks,c3 as Ha,c4 as Va,c5 as qs,c6 as Ga,c7 as Ka}from"./App-Dg6mZIQk.js";import{t as qa,a as Xa,b as Za,m as Qa,s as Ya,d as Ja,f as ei,c as ti}from"./training-model-data-CKOkpBBL.js";import{F as St}from"./folder-open-BFy7KXWm.js";import{I as Xs}from"./info-C8mwoaIJ.js";import{M as si}from"./minimize-2-34MApatV.js";import{S as ni}from"./save-DjB16eou.js";import{C as ai}from"./clipboard-QIy0Jd_K.js";const ii=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],ri=be("text-align-start",ii);const li=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],oi=be("chevrons-up",li);const ci=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],di=be("columns-2",ci);const ui=[["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"}]],fi=be("eye-off",ui);const pi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],hi=be("panel-top",pi);const mi=[["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"}]],xi=be("plug",mi);const bi=[["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"}]],gi=be("redo-2",bi);const ji=[["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"}]],vi=be("undo-2",ji);function ki({createRuntime:t,goalRuntime:s,subagentRuntime:n=null,onRunSubagentLifecycleAction:a}){const i=t?"Create/Improve Details":"Goal Details",d=t?Z(t.run.state):n?.activeCount?n.label:s?.actionLabel??"No active goal";return e.jsxs("div",{className:"goal-details-view","aria-label":i,children:[e.jsxs("div",{className:"goal-details-header",children:[e.jsxs("div",{className:"goal-details-title",children:[e.jsx(lt,{size:15,"aria-hidden":"true"}),e.jsx("span",{children:i})]}),e.jsx("span",{className:`goal-details-state ${Ii(t?.run.state??null)}`,children:d})]}),e.jsx("div",{className:"goal-details-body",children:t?e.jsx(wi,{runtime:t}):s||n?e.jsx(Si,{goalRuntime:s,subagentRuntime:n,onRunSubagentLifecycleAction:a}):e.jsx(Wi,{})})]})}function wi({runtime:t}){const s=t.run,n=s.plan,a=Hs(n?.metadata)??Hs(s.metadata),i=s.questions,d=i.filter(o=>o.status==="pending"),c=s.sourceRefs,u=s.checkRefs,h=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(h)],["Operation",s.operation],["Target",Z(s.target.kind)],["Name",s.target.displayName??s.target.id??"Pending"],["Target ID",s.target.id??"Pending"],["Default action",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"]]})]}):d.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||u.length?e.jsx(V,{title:"Run Refs",children:e.jsx(yt,{refs:[...c.map(o=>({id:`source:${o}`,primary:o,secondary:"Source ref"})),...u.map(o=>({id:`check:${o}`,primary:o,secondary:"Check ref"}))]})}):null,e.jsx(yi,{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 yi({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 Si({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(Ni,{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 Ni({runtime:t,onRunSubagentLifecycleAction:s}){const[n,a]=l.useState(null),[i,d]=l.useState(null);Ee(i);const c=async(u,h)=>{if(!s)return;const x=`${u}:${h}`;a(x),d(null);try{await s({runId:u,action:h})}catch(o){d(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",Ai(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",Li(t.usage.totalTokens,t.usage.requestCount)],["Evidence",String(t.evidenceRefs.length)],["Checks",String(t.testsRunCount)]]}),t.blockers.length>0?e.jsx("ul",{className:"goal-details-list compact",children:t.blockers.slice(0,4).map(u=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${u.status}`,children:u.status}),e.jsxs("div",{children:[e.jsx("strong",{children:Nt(u.roleId)}),e.jsx("p",{children:u.message})]})]},`${u.runId}:${u.message}`))}):null,e.jsx("ul",{className:"goal-details-list",children:t.runs.slice(0,8).map(u=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${u.status}`,children:u.status}),e.jsxs("div",{children:[e.jsx("strong",{children:Nt(u.roleId)}),e.jsx("p",{children:u.objective}),u.report?.summary?e.jsx("small",{children:u.report.summary}):null,s?e.jsx($i,{pendingAction:n,run:u,onRun:c}):null]})]},u.id))})]}),t.finalResults.length>0?e.jsx(Ci,{results:t.finalResults}):null]})}function Ci({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(Di),4)]}):null,s.blockers.length>0?e.jsxs("small",{children:["Blockers: ",$e(s.blockers,3)]}):null,s.workspaceRetention?e.jsxs("small",{children:["Workspace: ",_i(s.workspaceRetention)]}):null,s.importantMessages.length>0?e.jsxs("small",{children:["Messages: ",$e(s.importantMessages.map(Ti),2)]}):null]},s.runId))})})}function $i({pendingAction:t,run:s,onRun:n}){const a=Ri(s);return a.length===0?null:e.jsx("div",{className:"goal-details-actions",children:a.map(i=>{const d=`${s.id}:${i}`,c=t===d;return e.jsx("button",{type:"button",disabled:!!t,onClick:()=>{n(s.id,i)},children:c?"Working...":Fi(i)},i)})})}function Ri(t){const s=[],n=Ei(t),a=Pi(t);return n&&s.push("cleanup"),a&&s.push("archive"),s}function Fi(t){return t==="cleanup"?"Clean":t==="archive"?"Archive":"Clean + archive"}function Ei(t){if(!un(t))return!1;const s=rt(t.metadata);if(!s?.subagentWorkspace&&!s?.workspaceHandoff)return!1;const n=rt(s.lifecycleCleanup),a=rt(n?.workspaceCleanup),i=fn(a?.status);return i!=="removed"&&i!=="deleted"&&i!=="retained"&&i!=="skipped"}function Pi(t){if(!t.childSessionId||!un(t))return!1;const s=rt(rt(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 Ai(t){const s=t.latestMeaningfulUpdate;return s?`${Nt(s.roleId)} ${s.status}: ${s.message}`:"No structured update"}function Li(t,s){if(t<=0&&s<=0)return"0 tokens";const n=`${s} ${s===1?"request":"requests"}`;return`${Mi(t)} tokens · ${n}`}function Nt(t){return t.slice(0,1).toUpperCase()+t.slice(1).replace(/[-_]+/g," ")}function Di(t){return`${t.kind}: ${t.label}`}function Ti(t){return`${Z(t.kind)}: ${t.body}`}function _i(t){const s=t.expiresAt?`until ${zi(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 Mi(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 zi(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 Wi(){return e.jsxs("div",{className:"goal-details-empty",children:[e.jsx(lt,{size:18}),e.jsx("span",{children:"No active Goal or Create workflow."})]})}function V({children:t,title:s}){return e.jsxs("section",{className:"goal-details-section",children:[e.jsx("h2",{children:s}),t]})}function it({rows:t}){return e.jsx("dl",{className:"goal-details-grid",children:t.map(([s,n])=>e.jsxs("div",{children:[e.jsx("dt",{children:s}),e.jsx("dd",{children:n})]},s))})}function 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 rt(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 Ii(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 Bi({sandboxId:t,connection:s}){const[n,a]=l.useState(null),[i,d]=l.useState([]),[c,u]=l.useState(null),[h,x]=l.useState(null),[o,b]=l.useState(null),[S,k]=l.useState(null);Ee(o,{prefix:"Sandbox"}),Ee(S,{prefix:"Sandbox integrations"});const N=n?.integrationLeases??[],F=l.useMemo(()=>i.filter(v=>v.status==="active"),[i]),_=l.useMemo(()=>Ui(n),[n]),W=l.useCallback(async()=>{if(!s){b("OpenPond App server is not connected.");return}if(!t){a(null),d([]),b(null);return}u("summary"),b(null);try{const v=await z.sandbox(s,t),R=await z.integrationConnections(s,Qs(v.sandbox));a(v.sandbox),d(R.connections),k(null)}catch(v){b(v instanceof Error?v.message:String(v))}finally{u(null)}},[s,t]),G=l.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)]);d(v.connections),a(R.sandbox)}catch(v){k(v instanceof Error?v.message:String(v))}finally{x(null)}}},[s,n]),H=l.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=l.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 l.useEffect(()=>{W()},[W]),t?e.jsxs("div",{className:"sandbox-summary-tab",children:[e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Sandbox"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[n?e.jsx("span",{children:n.state}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh summary","aria-label":"Refresh summary",disabled:c!==null,onClick:()=>{W()},children:c==="summary"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(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:h!==null||!n,onClick:()=>{G()},children:h==="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"," / ",Gi(v)," / ",Oi(v)]})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:`Revoke ${ie(v.provider)} lease`,"aria-label":`Revoke ${ie(v.provider)} lease`,disabled:h!==null,onClick:()=>{I(v.leaseId)},children:h===`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:Vi(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=Hi(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:Ki(v)}),e.jsx("small",{children:qi(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||h!==null||M===0,onClick:()=>{H(v)},children:h===`attach:${v.id}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(xi,{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 Oi(t){return t.proxyUrl?"runtime proxy available":"metadata only, no runtime proxy"}function Ui(t){return t?.receipts?.at(-1)??null}function Hi(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 Vi(t,s){const n=Ft(t);return(n?Et(n):null)?.capabilities.find(i=>i.id===s)?.label??s}function Gi(t){return t.expiresAt?`expires ${pn(t.expiresAt)}`:"active"}function Ki(t){const s=t.providerAccountName?.trim();return s?`${ie(t.provider)} / ${s}`:ie(t.provider)}function qi(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 Xi({summary:t}){const s=qa(t.taskset),n=t.taskset.learningSignals.demonstrations.filter(u=>u.approved).length,a=t.taskset.tasks.filter(u=>u.split==="frozen_eval").length,i=t.plan?.recipe.method==="sft"||t.plan?.recipe.method==="grpo"?t.plan.recipe:null,d=Xa(t.taskset,t.plan),c=t.job?Za(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:Qa(t.taskset.name)}),e.jsx("span",{children:t.job?Ya(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:d}),e.jsx(U,{label:"Base model",value:i?.baseModel.id??"Not selected"}),e.jsx(U,{label:"Compute",value:t.plan?Ja(t.plan.destinationId):"Not selected"}),e.jsx(U,{label:"Started",value:ei(t.job?.startedAt??null)}),e.jsx(U,{label:"Duration",value:ti(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?`${d} 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 Zi(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 d=s,c="";for(let u=0;u<i.length;u+=1){const h=i[u];c=c?`${c}/${h}`:h;const x=!a&&u===i.length-1?"file":"folder",o=`${x}:${h}`;let b=d.childMap.get(o);b||(b=Js(h,c,x),d.childMap.set(o,b),d.children.push(b)),d=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 ls({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 Qi({changedByPath:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:d,onOpenFile:c,onSetFileBookmarkStatus:u,onToggleFolder:h}){const x=l.useMemo(()=>Zi(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:d,onOpenFile:c,onSetFileBookmarkStatus:u,onToggleFolder:h},`${o.type}:${o.path}`))})]})}function mn({changedByPath:t,depth:s=0,expandedFolderPaths:n,node:a,rootPath:i,selectedPath:d,getFileBookmarkStatus:c,onOpenFile:u,onSetFileBookmarkStatus:h,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:d,getFileBookmarkStatus:c,onOpenFile:u,onSetFileBookmarkStatus:h,onToggleFolder:x},`${N.type}:${N.path}`))]}):e.jsxs("div",{className:`workspace-file-tree-row file ${S?"changed":""} ${d===o?"selected":""}`,style:{paddingLeft:k},children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row-main",title:o,onClick:()=>u(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:()=>u(o,{source:!0}),children:"</>"}),h?e.jsx(ls,{className:"workspace-file-tree-bookmark-actions",currentStatus:c?.(o)??null,onSetStatus:N=>h(o,N)}):null]})}function en({diff:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:d,onOpenFile:c,onSetFileBookmarkStatus:u,onToggleFolder:h}){const x=t?.files??[],o=l.useMemo(()=>new Map(x.map(k=>[k.path,k])),[x]),b=n?.replace(/^\/+|\/+$/g,"")||null,S=l.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(Qi,{changedByPath:o,expandedFolderPaths:s,rootPath:b,repoFiles:S,selectedPath:i,getFileBookmarkStatus:d,onOpenFile:c,onSetFileBookmarkStatus:u,onToggleFolder:h})})}function Yi({collapsed:t,editorControlsVisible:s,hideWhiteSpace:n,loadFullFiles:a,renderMarkdown:i,wordDiffs:d,wordWrap:c,onClose:u,onCopyGitApply:h,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:u}),e.jsx(de,{checked:c,icon:e.jsx(ja,{size:14}),label:"Enable word wrap",onClick:_,onClose:u}),e.jsx(de,{checked:t,icon:e.jsx(oi,{size:14}),label:"Collapse all diffs",onClick:o,onClose:u}),e.jsx("div",{className:"workspace-diff-menu-divider"}),e.jsx(de,{checked:s,icon:e.jsx(hi,{size:14}),label:"Show editor controls",onClick:b,onClose:u}),e.jsx(de,{checked:i,icon:e.jsx(cn,{size:14}),label:"Render Markdown",onClick:N,onClose:u}),e.jsx(de,{checked:!a,icon:e.jsx(lt,{size:14}),label:"Show diffs first",onClick:k,onClose:u}),e.jsx(de,{checked:d,icon:e.jsx(ri,{size:14}),label:"Enable word diffs",onClick:F,onClose:u}),e.jsx(de,{checked:n,icon:e.jsx(fi,{size:14}),label:"Hide white space",onClick:S,onClose:u}),e.jsx(de,{icon:e.jsx(ai,{size:14}),label:"Copy git apply command",onClick:h,onClose:u})]})}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 Ji({addMenuOpen:t,expanded:s,filteredFiles:n,dirtyFilePaths:a,openFiles:i,goalDetailsAvailable:d,searchOpen:c,searchQuery:u,selectedPath:h,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=l.useRef(null);l.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 le(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:le,children:[d?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="goal"?"active":""}`,role:"tab","aria-selected":k==="goal",onClick:te,children:[e.jsx(lt,{size:14}),e.jsx("span",{children:"Goal"})]}):null,o&&q?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="summary"?"active":""}`,role:"tab","aria-selected":k==="summary",onClick:q,children:[e.jsx(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"&&h===w.path?"active":""}`,children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab","aria-selected":k==="file"&&h===w.path,title:w.path,onClick:()=>M(w.path),children:[e.jsx(lt,{className:"workspace-diff-tab-icon",size:13}),a.has(w.path)&&e.jsx("span",{className:"workspace-diff-tab-dirty","aria-hidden":"true"}),e.jsx("span",{children:w.path.split("/").pop()})]}),D?e.jsx(ls,{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:u,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(si,{size:14}):e.jsx(Ta,{size:14})})]})}function er({canCheckActiveFile:t,canSaveActiveFile:s,collapsed:n,editorControlsVisible:a,editorDiagnosticStatus:i,editorDiagnosticsChecking:d,hideWhiteSpace:c,loadFullFiles:u,menuOpen:h,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":h,onClick:()=>E(),children:e.jsx(_a,{size:15})}),h&&e.jsx(Yi,{collapsed:n,editorControlsVisible:a,hideWhiteSpace:c,loadFullFiles:u,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(ni,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Undo","aria-label":"Undo",onClick:H,children:e.jsx(vi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Redo","aria-label":"Redo",onClick:W,children:e.jsx(gi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Check file","aria-label":"Check file",disabled:!t,onClick:_,children:d?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(di,{size:14})})]})})}const tr={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 tr[n]??"text"}function sr(t,s){return t?s==="markdown"?nr(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 nr(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 ar(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 d=i.index??0;d>a&&n.push({text:t.slice(a,d),kind:"plain"});const c=i[0];if(n.push({text:c,kind:ar(c)}),a=d+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:sr(s,t).map((n,a)=>e.jsx("span",{className:`syntax-token ${n.kind}`,children:n.text},`${a}-${n.text}`))})}const ir=`
3
+
4
+ [file truncated]`,rr=l.lazy(()=>xa(()=>import("./WorkspaceMonacoEditor-CJ3x0GHH.js").then(t=>t.jc),__vite__mapDeps([0,1,2,3]))),ts=6,lr=18,Re=22,tn=44,or=160,sn=12;function $t({path:t,workspaceName:s,workspaceRootPath:n,onSelectPath:a}){const i=is(t,n),d=Wa(i),c=d?cr(i):s?.trim()||"Workspace",h=(d&&c!=="/"&&i.startsWith(`${c}/`)?i.slice(c.length+1):i).split("/").filter(Boolean),x=!!(a&&!d);return e.jsxs("span",{className:"workspace-file-breadcrumbs",title:d?i:`${c} > ${i}`,children:[a&&!d?e.jsx("button",{type:"button",onClick:()=>a(null),children:c}):e.jsx("span",{children:c}),h.map((o,b)=>{const S=b===h.length-1,k=h.slice(0,b+1).join("/");return e.jsxs("span",{className:"workspace-file-breadcrumb-segment",children:[e.jsx(Ia,{size:13}),a&&x&&!S?e.jsx("button",{type:"button",onClick:()=>a(k),children:o}):e.jsx("span",{children:o})]},`${b}-${o}`)})]})}function cr(t){const s=/^[A-Za-z]:\//.exec(t);return s?s[0].slice(0,-1):"/"}function dr({collapsed:t=!1,diagnostics:s=[],draftContent:n,editable:a=!1,editorRef:i,error:d,file:c,hideWhiteSpace:u=!1,headerActions:h,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(d,{prefix:"File preview"}),Ee(G,{prefix:"Save failed"});const E=n??c.content??"",te=l.useMemo(()=>E.split(`
5
+ `).slice(0,800),[E]),q=os(c.path),X=n!=null||c.content!=null,B=E.endsWith(ir),Q=W&&X&&as(c.path),se=X&&za(c.path)&&mr(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]})]}),h]}),e.jsx("div",{className:"workspace-file-image-stage",children:e.jsx("button",{type:"button",className:"workspace-file-image-button","aria-label":`Open image preview for ${c.path}`,onClick:S,children:e.jsx("img",{alt:c.path,decoding:"async",src:x})})})]}):!b&&c.patch||!X&&c.patch?I?e.jsx(fr,{collapsed:t,file:c,hideWhiteSpace:u,onSelectBreadcrumbPath:k,wordDiffs:v,wordWrap:R,headerActions:h,workspaceName:D,workspaceRootPath:M}):e.jsx(ur,{collapsed:t,file:c,hideWhiteSpace:u,wordWrap:R,workspaceName:D,workspaceRootPath:M,onSelectBreadcrumbPath:k,headerActions:h}):e.jsxs("div",{className:`workspace-file-preview ${R?"wrap":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx($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,h]})]}),X?Q?e.jsx("div",{className:"workspace-markdown-preview",children:e.jsx(va,{content:E})}):se?e.jsx(pr,{file:c,contentBase64:E}):a&&!B?e.jsx(l.Suspense,{fallback:e.jsx("div",{className:"workspace-diff-code-empty",children:"Loading editor"}),children:e.jsx(rr,{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,le)=>e.jsxs("div",{className:"workspace-file-code-row",children:[e.jsx("span",{children:le+1}),e.jsx("code",{children:e.jsx(Ct,{language:q,text:Y||" "})})]},`${le}-${Y}`))}):e.jsx("div",{className:"workspace-diff-code-empty",children:o?"Loading file content":"No file content available."})]})}function ur({collapsed:t=!1,file:s,hideWhiteSpace:n=!1,wordWrap:a,workspaceName:i,workspaceRootPath:d,onSelectBreadcrumbPath:c,headerActions:u}){const h=l.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:d,onSelectPath:c}),e.jsxs("span",{className:"diff-addition",children:["+",s.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",s.deletions]})]}),u]}),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:h,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 fr({collapsed:t,file:s,hideWhiteSpace:n,wordDiffs:a,wordWrap:i,workspaceName:d,workspaceRootPath:c,onSelectBreadcrumbPath:u,headerActions:h}){const x=l.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:d,workspaceRootPath:c,onSelectPath:u}),e.jsxs("span",{className:"diff-addition",children:["+",s.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",s.deletions]})]}),e.jsxs("span",{className:"workspace-file-heading-end",children:[h,e.jsx(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 pr({file:t,contentBase64:s}){const n=l.useMemo(()=>{const a=xr(s);if(!a)return null;const i=new Blob([new Uint8Array(a)],{type:hr(t.path)});return URL.createObjectURL(i)},[s,t.path]);return l.useEffect(()=>()=>{n&&URL.revokeObjectURL(n)},[n]),n?e.jsxs("div",{className:"workspace-document-preview",children:[e.jsxs("div",{className:"workspace-document-preview-card",children:[e.jsx("strong",{children:t.path.split("/").pop()}),e.jsx("span",{children:/\.pdf$/i.test(t.path)?"PDF document":"Word document"}),e.jsx("a",{href:n,download:t.path.split("/").pop()||"document",children:"Download document"})]}),e.jsx("iframe",{src:n,title:`${t.path} preview`})]}):e.jsx("div",{className:"workspace-diff-code-empty",children:"Document preview unavailable."})}function hr(t){return/\.pdf$/i.test(t)?"application/pdf":/\.docx$/i.test(t)?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"application/msword"}function mr(t){return t.length>0&&/^[A-Za-z0-9+/=\s]+$/.test(t)}function xr(t){try{const s=atob(t.replace(/\s/g,"")),n=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)n[a]=s.charCodeAt(a);return n}catch{return null}}function xn({ariaLabel:t,className:s,emptyMessage:n,rows:a,renderRow:i,wordWrap:d}){const c=!d&&a.length>or,{endIndex:u,offsetTop:h,scrollRef:x,startIndex:o,totalHeight:b}=br(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(${h}px)`},children:a.slice(o,u).map((S,k)=>i(S,o+k))})})}):e.jsx("div",{className:s,role:"table","aria-label":t,children:a.map(i)})}function br(t,s){const n=l.useRef(null),[a,i]=l.useState({height:Re*tn,scrollTop:0}),d=l.useCallback(()=>{const x=n.current;x&&i({height:x.clientHeight||Re*tn,scrollTop:x.scrollTop})},[]);if(l.useEffect(()=>{if(!s)return;const x=n.current;if(!x)return;d();let o=0;const b=()=>{if(typeof window>"u"){d();return}window.cancelAnimationFrame(o),o=window.requestAnimationFrame(d)};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,d]),!s)return{endIndex:t,offsetTop:0,scrollRef:n,startIndex:0,totalHeight:t*Re};const c=Math.ceil(a.height/Re),u=Math.max(0,Math.floor(a.scrollTop/Re)-sn);return{endIndex:Math.min(t,u+c+sn*2),offsetTop:u*Re,scrollRef:n,startIndex:u,totalHeight:t*Re}}function bn(t,s){if(!t.trim())return[];const n=[];let a=0,i=0,d=null,c=null,u=!1,h=[];function x(){n.push(...gr(h)),h=[]}function o(){u&&(x(),d=a,c=i,u=!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(d!==null&&c!==null){const W=Math.max(F-d,_-c,0);W>0&&n.push({kind:"spacer",label:gn(W)})}a=F,i=_,u=!0;continue}if(b.startsWith("diff --git")||b.startsWith("index ")||b.startsWith("--- ")||b.startsWith("+++ ")||!u||b.startsWith("\\ No newline"))continue;const k=b.slice(1)||" ";if(s&&!k.trim())continue;if(b.startsWith("+")){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()||(h.push({kind:"context",oldLine:String(a||""),newLine:String(i||""),oldContent:N,newContent:N}),a+=1,i+=1)}return o(),n}function gr(t){if(t.length<lr)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]`,jr="openpond.sandboxSourceReadback.v1";async function vr(t,s,n,a=[]){let i;try{i=await z.sandboxDownloadFile(t,s,n,{maxBytes:256*1024})}catch(c){const u=c instanceof Error?c.message:String(c);if(!kr(u))throw c;const h=Sr(a,s,n);if(h)return h;const x=!!cs(a,s)?.artifact,o=await z.sandbox(t,s).catch(()=>null);throw new Error(wr(n,o?.sandbox??null,u,{hasReadbackArtifact:x}))}const d=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:d}}function kr(t){return t.includes("sandbox_not_ready")&&t.includes("placement_stale")||t.includes("sandbox_not_running")}function wr(t,s,n="sandbox_not_ready:placement_stale",a={}){const i=s?Nr(s):null,d=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 ${d} 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 ${d}. ${n}`;const c=i.preservedSha?i.preservedSha.slice(0,12):null,u=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}`:""}${u}, but this Desktop app cannot read file bodies from preserved source refs yet. Resume the sandbox to inspect ${d}.`}function yr(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 u of ds(a))i.set(u.path,u);for(const u of kn(n.artifact)){const h=jn(n.artifact,u.path);h&&i.set(u.path,h)}const d=[...i.values()].sort((u,h)=>u.path.localeCompare(h.path)),c=[...new Set(d.map(u=>u.path))].sort((u,h)=>u.localeCompare(h));return{appId:s,repoPath:"",initialized:!0,dirty:!1,filesChanged:d.length,additions:d.reduce((u,h)=>u+h.additions,0),deletions:d.reduce((u,h)=>u+h.deletions,0),repoFiles:c,files:d,error:null,updatedAt:Ue(re(n.artifact)?.createdAt)??n.event.timestamp}}function Sr(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=re(a.data),d=re(i?.sourcePreservation),c=re(d?.sourceReadbackArtifact);if(c&&c.schemaVersion===jr&&c.sandboxId===s)return{artifact:c,event:a}}return null}function jn(t,s){const n=ds(vn(t)).find(d=>d.path===s),a=kn(t).find(d=>d.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=re(t.patch);return typeof s?.text=="string"?s.text:""}function kn(t){return(Array.isArray(t.files)?t.files:[]).map(n=>{const a=re(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 Nr(t){const s=re(t.metadata)??{},n=re(s.sourcePreservation)??re(s.sourcePreserve),a=re(s.sourceChangeDetection),i=Ue(n?.preservedSha)??Ue(a?.preservedSha)??null,d=Ue(n?.sourceRef)??Ue(a?.sourceRef)??(typeof t.repoRef=="string"?t.repoRef:null);return!i&&!d?null:{preservedSha:i,sourceRef:d}}function re(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 Cr(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 $r(t){return t.filter(s=>s.type==="file").map(s=>s.path).sort((s,n)=>s.localeCompare(n))}function Rr(t,s){const n=new Map;for(const a of ds(t?.diff??""))n.set(a.path,a);for(const a of Fr(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:Pr(i)??"changed-file",status:"M",additions:0,deletions:0,patchLines:[i]};continue}if(n){if(n.patchLines.push(i),i.startsWith("+++ ")){const d=nn(i.slice(4));d&&(n.path=d);continue}if(i.startsWith("--- ")){const d=nn(i.slice(4));d&&n.path==="changed-file"&&(n.path=d);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 Fr(t){const s=[];for(const n of t.split(`
11
+ `)){if(!n.trim())continue;const a=Er(n);a&&s.push({path:a,status:n.slice(0,2).trim()||"M",additions:0,deletions:0,patch:"",content:null})}return s}function Er(t){const s=t.slice(3).trim();return s?s.split(" -> ").pop()?.trim()||s:null}function Pr(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 Ar(t){try{dn.setItem(wn,String(t))}catch{}}function Lr({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 d=t.filter(x=>x.severity==="error").length;if(d>0)return{label:`${d} error${d===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 u=t.length;if(u>0)return{label:`${u} note${u===1?"":"s"}`,severity:"info"};if(!s)return null;const h=s.find(x=>x.status!=="connected");return h?{label:h.id==="none"?"No LSP":`${h.id} unavailable`,severity:"unavailable"}:{label:"No issues",severity:"none"}}const rn=3e3,Dr=2e3,ln=[],Tr=[];function _r({appId:t,workspaceId:s,workspaceKind:n,connection:a,runtimeEvents:i,diff:d,editorPreferences:c,loading:u,workspaceName:h,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:le=null,onSetSidebarFileStatus:w}){return e.jsx(Br,{appId:t,workspaceId:s,workspaceKind:n,connection:a,runtimeEvents:i??[],diff:d,editorPreferences:c??null,loading:u,workspaceName:h,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:le,onSetSidebarFileStatus:w})}function Mr(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??rs(a)}function ss(t){return!!(t.patch||t.content!=null)}function zr({changedFiles:t,checkpointStatus:s,dirty:n,error:a,loading:i,preservedReadback:d,sandboxMode:c,sourcePending:u}){if(u)return{label:"sandbox pending",tone:"loading"};if(i)return{label:"refreshing",tone:"loading"};if(c&&d&&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 h=Math.max(1,t),x=h===1?"change":"changes";return{label:c?`${h} unpreserved ${x}`:`${h} local ${x}`,tone:"dirty"}}return{label:c?"sandbox clean":"local clean",tone:"clean"}}function Wr(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,d=i?.sourcePreservation&&typeof i.sourcePreservation=="object"&&!Array.isArray(i.sourcePreservation)?i.sourcePreservation:null;if(d?.attempted===!0&&d.sandboxId===s)return d.ok!==!0?{label:"checkpoint failed",tone:"error"}:d.preserved===!0?{label:"checkpoint saved",tone:"clean"}:{label:"checkpoint clean",tone:"clean"}}return null}function Ir(t){const s=t.split("/").filter(Boolean);return s.map((n,a)=>s.slice(0,a+1).join("/"))}function Br({appId:t,workspaceId:s,workspaceKind:n,connection:a,runtimeEvents:i,diff:d,editorPreferences:c,loading:u,workspaceName:h,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:le,onSetSidebarFileStatus:w}){const O=H??Ka(),[A,T]=l.useState(O.activeTab),[Pt,Pe]=l.useState(!1),[ot,oe]=l.useState(!1),[yn,ne]=l.useState(!1),[At,Lt]=l.useState(""),[J,He]=l.useState(()=>[...O.openFilePaths]),[j,ge]=l.useState(O.selectedPath),[us,Sn]=l.useState(!1),[fs,Nn]=l.useState(!1),[Ae,Cn]=l.useState(!1),[Dt,$n]=l.useState(!0),[ps,hs]=l.useState(an);Ba(()=>hs(an()));const[ms,Rn]=l.useState(!1),[xs,Fn]=l.useState(!1),[bs,En]=l.useState(!1),[ae,Le]=l.useState({}),[ct,dt]=l.useState(()=>new Set),[gs,ut]=l.useState({}),[ue,Ve]=l.useState({}),[js,Tt]=l.useState(()=>new Set),[Ge,Ke]=l.useState(null),[Pn,_t]=l.useState(!1),[vs,qe]=l.useState(null),[ks,Mt]=l.useState({}),[An,zt]=l.useState({}),[Ln,Wt]=l.useState(null),[Dn,je]=l.useState(null),[ws,It]=l.useState(null),[Tn,ve]=l.useState(null);Ee(o,{prefix:"Workspace"}),Ee(vs,{prefix:"Sandbox files"});const[Bt,ft]=l.useState(null),[_n,Xe]=l.useState({}),[pt,Ot]=l.useState(null),[De,ht]=l.useState(null),[mt,xt]=l.useState(null),ee=c??Va.editor,ys=l.useRef(ae),Ut=l.useRef(Jt(O)),Ht=l.useRef(Jt(O)),Ss=l.useRef(null),Vt=l.useRef(I),ce=l.useRef(!1),Ze=l.useRef(null),Qe=l.useRef(0),fe=l.useRef(null),Ye=l.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=l.useRef(bt),pe=!!(B?.createRuntime||B?.goalRuntime||B?.subagentRuntime),_e=l.useCallback(async(r={})=>{if(C){if(!a){Ke(null),qe("OpenPond App server is not connected.");return}if(!P){Ke(null),qe(null);return}r.silent||_t(!0);try{const[m,f,g]=await Promise.allSettled([z.sandboxFiles(a,P,{recursive:!0,maxEntries:Dr}),z.sandboxGitStatus(a,P),z.sandboxGitDiff(a,P,{})]);if(m.status==="rejected")throw m.reason;const y=$r(m.value.files),p=f.status==="fulfilled"?f.value.status:null,$=g.status==="fulfilled"?g.value.diff:null,L=Rr($,p),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:p?!p.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{r.silent||_t(!1)}}},[a,P,C]),$s=l.useMemo(()=>yr(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:d,Je=he?.repoPath??null,zn=l.useMemo(()=>Wr(i,P),[i,P]),Me=he?.files??ln,Fs=he?.files??ln,ke=l.useMemo(()=>new Map(Fs.map(r=>[r.path,r])),[Fs]),we=l.useMemo(()=>new Map(Me.map(r=>[r.path,r])),[Me]),ze=he?.repoFiles??(Me.length>0?Me.map(r=>r.path):Tr),We=l.useMemo(()=>Me.filter(r=>!Oa(r,ze)),[ze,Me]),ye=l.useMemo(()=>mt&&!ze.includes(mt)?[mt,...ze]:ze,[ze,mt]),Es=l.useMemo(()=>J.map(r=>ke.get(r)??ae[r]??we.get(r)??rs(r)),[ke,we,ae,J]),gt=l.useMemo(()=>{const r={};for(const m of J){if(Ce(m))continue;const f=ke.get(m)??ae[m]??we.get(m)??rs(m);f.content!=null&&(r[m]=f.content)}return r},[ke,we,ae,J]),Ie=l.useMemo(()=>{const r=new Set;for(const[m,f]of Object.entries(ue))f.content!==f.savedContent&&r.add(m);return r},[ue]),Wn=l.useMemo(()=>{const r=At.trim().toLowerCase(),m=ye;return r?m.filter(f=>f.toLowerCase().includes(r)):m},[ye,At]),Gt=l.useMemo(()=>({activeTab:A,openFilePaths:J,selectedPath:j}),[A,J,j]);l.useEffect(()=>{ys.current=ae},[ae]),l.useEffect(()=>{Ze.current=pt},[pt]),l.useEffect(()=>{Ve(r=>{let m=!1;const f={...r},g=new Set(J),y=d?.updatedAt?Date.parse(d.updatedAt):null;for(const[p,$]of Object.entries(f))g.has(p)||$.content!==$.savedContent||(delete f[p],m=!0);for(const[p,$]of Object.entries(gt)){const L=f[p];if(!L){f[p]={content:$,savedContent:$},m=!0;continue}if(L.content===L.savedContent&&L.savedContent!==$){if(L.savedAt&&(y===null||y<L.savedAt))continue;f[p]={content:$,savedContent:$},m=!0}}return m?f:r})},[d?.updatedAt,gt,J]),l.useEffect(()=>{Vt.current=I},[I]),l.useEffect(()=>{if(!H)return;const r=Ua(H,Je);Ks(Ut.current,r)||(Ut.current=r,Ht.current=r,T(r.activeTab),He(r.openFilePaths),ge(r.selectedPath))},[H,Je]),l.useEffect(()=>{if(ct.size>0||Ks(Ht.current,Gt))return;const r=Jt(Gt);Ht.current=r,Ut.current=r,E?.(r)},[Gt,E,ct]),l.useEffect(()=>{F||C||!a||!t||!x||d||o||ce.current||(ce.current=!0,Promise.resolve(Vt.current({silent:!0})).catch(()=>{}).finally(()=>{ce.current=!1}))},[t,a,d,F,C,o,x]),l.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]),l.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]),l.useEffect(()=>{if(!C||(_e(),!a||!P))return;let r=!1;async function m(){if(!(r||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()},rn),g=()=>{m()};return window.addEventListener("focus",g),()=>{r=!0,window.clearInterval(f),window.removeEventListener("focus",g)}},[a,_e,P,C]),l.useEffect(()=>{if(F||C||!a||!t||!x)return;let r=!1;async function m(){if(!(r||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()},rn),g=()=>{m()};return window.addEventListener("focus",g),()=>{r=!0,window.clearInterval(f),window.removeEventListener("focus",g)}},[t,a,F,C,x]),l.useEffect(()=>{if(C||!a||!t||n==="local_project"){xt(null);return}let r=!1;return z.workspaceTemplateConfig(a,t).then(m=>{r||xt(m.exists?m.configPath??Ha:null)}).catch(()=>{r||xt(null)}),()=>{r=!0}},[t,a,C,n]),l.useEffect(()=>{!j||ye.includes(j)||J.includes(j)||ge(We[0]?.path??null)},[We,J,ye,j]),l.useEffect(()=>{B?.active&&pe&&T("goal")},[B?.active,pe]),l.useEffect(()=>{G&&T(G.tab)},[G]),l.useEffect(()=>{!pe&&A==="goal"&&T("files")},[A,pe]),l.useEffect(()=>{!Te&&A==="summary"&&T("files")},[A,Te]);const K=A==="file"||k&&A==="files"?j:null;l.useEffect(()=>{if(!a||!K)return;if(Ce(K)){ve(null),je(p=>p===K?null:p);return}const r=Bt?.path===K,m=et(K);if(F&&(m?.content!=null||m?.patch)){ve(null),je(p=>p===K?null:p);return}if(!r&&(m?.content!=null||m?.patch&&!Ae)){ve(null),je(p=>p===K?null:p);return}let f=!1;const g=ys.current[K];return g?.content==null&&(Ae||!g?.patch)&&je(K),ve(null),(C?P?vr(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(p=>{f||Le($=>{const L=$[p.path];return L?.content===p.content&&L.patch===p.patch&&L.status===p.status?$:{...$,[p.path]:p}})}).catch(p=>{f||ve(p instanceof Error?p.message:String(p))}).finally(()=>{f||(je(p=>p===K?null:p),ft(p=>p&&p.id===Bt?.id&&p.path===K?null:p))}),()=>{f=!0}},[A,t,a,Bt,Ae,F,i,Q?.emptyMessage,P,C,K]);function jt(r,m){It(null);const f=C?P:t;if(Os(r)&&!m?.source&&a&&f){wa(a,f,r,C?"sandbox":"local").then(M).catch(y=>It(y instanceof Error?y.message:"Could not open HTML preview."));return}const g=is(r,Je);g&&(dt(y=>{if(!y.has(g))return y;const p=new Set(y);return p.delete(g),p}),Le(y=>{if(!(g in y))return y;const p={...y};return delete p[g],p}),ut(y=>{if(!(g in y))return y;const p={...y};return delete p[g],p}),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(r,m,f=!1){if(Os(r.path)&&r.content!=null&&!f&&a){ya(a,r.path,r.content).then(M).catch(p=>It(p instanceof Error?p.message:"Could not open HTML preview."));return}const g=is(r.path,Je);if(!g)return;const y={...r,path:g};Le(p=>({...p,[g]:y})),dt(p=>{const $=new Set(p);return $.add(g),$}),ut(p=>{if(!m){if(!(g in p))return p;const $={...p};return delete $[g],$}return p[g]===m?p:{...p,[g]:m}}),ft(null),ve(null),je(null),k||He(p=>p.includes(g)?p:[...p,g]),ge(g),T(k?"files":"file"),oe(!1),ne(!1),Lt("")}const Bn=l.useCallback(()=>{hs(r=>{const m=!r;return Ar(m),m})},[]),et=r=>Mr(ke.get(r),ae[r],we.get(r),r),On=l.useCallback((r,m)=>{Ve(f=>{const g=f[r],y=g?.savedContent??gt[r]??et(r).content??"";return{...f,[r]:{content:m,savedContent:y,savedAt:g?.savedAt}}}),Xe(f=>{if(!(r in f))return f;const g={...f};return delete g[r],g})},[ke,we,ae,gt]),Be=l.useCallback(async(r,m={})=>{if(C||!a||!t||Ce(r))return;const f=et(r),g=m.content??ue[r]?.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 p=new AbortController;fe.current=p,Wt(r);try{const $=await z.workspaceLspTouch(a,t,{path:r,content:g,waitForDiagnostics:m.waitForDiagnostics??!0},{signal:p.signal});if(y!==Qe.current)return;Mt(L=>({...L,[$.path]:$.diagnostics})),zt(L=>({...L,[$.path]:$.servers}))}catch($){if(p.signal.aborted||y!==Qe.current)return;const L=$ instanceof Error?$.message:String($);Mt(at=>({...at,[r]:[]})),zt(at=>({...at,[r]:[{id:"lsp",root:"",status:"error",message:L}]}))}finally{if(fe.current===p&&(fe.current=null),p.signal.aborted)return;y===Qe.current&&Wt($=>$===r?null:$)}},[t,a,ke,we,ue,ae,C]),Un=l.useCallback(async r=>{if(C||!a||!t)throw new Error("Workspace LSP is unavailable.");return z.workspaceLspAction(a,t,r)},[t,a,C]),tt=l.useCallback(async r=>{if(!a||!t&&!P||Ze.current===r)return;const m=ue[r];if(!m||m.content===m.savedContent)return;const f=m.content,g=Date.now();Ze.current=r,Ot(r),Xe(y=>{if(!(r in y))return y;const p={...y};return delete p[r],p});try{const y=C?await Cr(a,P,r,f):await z.saveWorkspaceFile(a,t,{path:r,content:f});Le(p=>({...p,[y.path]:y})),Ve(p=>{const $=p[r];return $?{...p,[r]:{content:$.content,savedContent:f,savedAt:g}}:p}),ee.languageServers!=="off"&&ee.checkOnSave&&await Be(r,{content:f,waitForDiagnostics:!0}),C?await _e({silent:!0}):await I({silent:!0})}catch(y){Xe(p=>({...p,[r]:y instanceof Error?y.message:String(y)}))}finally{Ze.current===r&&(Ze.current=null),Ot(y=>y===r?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));l.useEffect(()=>{if(ee.languageServers==="off"||!ee.diagnosticsWhileEditing||!j||!Kt||Se==null)return;const r=window.setTimeout(()=>{Be(j,{content:Se,waitForDiagnostics:!0})},700);return()=>window.clearTimeout(r)},[ee.diagnosticsWhileEditing,ee.languageServers,Be,Se,Kt,j]),l.useEffect(()=>{function r(m){!(m.ctrlKey||m.metaKey)||m.key.toLowerCase()!=="s"||A!=="file"||!j||(m.preventDefault(),Ie.has(j)&&tt(j))}return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[A,Ie,tt,j]);const Vn=l.useCallback(()=>{j&&(Ye.current?Ye.current.save():tt(j))},[tt,j]),Gn=l.useCallback(()=>{Ye.current?.undo()},[]),Kn=l.useCallback(()=>{Ye.current?.redo()},[]),qn=l.useCallback(()=>{j&&ee.languageServers!=="off"&&Be(j,{content:Se??void 0,waitForDiagnostics:!0})},[ee.languageServers,Be,Se,j]);function Xn(r,m){if(m.stopPropagation(),!(Ie.has(r)&&!window.confirm(`Discard unsaved changes to ${r}?`))&&(Ie.has(r)&&(Ve(f=>{if(!(r in f))return f;const g={...f};return delete g[r],g}),Xe(f=>{if(!(r in f))return f;const g={...f};return delete g[r],g})),He(f=>f.filter(g=>g!==r)),ct.has(r)&&Le(f=>{if(!(r in f))return f;const g={...f};return delete g[r],g}),ut(f=>{if(!(r in f))return f;const g={...f};return delete g[r],g}),dt(f=>{if(!f.has(r))return f;const g=new Set(f);return g.delete(r),g}),j===r)){const f=Es.find(g=>g.path!==r)??null;ge(f?.path??We[0]?.path??null),f||T("files")}}function Zn(){T("files"),oe(!1),ne(!1)}function As(r){Tt(m=>{const f=new Set(m);return f.has(r)?f.delete(r):f.add(r),f})}function Qn(r){r&&Tt(m=>{const f=new Set(m);for(const g of Ir(r))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:u,Ds=C?vs:o,ia=zr({changedFiles:he?.filesChanged??We.length,checkpointStatus:zn,dirty:!!he?.dirty,error:Ds,loading:Ls,preservedReadback:Mn,sandboxMode:C,sourcePending:C&&!P}),ra=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,la=!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,la),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=l.useMemo(()=>Lr({activeDiagnostics:Ws,activeServers:Is,editorDiagnosticsChecking:Xt,editorLspEnabled:nt,showEditorCommandBar:Zt}),[Ws,Is,Xt,nt,Zt]),pa=l.useCallback(async r=>{if(!a)throw new Error("OpenPond server connection is unavailable.");await z.runSubagentLifecycleAction(a,r.runId,{action:r.action,reason:"User requested from Goal details."}),await I({silent:!0})},[a,I]),xe=C?"sandbox":n==="local_project"?"local":null,vt=l.useMemo(()=>{const r=new Map;if(!xe||!s)return r;for(const m of Y)m.workspaceKind!==xe||m.workspaceId!==s||r.set(m.path,m);return r},[Y,xe,s]),kt=l.useCallback(r=>{try{return vt.get(qs(r))?.status??null}catch{return null}},[vt]),wt=l.useCallback((r,m)=>{if(!xe||!s||!h||!w)return;let f;try{f=qs(r)}catch{return}const g=vt.get(f),y=new Date().toISOString(),p=g??{id:Ga({workspaceKind:xe,workspaceId:s,path:f}),workspaceKind:xe,workspaceId:s,workspaceName:h,path:f,status:"pinned",order:null,sourceSessionId:le,available:!0,createdAt:y,updatedAt:y};w(p,m)},[w,vt,le,xe,s,h]),Ne=!!(xe&&s&&h&&w),ha=j&&Ne&&!st?e.jsx(ls,{currentStatus:kt(j),onSetStatus:r=>wt(j,r)}):null,Bs=j?e.jsx(dr,{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:r=>On(j,r),onLspAction:nt?Un:void 0,onSave:()=>{tt(j)},onSelectBreadcrumbPath:Qn,renderMarkdown:Dt,splitView:bs,wordDiffs:ms,wordWrap:us,workspaceName:h,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(Ji,{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:r=>{ge(r),T("file")},onSelectFiles:Zn,onSelectGoal:()=>T("goal"),onSelectSummary:()=>{T("summary"),oe(!1),ne(!1)},onSelectSideChat:X,onToggleAddMenu:()=>{oe(r=>!r),ne(!1)},onToggleExpanded:R}),ws&&e.jsx("div",{className:"workspace-diff-empty",role:"alert",children:ws}),me==="goal"&&pe?e.jsx(ki,{createRuntime:B?.createRuntime??null,goalRuntime:B?.goalRuntime??null,subagentRuntime:B?.subagentRuntime??null,onRunSubagentLifecycleAction:a?pa:void 0}):me==="summary"&&Te?se?e.jsx(Xi,{summary:se}):e.jsx(Bi,{sandboxId:P,connection:a}):sa?e.jsxs(e.Fragment,{children:[e.jsx(er,{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(r=>!r),onToggleEditorControlsVisible:Bn,onToggleHideWhiteSpace:()=>Fn(r=>!r),onToggleLoadFullFiles:()=>Cn(r=>!r),onToggleMenu:r=>Pe(m=>r??!m),onToggleRenderMarkdown:()=>$n(r=>!r),onToggleSplitView:()=>En(r=>!r),onToggleWordDiffs:()=>Rn(r=>!r),onToggleWordWrap:()=>Sn(r=>!r)}),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:ra})})]}),e.jsx(Sa,{open:!!Ms,src:Ms,title:De??"",onClose:()=>ht(null)})]})}const Qr=Object.freeze(Object.defineProperty({__proto__:null,WorkspaceDiffPanel:_r},Symbol.toStringTag,{value:"Module"}));export{di as C,_r as W,Qr as a};