openpond 0.2.29 → 0.2.31

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 (168) hide show
  1. package/dist/api/types.d.ts +8 -0
  2. package/dist/app-server.d.ts +27797 -513
  3. package/dist/app-server.js +1 -1
  4. package/dist/chunks/{actions-command-NOCBOF5S.js → actions-command-6LFZFTLA.js} +1 -1
  5. package/dist/chunks/{app-layer-GLXYIT4B.js → app-layer-ZZHTHTJU.js} +1 -1
  6. package/dist/chunks/app-server-runtime-256UCS6N.js +2 -0
  7. package/dist/chunks/{apps-YSWZT656.js → apps-C2BMJ7DO.js} +1 -1
  8. package/dist/chunks/{chunk-GOQDMRUV.js → chunk-34URWDE7.js} +1 -1
  9. package/dist/chunks/chunk-4476RDBS.js +41 -0
  10. package/dist/chunks/{chunk-J3ZRHNGL.js → chunk-4QX2I2DX.js} +1 -1
  11. package/dist/chunks/{chunk-TOIG2PMH.js → chunk-55UCBRIX.js} +1 -1
  12. package/dist/chunks/{chunk-2LSP2AAN.js → chunk-5BFWDFPX.js} +1 -1
  13. package/dist/chunks/{chunk-JPCPNW6T.js → chunk-B5LKUQGM.js} +1 -1
  14. package/dist/chunks/{chunk-I7XD5OBR.js → chunk-BAKCGJ5D.js} +1 -1
  15. package/dist/chunks/{chunk-7GN6B4NP.js → chunk-CE27WEHK.js} +1 -1
  16. package/dist/chunks/{chunk-7TV2VBSD.js → chunk-DR3XPQRZ.js} +1 -1
  17. package/dist/chunks/{chunk-C5OV4XWF.js → chunk-EFTLCT7C.js} +1 -1
  18. package/dist/chunks/{chunk-O2IWIXBH.js → chunk-GCU66EAF.js} +1 -1
  19. package/dist/chunks/{chunk-F4WS5QIT.js → chunk-IFP6W4OW.js} +22 -22
  20. package/dist/chunks/{chunk-I5K74TOH.js → chunk-JEVA7YQL.js} +2 -2
  21. package/dist/chunks/{chunk-JKMPJFMN.js → chunk-JFR34MIK.js} +2 -2
  22. package/dist/chunks/chunk-JVIHGSOV.js +6 -0
  23. package/dist/chunks/{chunk-6ZK5EZGN.js → chunk-K6EGNB2A.js} +1 -1
  24. package/dist/chunks/chunk-L2UT3YIF.js +5 -0
  25. package/dist/chunks/{chunk-XLF7VRKY.js → chunk-L54LZUGH.js} +1 -1
  26. package/dist/chunks/{chunk-J2S7BOZU.js → chunk-MJC26GOX.js} +4 -4
  27. package/dist/chunks/{chunk-MAMUNDBZ.js → chunk-MVAJMRCW.js} +3 -3
  28. package/dist/chunks/{chunk-Y2NQXJ2Q.js → chunk-MXLB6MEW.js} +1 -1
  29. package/dist/chunks/chunk-PSZKG3E3.js +4 -0
  30. package/dist/chunks/{chunk-LYCKR4HT.js → chunk-PZ6KPMEZ.js} +342 -335
  31. package/dist/chunks/{chunk-XRV4WLI7.js → chunk-QPZNN5Q3.js} +1 -1
  32. package/dist/chunks/{chunk-ETH4SZO6.js → chunk-QTEYV4TW.js} +1 -1
  33. package/dist/chunks/{chunk-Y2KDWP74.js → chunk-T22TCCWW.js} +1 -1
  34. package/dist/chunks/{chunk-WVUPFGU7.js → chunk-UU7RXSJS.js} +1 -1
  35. package/dist/chunks/{chunk-TJNIYJUH.js → chunk-XCTFXXVY.js} +1 -1
  36. package/dist/chunks/{chunk-6LY7GYNK.js → chunk-Z6F6PYF4.js} +1 -1
  37. package/dist/chunks/cli-DSFTE4KT.js +2 -0
  38. package/dist/chunks/{configuration-command-VGYAJAKN.js → configuration-command-IHUB6BBM.js} +1 -1
  39. package/dist/chunks/{core-commands-QQNCA4WQ.js → core-commands-F2HIN7V4.js} +1 -1
  40. package/dist/chunks/{desktop-test-BMDAEN6Z.js → desktop-test-BFFUGVRS.js} +1 -1
  41. package/dist/chunks/{dist-5C6RYTQQ.js → dist-XCT2G25K.js} +1 -1
  42. package/dist/chunks/extension-D7IYZW7H.js +4 -0
  43. package/dist/chunks/{help-DZBHIKVE.js → help-5MKQV36D.js} +1 -1
  44. package/dist/chunks/opchat-XO7EDHY7.js +3 -0
  45. package/dist/chunks/{organizations-LAUKUPDF.js → organizations-DIRGTVK5.js} +1 -1
  46. package/dist/chunks/{profile-ESJFHPYC.js → profile-EMVJ5DJQ.js} +1 -1
  47. package/dist/chunks/{project-agent-CPQP4ZY6.js → project-agent-4QC7N3MB.js} +1 -1
  48. package/dist/chunks/{sandbox-command-W6NWHFAR.js → sandbox-command-L263BBOL.js} +1 -1
  49. package/dist/chunks/{sandbox-template-SM62NUMJ.js → sandbox-template-RYKWTBW7.js} +1 -1
  50. package/dist/chunks/{src-4L62URN6.js → src-RINMQ7IQ.js} +1 -1
  51. package/dist/chunks/src-RM2LIZGT.js +325 -0
  52. package/dist/chunks/{teams-bot-6LEMA4OH.js → teams-bot-NIZB6DOY.js} +1 -1
  53. package/dist/chunks/{workspaces-ERYPHR26.js → workspaces-GPYDSN4C.js} +1 -1
  54. package/dist/cli.js +1 -1
  55. package/dist/hosted-chat.d.ts +1 -0
  56. package/dist/index.js +1 -1
  57. package/dist/web/assets/App-BcbjzSeU.js +226 -0
  58. package/dist/web/assets/{AppDialog-FvWvdWfk.js → AppDialog-C1cvE0gH.js} +1 -1
  59. package/dist/web/assets/{AppTerminalPanel-Dfo_tXAE.js → AppTerminalPanel-BFJNR2ik.js} +2 -2
  60. package/dist/web/assets/{AppsView-CKg2_SXF.js → AppsView-CReOofAf.js} +1 -1
  61. package/dist/web/assets/BrowserSidebar-CPxAck2O.js +1 -0
  62. package/dist/web/assets/{CartesianChart-iXtVfIXm.js → CartesianChart-SlZ8Qfkg.js} +1 -1
  63. package/dist/web/assets/{CollaborationTabs-BFuRwsEy.js → CollaborationTabs-DgFEunqQ.js} +1 -1
  64. package/dist/web/assets/{CommandMenu-Coahy7-K.js → CommandMenu-BiROlSdv.js} +1 -1
  65. package/dist/web/assets/CommunityView-DVST_ZxO.js +1 -0
  66. package/dist/web/assets/ComposerCreateImproveStrip-jRBhdiFB.js +1 -0
  67. package/dist/web/assets/GetStartedView-Ck4EW1_s.js +1 -0
  68. package/dist/web/assets/HostedModelLearningReview-DYFjp-96.js +1 -0
  69. package/dist/web/assets/HostedModelLearningSettings-BD7quEFA.js +1 -0
  70. package/dist/web/assets/LabModelVersionDetailPage-8-Gb5AAH.js +1 -0
  71. package/dist/web/assets/{LabSkillSidebar-C7BuAuNK.js → LabSkillSidebar-DO-kFl9Z.js} +1 -1
  72. package/dist/web/assets/{LabsRoute-CUVbklNy.js → LabsRoute-Dc9RQKdA.js} +6 -6
  73. package/dist/web/assets/MainChatThread-DZXcFgmJ.js +2 -0
  74. package/dist/web/assets/MainPane-BYrnuI30.js +19 -0
  75. package/dist/web/assets/{MarkdownText-DV3sDJG3.js → MarkdownText-ueZFkEyk.js} +21 -21
  76. package/dist/web/assets/{NativeSkillSidebar-B3wc0iGh.js → NativeSkillSidebar-DlAX2-dH.js} +1 -1
  77. package/dist/web/assets/NewExperienceSwitcher-BHYLG0IZ.js +1 -0
  78. package/dist/web/assets/NewProjectDialog-BwN6SnxR.js +1 -0
  79. package/dist/web/assets/OutputsPage-Q0kpdfq_.js +1 -0
  80. package/dist/web/assets/ProjectsPage-TnlBYfFy.js +1 -0
  81. package/dist/web/assets/{ProjectsPage-DdG-U9ZW.css → ProjectsPage-kun3Ron2.css} +1 -1
  82. package/dist/web/assets/RightChatPanelStack-D2qZ-1nK.js +1 -0
  83. package/dist/web/assets/{RightSidebarHomePanel-DweT04nf.js → RightSidebarHomePanel-q6FF-DR9.js} +1 -1
  84. package/dist/web/assets/ScheduledWorkPage-BTX3Sjoa.js +1 -0
  85. package/dist/web/assets/SettingsView-C7av3zwv.css +1 -0
  86. package/dist/web/assets/SettingsView-gAhNO4Rg.js +9 -0
  87. package/dist/web/assets/{TeamChatView-BoQYnywK.js → TeamChatView-DZtfZ12z.js} +2 -2
  88. package/dist/web/assets/{TerminalOverlay-oLOOTbdP.js → TerminalOverlay-MJqx0xg6.js} +1 -1
  89. package/dist/web/assets/{TrainingCreationPanel-aCFYDuYZ.js → TrainingCreationPanel-ORoKcc3m.js} +1 -1
  90. package/dist/web/assets/{TrainingDraftPanel-CFa1YRTU.js → TrainingDraftPanel-oolNVDIx.js} +1 -1
  91. package/dist/web/assets/{UsageSettingsSection-CakaMl6_.js → UsageSettingsSection-Lh_fLOcC.js} +1 -1
  92. package/dist/web/assets/WorkSidebarPanel-BIqP9SXr.js +1 -0
  93. package/dist/web/assets/WorkspaceDiffPanel-B0Zwyx9a.js +14 -0
  94. package/dist/web/assets/WorkspaceEnvironmentMenu-BpgvG43X.js +32 -0
  95. package/dist/web/assets/{WorkspaceGitDialogs-CE6uwWBo.js → WorkspaceGitDialogs-Bw5ADFuc.js} +1 -1
  96. package/dist/web/assets/{WorkspaceMonacoEditor-Dd1yWxIF.js → WorkspaceMonacoEditor-BpivuGzo.js} +3 -3
  97. package/dist/web/assets/{arrow-up-right-DrBHDOjJ.js → arrow-up-right-BjC4ygxR.js} +1 -1
  98. package/dist/web/assets/{clipboard-BwxTBPCP.js → clipboard-BOJ-sNJz.js} +1 -1
  99. package/dist/web/assets/{cloud-upload-Ce9uYXcQ.js → cloud-upload-D-_3UWhI.js} +1 -1
  100. package/dist/web/assets/{cssMode-DDD1HmKz.js → cssMode-CnHRib-_.js} +1 -1
  101. package/dist/web/assets/{folder-open-BmWqQp0P.js → folder-open-CO3Vz0rT.js} +1 -1
  102. package/dist/web/assets/{folder-plus-B402AJf4.js → folder-plus-CL6B10XJ.js} +1 -1
  103. package/dist/web/assets/{git-commit-horizontal-C1uAivqm.js → git-commit-horizontal-C_SNHoOD.js} +1 -1
  104. package/dist/web/assets/git-dialogs-C-F47S10.css +1 -0
  105. package/dist/web/assets/{htmlMode-1MNILRvh.js → htmlMode-DBpIV7Gx.js} +1 -1
  106. package/dist/web/assets/{index-CPTsOhRN.js → index-Dx0lr1R3.js} +2 -2
  107. package/dist/web/assets/index-lqk3IxE0.css +1 -0
  108. package/dist/web/assets/{info-BNROwjpD.js → info-C1C3X2vW.js} +1 -1
  109. package/dist/web/assets/{jsonMode-mGxJ8u70.js → jsonMode-B9puI-La.js} +1 -1
  110. package/dist/web/assets/{lspLanguageFeatures-DnwAgCyz.js → lspLanguageFeatures-DwPRvLkn.js} +1 -1
  111. package/dist/web/assets/{minimize-2-DFgldo5D.js → minimize-2-Cr76Lc_J.js} +1 -1
  112. package/dist/web/assets/{monaco.contribution-BlgPPKyd.js → monaco.contribution-CnlZLXhW.js} +2 -2
  113. package/dist/web/assets/{monaco.contribution-CBuz55_x.js → monaco.contribution-DKa3PSXH.js} +2 -2
  114. package/dist/web/assets/{monaco.contribution-qZ9QzQ68.js → monaco.contribution-DQxsY08y.js} +2 -2
  115. package/dist/web/assets/{monaco.contribution-CGYtN1vj.js → monaco.contribution-OemObo_b.js} +2 -2
  116. package/dist/web/assets/monitor-CktBkAZk.js +1 -0
  117. package/dist/web/assets/{python-CpsWHcA8.js → python-CVC74_7Q.js} +1 -1
  118. package/dist/web/assets/refresh-cw-JaxiGpHD.js +1 -0
  119. package/dist/web/assets/{save-8XYI0E0Y.js → save-DFm1K29k.js} +1 -1
  120. package/dist/web/assets/{square-FQ0GLxuE.js → square-D5fFhDFt.js} +1 -1
  121. package/dist/web/assets/{toggleHighContrast-CX2hgvvU.js → toggleHighContrast-D_EkCruq.js} +1 -1
  122. package/dist/web/assets/{tsMode-D9XBNmxG.js → tsMode-BczIS4rA.js} +1 -1
  123. package/dist/web/assets/{upload-BNXILcvp.js → upload-DvED7nbd.js} +1 -1
  124. package/dist/web/assets/{useLocalAgentSchedules-Ccst1Wnz.js → useLocalAgentSchedules-DWd5OvYb.js} +1 -1
  125. package/dist/web/assets/useSessionTurnCache-oMoxBcGj.js +1 -0
  126. package/dist/web/assets/{wifi-off-BoQdtnnN.js → wifi-off-BZL-Op_B.js} +1 -1
  127. package/dist/web/assets/{workers-DpMJzLwE.js → workers-DapCJCaQ.js} +1 -1
  128. package/dist/web/assets/{yaml-BqS3gPsN.js → yaml-DB9KLqu1.js} +1 -1
  129. package/dist/web/index.html +2 -2
  130. package/docs/command-reference.md +1 -0
  131. package/package.json +1 -1
  132. package/dist/chunks/app-server-runtime-SL7IFG2M.js +0 -2
  133. package/dist/chunks/chunk-3YSCXFE6.js +0 -5
  134. package/dist/chunks/chunk-JPERN6WI.js +0 -40
  135. package/dist/chunks/chunk-P57W2CB2.js +0 -6
  136. package/dist/chunks/cli-DBIRAAYU.js +0 -2
  137. package/dist/chunks/extension-IQW2KDT6.js +0 -6
  138. package/dist/chunks/opchat-BSTDLB7O.js +0 -3
  139. package/dist/chunks/src-MBP4EHYL.js +0 -323
  140. package/dist/web/assets/App-eRfSvxdE.js +0 -226
  141. package/dist/web/assets/BrowserSidebar-CBRz9dVj.js +0 -1
  142. package/dist/web/assets/CommunityView-C0B6EVIp.js +0 -1
  143. package/dist/web/assets/ComposerCreateImproveStrip-C0MkRhov.js +0 -1
  144. package/dist/web/assets/GetStartedView-f90pfPRp.js +0 -1
  145. package/dist/web/assets/HostedModelLearningReview-DdZnSPKb.js +0 -1
  146. package/dist/web/assets/HostedModelLearningSettings-p9RdBxGd.js +0 -1
  147. package/dist/web/assets/LabModelVersionDetailPage-DLqT1fMT.js +0 -1
  148. package/dist/web/assets/MainChatThread-Crjs_iFv.js +0 -2
  149. package/dist/web/assets/MainPane-Bl91XbhC.js +0 -10
  150. package/dist/web/assets/Messages-Bxo_ATcK.js +0 -10
  151. package/dist/web/assets/NewExperienceSwitcher-DBdsaysM.js +0 -1
  152. package/dist/web/assets/NewProjectDialog-CtJJ6u5l.js +0 -1
  153. package/dist/web/assets/OutputsPage-CV9rYjbQ.js +0 -1
  154. package/dist/web/assets/ProjectsPage-O162K_Yb.js +0 -1
  155. package/dist/web/assets/RightChatPanelStack-CXzHpD5V.js +0 -1
  156. package/dist/web/assets/ScheduledWorkPage-DFvjzhvz.js +0 -1
  157. package/dist/web/assets/SettingsView-B-O30p4h.js +0 -9
  158. package/dist/web/assets/SettingsView-BaWWvIJW.css +0 -1
  159. package/dist/web/assets/WorkSidebarPanel-XFwuIBFa.js +0 -1
  160. package/dist/web/assets/WorkspaceDiffPanel-CL-lAcvW.js +0 -14
  161. package/dist/web/assets/WorkspaceEnvironmentMenu-DcFKeae1.js +0 -32
  162. package/dist/web/assets/chat-file-links-DKYaOINv.js +0 -1
  163. package/dist/web/assets/chevron-up-CT-jxFh0.js +0 -1
  164. package/dist/web/assets/desktop-files-BQj1J-ob.js +0 -1
  165. package/dist/web/assets/git-dialogs-BZDqS1eT.css +0 -1
  166. package/dist/web/assets/index-BZ4iTv8E.css +0 -1
  167. package/dist/web/assets/play-BQFyTfNz.js +0 -1
  168. package/dist/web/assets/refresh-cw-DfFBmfXv.js +0 -1
@@ -1,3 +1,3 @@
1
- import{j as t,r as o}from"./index-CPTsOhRN.js";/* empty css */import{dL as X,X as R,b4 as le,dM as re,dN as Y,ar as de,av as E,v as ce,aB as me,aD as ue,dO as ge,dP as he,dQ as fe,aL as xe,dR as ve,dS as Ce}from"./App-eRfSvxdE.js";import{R as L,j as U}from"./MainPane-Bl91XbhC.js";import{M as N}from"./MarkdownText-DV3sDJG3.js";import{T as ye,B as T}from"./chat-file-links-DKYaOINv.js";import{R as G}from"./refresh-cw-DfFBmfXv.js";import"./cloud-upload-Ce9uYXcQ.js";import"./arrow-up-right-DrBHDOjJ.js";import"./square-FQ0GLxuE.js";import"./desktop-files-BQj1J-ob.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:X(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:X(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?Y(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(G,{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(E,{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(G,{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-Dx0lr1R3.js";/* empty css */import{dN as X,X as R,aj as le,dO as re,dP as Y,an as de,aT as E,w as ce,aY as me,a_ as ue,dQ as ge,dR as he,dS as fe,b5 as xe,dT as ve,dU as Ce}from"./App-BcbjzSeU.js";import{R as L,j as U}from"./MainPane-BYrnuI30.js";import{T as ye,B as T,M as N}from"./MarkdownText-ueZFkEyk.js";import{R as G}from"./refresh-cw-JaxiGpHD.js";import"./cloud-upload-D-_3UWhI.js";import"./arrow-up-right-BjC4ygxR.js";import"./square-D5fFhDFt.js";import"./folder-open-CO3Vz0rT.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:X(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:X(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?Y(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(G,{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(E,{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(G,{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 z={value:"none",label:"No project",detail:"Team conversation",options:[],busy:!1},D={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
- ${e}`:l}function Fe(){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(E,{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 We(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]),B=o.useMemo(()=>new Map((e.detail?.messages??[]).map(i=>[i.id,i])),[e.detail?.messages]),Z=e.detail?.thread.id??null,q=r?.threadId===Z?B.get(r.message.id)??r.message:null,M=q?.deletedAt?null:q,j=M?ge(M):null,$=j?Y(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 J=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;J=crypto.randomUUID()}const k=l,oe=e.detail?.thread.id??null,w=M,H=()=>{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:J});return u?n&&d(!1):H(),u}catch(u){throw H(),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:B,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 Je(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(N,{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(E,{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(N,{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(N,{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{Je as TeamAgentConversationPanel,He as TeamAiThreadPanel,Fe as TeamChatProView,We as TeamChatView,ke as restoreFailedTeamChatPrompt};
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(E,{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?Y(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 J=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;J=crypto.randomUUID()}const k=l,oe=e.detail?.thread.id??null,w=M,H=()=>{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:J});return u?n&&d(!1):H(),u}catch(u){throw H(),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:z,workspaceTarget:D,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(N,{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:z,workspaceTarget:D,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 Je(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(E,{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(N,{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(N,{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:z,workspaceTarget:D,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,Je as TeamAiThreadPanel,$e as TeamChatProView,Fe as TeamChatView,ke as restoreFailedTeamChatPrompt};
@@ -1,4 +1,4 @@
1
- import{r as I,j as G}from"./index-CPTsOhRN.js";import{aB as Jr,dU as hs,dV as Zr,dW as cs,dX as Qr,dY as en,dZ as tn,X as sn,P as ds,C as rn}from"./App-eRfSvxdE.js";var nn=2,on=1,an=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(nn,Math.floor(d/e.css.cell.width)),rows:Math.max(on,Math.floor(a/e.css.cell.height))}}};var ar=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,hn=(e,t)=>{for(var i in t)ar(e,i,{get:t[i],enumerable:!0})},Z=(e,t,i,s)=>{for(var r=s>1?void 0:s?ln(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&&ar(t,i,r),r},k=(e,t)=>(i,s)=>t(i,s,e),us="Terminal input",pi={get:()=>us,set:e=>us=e},_s="Too much output to announce, navigate to rows manually to read",gi={get:()=>_s,set:e=>_s=e};function cn(e){return e.replace(/\r?\n/g,"\r")}function dn(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function un(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function _n(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");lr(r,t,i,s)}}function lr(e,t,i,s){e=cn(e),e=dn(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function hr(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 fs(e,t,i,s,r){hr(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Xe(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Zt(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 fn=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}},pn=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,v;for(;(v=this.interim[++_]&63)&&_<4;)f<<=6,f|=v;let y=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,R=y-_;for(;a<R;){if(a>=i)return 0;if(v=e[a++],(v&192)!==128){a--,u=!0;break}else this.interim[_++]=v,f<<=6,f|=v&63}u||(y===2?f<128?a--:t[s++]=f:y===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}},cr="",Ge=" ",Mt=class dr{constructor(){this.fg=0,this.bg=0,this.extended=new Vt}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 dr;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}},Vt=class ur{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 ur(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Le=class _r extends Mt{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Vt,this.combinedData=""}static fromCharData(t){let i=new _r;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?Xe(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()]}},ps="di$target",vi="di$dependencies",ii=new Map;function gn(e){return e[vi]||[]}function ce(e){if(ii.has(e))return ii.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");vn(t,i,r)};return t._id=e,ii.set(e,t),t}function vn(e,t,i){t[ps]===t?t[vi].push({id:e,index:i}):(t[vi]=[{id:e,index:i}],t[ps]=t)}var me=ce("BufferService"),fr=ce("CoreMouseService"),ot=ce("CoreService"),mn=ce("CharsetService"),Zi=ce("InstantiationService"),pr=ce("LogService"),Se=ce("OptionsService"),gr=ce("OscLinkService"),Sn=ce("UnicodeService"),Lt=ce("DecorationService"),mi=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 Le,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:(_,v)=>r?r.activate(_,v,u):wn(_,v),hover:(_,v)=>r?.hover?.(_,v,u),leave:(_,v)=>r?.leave?.(_,v,u)})}a=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=d,l=n.extended.urlId):(h=-1,l=-1)}}t(s)}};mi=Z([k(0,me),k(1,Se),k(2,gr)],mi);function wn(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ import{r as I,j as G}from"./index-Dx0lr1R3.js";import{aY as Jr,dW as hs,dX as Zr,dY as cs,dZ as Qr,d_ as en,d$ as tn,X as sn,P as ds,C as rn}from"./App-BcbjzSeU.js";var nn=2,on=1,an=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(nn,Math.floor(d/e.css.cell.width)),rows:Math.max(on,Math.floor(a/e.css.cell.height))}}};var ar=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,hn=(e,t)=>{for(var i in t)ar(e,i,{get:t[i],enumerable:!0})},Z=(e,t,i,s)=>{for(var r=s>1?void 0:s?ln(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&&ar(t,i,r),r},k=(e,t)=>(i,s)=>t(i,s,e),us="Terminal input",pi={get:()=>us,set:e=>us=e},_s="Too much output to announce, navigate to rows manually to read",gi={get:()=>_s,set:e=>_s=e};function cn(e){return e.replace(/\r?\n/g,"\r")}function dn(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function un(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function _n(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");lr(r,t,i,s)}}function lr(e,t,i,s){e=cn(e),e=dn(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function hr(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 fs(e,t,i,s,r){hr(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Xe(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Zt(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 fn=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}},pn=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,v;for(;(v=this.interim[++_]&63)&&_<4;)f<<=6,f|=v;let y=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,R=y-_;for(;a<R;){if(a>=i)return 0;if(v=e[a++],(v&192)!==128){a--,u=!0;break}else this.interim[_++]=v,f<<=6,f|=v&63}u||(y===2?f<128?a--:t[s++]=f:y===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}},cr="",Ge=" ",Mt=class dr{constructor(){this.fg=0,this.bg=0,this.extended=new Vt}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 dr;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}},Vt=class ur{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 ur(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Le=class _r extends Mt{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Vt,this.combinedData=""}static fromCharData(t){let i=new _r;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?Xe(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()]}},ps="di$target",vi="di$dependencies",ii=new Map;function gn(e){return e[vi]||[]}function ce(e){if(ii.has(e))return ii.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");vn(t,i,r)};return t._id=e,ii.set(e,t),t}function vn(e,t,i){t[ps]===t?t[vi].push({id:e,index:i}):(t[vi]=[{id:e,index:i}],t[ps]=t)}var me=ce("BufferService"),fr=ce("CoreMouseService"),ot=ce("CoreService"),mn=ce("CharsetService"),Zi=ce("InstantiationService"),pr=ce("LogService"),Se=ce("OptionsService"),gr=ce("OscLinkService"),Sn=ce("UnicodeService"),Lt=ce("DecorationService"),mi=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 Le,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:(_,v)=>r?r.activate(_,v,u):wn(_,v),hover:(_,v)=>r?.hover?.(_,v,u),leave:(_,v)=>r?.leave?.(_,v,u)})}a=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=d,l=n.extended.urlId):(h=-1,l=-1)}}t(s)}};mi=Z([k(0,me),k(1,Se),k(2,gr)],mi);function wn(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 Qt=ce("CharSizeService"),Ke=ce("CoreBrowserService"),Qi=ce("MouseService"),Ue=ce("RenderService"),bn=ce("SelectionService"),vr=ce("CharacterJoinerService"),ut=ce("ThemeService"),mr=ce("LinkProviderService"),yn=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?gs.isErrorNoTelemetry(e)?new gs(e.message+`
4
4
 
@@ -1 +1 @@
1
- import{r as h,j as e}from"./index-CPTsOhRN.js";import{aX as f,aO as b,m as d,h as x,X as j}from"./App-eRfSvxdE.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-Dx0lr1R3.js";import{bf as f,am as b,m as d,h as x,X as j}from"./App-BcbjzSeU.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-CPTsOhRN.js";import{b1 as p,bl as j}from"./App-eRfSvxdE.js";import{M as x}from"./minimize-2-DFgldo5D.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-Dx0lr1R3.js";import{bk as p,bC as j}from"./App-BcbjzSeU.js";import{M as x}from"./minimize-2-Cr76Lc_J.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-CPTsOhRN.js";import{b4 as ia,aX as kt,bi as la,aB as oa,v as Te}from"./App-eRfSvxdE.js";import{A as sa}from"./arrow-up-right-DrBHDOjJ.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-iXtVfIXm.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-Dx0lr1R3.js";import{aj as ia,bf as kt,bz as la,aY as oa,w as Te}from"./App-BcbjzSeU.js";import{A as sa}from"./arrow-up-right-BjC4ygxR.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-SlZ8Qfkg.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.
@@ -0,0 +1 @@
1
+ import{r as f,j as e}from"./index-Dx0lr1R3.js";import{bC as X,m as y,af as Y,bz as _,w,bW as Z}from"./App-BcbjzSeU.js";import{M as ee,b as B,s as te,T as ie}from"./MarkdownText-ueZFkEyk.js";import{F as W}from"./folder-open-CO3Vz0rT.js";import{M as ne}from"./minimize-2-Cr76Lc_J.js";import{P as E}from"./MainPane-BYrnuI30.js";import"./cloud-upload-D-_3UWhI.js";import"./arrow-up-right-BjC4ygxR.js";import"./square-D5fFhDFt.js";import"./refresh-cw-JaxiGpHD.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,H]=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]),z=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 q(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 G(t){const n=await b(t);n&&(P(n),u("Added the output to the task as input.","success"))}async function O(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=>H(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:()=>{B(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:()=>{q(n)},children:"Preview"}),e.jsxs("button",{type:"button",disabled:j===p(n),onClick:()=>{G(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:()=>{O("chat",n)},children:"Continue in Chat"}),e.jsx("button",{type:"button",disabled:j===p(n),onClick:()=>{O("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:()=>{B(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(_,{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:_,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"}),z.length>0?e.jsx("ul",{children:z.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=["./WorkspaceMonacoEditor-BpivuGzo.js","./index-Dx0lr1R3.js","./index-lqk3IxE0.css","./WorkspaceMonacoEditor-BwKcXIZw.css"])))=>i.map(i=>d[i]);
2
+ import{j as e,r,_ as fa}from"./index-Dx0lr1R3.js";import{c as be,m as rt,ar as Is,am as nn,aY as Ee,w as I,bD as $t,bm as Ft,bf as Oe,bE as pa,aR as ha,bF as ma,aS as xa,F as ba,B as an,h as ga,X as Ws,P as ja,aT as va,ap as ka,aq as wa,bC as ya,bG as Sa,af as Bs,bH as Na,bI as ts,bJ as Ca,bK as ss,bL as Ra,f as $a,x as ln,v as Fa,bM as Zt,bN as Ea,bO as ns,bs as Ce,bP as Aa,bQ as Os,bR as Pa,bS as La,bT as Us,bU as Da,bV as Ta}from"./App-BcbjzSeU.js";import{T as _a,F as Ma,a as za,M as Ia,e as Wa,d as Hs,I as Ba}from"./MarkdownText-ueZFkEyk.js";import{R as as}from"./refresh-cw-JaxiGpHD.js";import{t as Oa,a as Ua,b as Ha,m as Va,s as Ga,d as Ka,f as qa,c as Xa}from"./training-model-data-CKOkpBBL.js";import{F as yt}from"./folder-open-CO3Vz0rT.js";import{I as Vs}from"./info-C1C3X2vW.js";import{M as Qa}from"./minimize-2-Cr76Lc_J.js";import{S as Za}from"./save-DFm1K29k.js";import{C as Ya}from"./clipboard-BOJ-sNJz.js";const Ja=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],ei=be("text-align-start",Ja);const ti=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],si=be("chevrons-up",ti);const ni=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ai=be("columns-2",ni);const ii=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],li=be("eye-off",ii);const ri=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],oi=be("panel-top",ri);const ci=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],di=be("plug",ci);const ui=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],fi=be("redo-2",ui);const pi=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],hi=be("undo-2",pi);function mi({createRuntime:t,goalRuntime:s,subagentRuntime:n=null,onRunSubagentLifecycleAction:a}){const i=t?"Create/Improve Details":"Goal Details",u=t?Q(t.run.state):n?.activeCount?n.label:s?.actionLabel??"No active goal";return e.jsxs("div",{className:"goal-details-view","aria-label":i,children:[e.jsxs("div",{className:"goal-details-header",children:[e.jsxs("div",{className:"goal-details-title",children:[e.jsx(rt,{size:15,"aria-hidden":"true"}),e.jsx("span",{children:i})]}),e.jsx("span",{className:`goal-details-state ${Di(t?.run.state??null)}`,children:u})]}),e.jsx("div",{className:"goal-details-body",children:t?e.jsx(xi,{runtime:t}):s||n?e.jsx(gi,{goalRuntime:s,subagentRuntime:n,onRunSubagentLifecycleAction:a}):e.jsx(Li,{})})]})}function xi({runtime:t}){const s=t.run,n=s.plan,a=Is(n?.metadata)??Is(s.metadata),i=s.questions,u=i.filter(o=>o.status==="pending"),c=s.sourceRefs,f=s.checkRefs,h=s.state,m=s.target.kind==="agent"?s.target.defaultActionKey:null;return e.jsxs(e.Fragment,{children:[e.jsx(V,{title:"Current Work",children:e.jsx(it,{rows:[["State",Q(h)],["Operation",s.operation],["Target",Q(s.target.kind)],["Name",s.target.displayName??s.target.id??"Pending"],["Target ID",s.target.id??"Pending"],["Default action",m??n?.defaultChatAction.key??"Pending"],["Adapter",Q(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",Q(n.status)],["Plan ID",n.id],["Run ID",n.runId],["Approval",n.approvalId??"Pending"],["Approved",n.approvedAt??"Not approved"]]})]}):u.length?e.jsx("p",{className:"goal-details-summary",children:"Waiting for answers before the model finalizes the Create plan."}):e.jsx("p",{className:"goal-details-summary",children:"The model is preparing the Create plan."})}),a?e.jsxs(V,{title:"Action Shape",children:[e.jsx(it,{rows:[["Mode",a.label],["Default action",a.defaultActionKey??"None"],["Direct action",a.directActionHint??"None planned"],["Artifacts",a.artifactPolicy]]}),e.jsx("p",{className:"goal-details-note",children:a.detail})]}):null,i.length?e.jsx(V,{title:"Questions",children:e.jsx("div",{className:"goal-details-list",children:i.map(o=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.title}),e.jsx("span",{className:`goal-details-inline-state ${o.status}`,children:Q(o.status)})]}),e.jsx("p",{children:o.prompt}),o.answer?e.jsxs("small",{children:["Answer: ",o.answer.label??o.answer.value]}):o.options.length?e.jsxs("small",{children:["Options: ",o.options.map(x=>x.label).join(", ")]}):null]},o.id))})}):null,n?.requirements.length?e.jsx(V,{title:"Setup Requirements",children:e.jsx("div",{className:"goal-details-list",children:n.requirements.map(o=>e.jsxs("article",{className:"goal-details-list-item",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.name}),e.jsx("span",{className:`goal-details-inline-state ${o.status}`,children:Q(o.status)})]}),e.jsxs("small",{children:[Q(o.kind),o.detail?`: ${o.detail}`:""]})]},`${o.kind}:${o.name}`))})}):null,n?.sourcePlan.length?e.jsx(V,{title:"Source Plan",children:e.jsx(wt,{refs:n.sourcePlan.map(o=>({id:`${o.operation}:${o.path}`,primary:o.path,secondary:`${Q(o.operation)}: ${o.reason}`}))})}):null,n?.checks.length?e.jsx(V,{title:"Checks",children:e.jsx(wt,{refs:n.checks.map(o=>({id:o.name,primary:o.name,secondary:`${o.required?"Required":"Optional"}: ${o.command}`}))})}):null,c.length||f.length?e.jsx(V,{title:"Run Refs",children:e.jsx(wt,{refs:[...c.map(o=>({id:`source:${o}`,primary:o,secondary:"Source ref"})),...f.map(o=>({id:`check:${o}`,primary:o,secondary:"Check ref"}))]})}):null,e.jsx(bi,{run:s}),s.blockedReason?e.jsx(V,{title:"Blocked",children:e.jsxs("div",{className:"goal-details-alert",children:[e.jsx(nn,{size:15}),e.jsx("span",{children:s.blockedReason})]})}):null,e.jsx(V,{title:"Raw State",children:e.jsxs("details",{className:"goal-details-raw",children:[e.jsx("summary",{children:"Show structured payload"}),e.jsx("pre",{children:JSON.stringify(s,null,2)})]})})]})}function bi({run:t}){const s=[...t.context.attachments.map(i=>({id:`attachment:${i.id??i.name}`,primary:i.name,secondary:i.ref??i.mediaType??"Attachment"})),...t.context.apps.map(i=>({id:`app:${i.id}`,primary:i.name,secondary:i.required?"Required app context":"Optional app context"})),...t.context.tools.map(i=>({id:`tool:${i.name}`,primary:i.name,secondary:i.outputSummary??i.inputSummary??"Tool context"})),...t.context.targetRepoAssumptions.map(i=>({id:`target:${i}`,primary:i,secondary:"Target assumption"}))],n=t.workflowCapture,a=n?[...n.files.map(i=>({id:`workflow-file:${i}`,primary:i,secondary:"Captured file"})),...n.outputArtifacts.map(i=>({id:`workflow-artifact:${i}`,primary:i,secondary:"Output artifact"})),...n.traceRefs.map(i=>({id:`workflow-trace:${i}`,primary:i,secondary:"Trace"}))]:[];return!s.length&&!a.length?null:e.jsx(V,{title:"Context",children:e.jsx(wt,{refs:[...s,...a]})})}function gi({goalRuntime:t,subagentRuntime:s,onRunSubagentLifecycleAction:n}){return e.jsxs(e.Fragment,{children:[t?e.jsxs(V,{title:"Goal",children:[e.jsx("p",{className:"goal-details-summary",children:t.objective}),e.jsx(it,{rows:[["Status",t.actionLabel],["Runtime",t.timeLabel],["Detail",t.detail]]})]}):null,s?e.jsx(ji,{runtime:s,onRunSubagentLifecycleAction:n}):null,e.jsx(V,{title:"Raw State",children:e.jsxs("details",{className:"goal-details-raw",children:[e.jsx("summary",{children:"Show structured payload"}),e.jsx("pre",{children:JSON.stringify({goalRuntime:t,subagentRuntime:s},null,2)})]})})]})}function ji({runtime:t,onRunSubagentLifecycleAction:s}){const[n,a]=r.useState(null),[i,u]=r.useState(null);Ee(i);const c=async(f,h)=>{if(!s)return;const m=`${f}:${h}`;a(m),u(null);try{await s({runId:f,action:h})}catch(o){u(o instanceof Error?o.message:String(o))}finally{a(o=>o===m?null:o)}};return e.jsxs(e.Fragment,{children:[e.jsxs(V,{title:"Subagents",children:[e.jsx(it,{rows:[["Latest update",Ci(t)],["Active",String(t.activeCount)],["Completed",String(t.completedCount)],["Failed",String(t.failedCount)],["Cancelled",String(t.cancelledCount)],["Paused",String(t.needsResumeCount)],["Terminal",String(t.terminalCount)],["Usage",Ri(t.usage.totalTokens,t.usage.requestCount)],["Evidence",String(t.evidenceRefs.length)],["Checks",String(t.testsRunCount)]]}),t.blockers.length>0?e.jsx("ul",{className:"goal-details-list compact",children:t.blockers.slice(0,4).map(f=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${f.status}`,children:f.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(f.roleId)}),e.jsx("p",{children:f.message})]})]},`${f.runId}:${f.message}`))}):null,e.jsx("ul",{className:"goal-details-list",children:t.runs.slice(0,8).map(f=>e.jsxs("li",{className:"goal-details-list-item",children:[e.jsx("span",{className:`goal-details-inline-state ${f.status}`,children:f.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(f.roleId)}),e.jsx("p",{children:f.objective}),f.report?.summary?e.jsx("small",{children:f.report.summary}):null,s?e.jsx(ki,{pendingAction:n,run:f,onRun:c}):null]})]},f.id))})]}),t.finalResults.length>0?e.jsx(vi,{results:t.finalResults}):null]})}function vi({results:t}){return e.jsx(V,{title:"Child Results",children:e.jsx("ol",{className:"goal-details-task-graph",children:t.slice(0,6).map(s=>e.jsxs("li",{className:"goal-details-task-node",children:[e.jsxs("div",{className:"goal-details-task-node-header",children:[e.jsx("span",{className:`goal-details-inline-state ${s.status}`,children:s.status}),e.jsxs("div",{children:[e.jsx("strong",{children:St(s.roleId)}),e.jsx("small",{children:s.objective})]})]}),e.jsx("p",{children:s.summary}),e.jsxs("div",{className:"goal-details-task-node-meta",children:[e.jsxs("span",{children:[s.refs.length," refs"]}),e.jsxs("span",{children:[s.testsRun.length+s.validationAttempts.length," checks"]}),e.jsxs("span",{children:[s.blockers.length," blockers"]}),e.jsx("span",{children:s.confidence?`${Q(s.confidence)} confidence`:"Confidence unknown"})]}),s.findings.length>0?e.jsxs("small",{children:["Findings: ",Re(s.findings,3)]}):null,s.changedFiles.length>0?e.jsxs("small",{children:["Files: ",Re(s.changedFiles,4)]}):null,s.testsRun.length>0?e.jsxs("small",{children:["Tests: ",Re(s.testsRun,3)]}):null,s.validationAttempts.length>0?e.jsxs("small",{children:["Validation: ",Re(s.validationAttempts,2)]}):null,s.refs.length>0?e.jsxs("small",{children:["Refs: ",Re(s.refs.map($i),4)]}):null,s.blockers.length>0?e.jsxs("small",{children:["Blockers: ",Re(s.blockers,3)]}):null,s.workspaceRetention?e.jsxs("small",{children:["Workspace: ",Ei(s.workspaceRetention)]}):null,s.importantMessages.length>0?e.jsxs("small",{children:["Messages: ",Re(s.importantMessages.map(Fi),2)]}):null]},s.runId))})})}function ki({pendingAction:t,run:s,onRun:n}){const a=wi(s);return a.length===0?null:e.jsx("div",{className:"goal-details-actions",children:a.map(i=>{const u=`${s.id}:${i}`,c=t===u;return e.jsx("button",{type:"button",disabled:!!t,onClick:()=>{n(s.id,i)},children:c?"Working...":yi(i)},i)})})}function wi(t){const s=[],n=Si(t),a=Ni(t);return n&&s.push("cleanup"),a&&s.push("archive"),s}function yi(t){return t==="cleanup"?"Clean":t==="archive"?"Archive":"Clean + archive"}function Si(t){if(!rn(t))return!1;const s=lt(t.metadata);if(!s?.subagentWorkspace&&!s?.workspaceHandoff)return!1;const n=lt(s.lifecycleCleanup),a=lt(n?.workspaceCleanup),i=on(a?.status);return i!=="removed"&&i!=="deleted"&&i!=="retained"&&i!=="skipped"}function Ni(t){if(!t.childSessionId||!rn(t))return!1;const s=lt(lt(t.metadata)?.childSessionArchive),n=on(s?.status);return n!=="archived"&&n!=="already_archived"}function rn(t){return t.status==="completed"||t.status==="failed"||t.status==="cancelled"}function Ci(t){const s=t.latestMeaningfulUpdate;return s?`${St(s.roleId)} ${s.status}: ${s.message}`:"No structured update"}function Ri(t,s){if(t<=0&&s<=0)return"0 tokens";const n=`${s} ${s===1?"request":"requests"}`;return`${Ai(t)} tokens · ${n}`}function St(t){return t.slice(0,1).toUpperCase()+t.slice(1).replace(/[-_]+/g," ")}function $i(t){return`${t.kind}: ${t.label}`}function Fi(t){return`${Q(t.kind)}: ${t.body}`}function Ei(t){const s=t.expiresAt?`until ${Pi(t.expiresAt)}`:"for inspection",n=t.trigger?` · ${Q(t.trigger)}`:"";return`retained ${s}${n}`}function Re(t,s){const n=t.slice(0,s),a=t.length-n.length;return a>0?`${n.join(", ")} +${a}`:n.join(", ")}function Ai(t){if(t<1e3)return String(t);if(t>=1e6){const n=t/1e6;return`${Gs(n,n<10?2:1)}M`}const s=t/1e3;return`${Gs(s,s<10?1:0)}k`}function Pi(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Gs(t,s){return t.toFixed(s).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")}function Li(){return e.jsxs("div",{className:"goal-details-empty",children:[e.jsx(rt,{size:18}),e.jsx("span",{children:"No active Goal or Create workflow."})]})}function V({children:t,title:s}){return e.jsxs("section",{className:"goal-details-section",children:[e.jsx("h2",{children:s}),t]})}function it({rows:t}){return e.jsx("dl",{className:"goal-details-grid",children:t.map(([s,n])=>e.jsxs("div",{children:[e.jsx("dt",{children:s}),e.jsx("dd",{children:n})]},s))})}function wt({refs:t}){return e.jsx("ul",{className:"goal-details-ref-list",children:t.map(s=>e.jsxs("li",{children:[e.jsx("code",{title:s.primary,children:s.primary}),e.jsx("span",{children:s.secondary})]},s.id))})}function lt(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function on(t){return typeof t=="string"&&t.trim()?t.trim():null}function Q(t){return t.split(/[_-]/g).filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function Di(t){return t==="ready_local"||t==="published_hosted"?"success":t==="blocked"||t==="failed"||t==="cancelled"?"danger":t==="awaiting_questions"||t==="awaiting_plan_approval"?"warning":"active"}function Ti({sandboxId:t,connection:s}){const[n,a]=r.useState(null),[i,u]=r.useState([]),[c,f]=r.useState(null),[h,m]=r.useState(null),[o,x]=r.useState(null),[S,k]=r.useState(null);Ee(o,{prefix:"Sandbox"}),Ee(S,{prefix:"Sandbox integrations"});const N=n?.integrationLeases??[],E=r.useMemo(()=>i.filter(j=>j.status==="active"),[i]),_=r.useMemo(()=>Mi(n),[n]),W=r.useCallback(async()=>{if(!s){x("OpenPond App server is not connected.");return}if(!t){a(null),u([]),x(null);return}f("summary"),x(null);try{const j=await I.sandbox(s,t),R=await I.integrationConnections(s,Ks(j.sandbox));a(j.sandbox),u(R.connections),k(null)}catch(j){x(j instanceof Error?j.message:String(j))}finally{f(null)}},[s,t]),G=r.useCallback(async()=>{if(!(!s||!n)){m("load"),k(null);try{const[j,R]=await Promise.all([I.integrationConnections(s,Ks(n)),I.sandboxIntegrationLeases(s,n.id)]);u(j.connections),a(R.sandbox)}catch(j){k(j instanceof Error?j.message:String(j))}finally{m(null)}}},[s,n]),U=r.useCallback(async j=>{if(!s||!n)return;const R=$t(j.provider),T=R?Ft(R):null,M=T?.leasePolicy.allowedCapabilityIds??[];if(!R||!T?.leasePolicy.leaseable||M.length===0){k(`${ae(j.provider)} cannot be attached to this sandbox.`);return}m(`attach:${j.id}`),k(null);try{const A=await I.attachSandboxIntegrationConnection(s,n.id,{connectionId:j.id,provider:j.provider,capabilities:M,...j.scopes.length>0?{scopes:j.scopes}:{},...T.leasePolicy.defaultTtlSeconds?{ttlSeconds:T.leasePolicy.defaultTtlSeconds}:{},required:!1});a(A.sandbox)}catch(A){k(A instanceof Error?A.message:String(A))}finally{m(null)}},[s,n]),B=r.useCallback(async j=>{if(!(!s||!n)){m(`remove:${j}`),k(null);try{const R=await I.removeSandboxIntegrationLease(s,n.id,j);a(R.sandbox)}catch(R){k(R instanceof Error?R.message:String(R))}finally{m(null)}}},[s,n]);return r.useEffect(()=>{W()},[W]),t?e.jsxs("div",{className:"sandbox-summary-tab",children:[e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Sandbox"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[n?e.jsx("span",{children:n.state}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh summary","aria-label":"Refresh summary",disabled:c!==null,onClick:()=>{W()},children:c==="summary"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(as,{size:14})})]})]}),n?e.jsxs("dl",{className:"sandbox-workspace-kv",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Sandbox"}),e.jsx("dd",{children:qs(n.id)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Spend"}),e.jsxs("dd",{children:[Yt(n.reservation.capturedUsd)," / ",Yt(n.budget.maxUsd)]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Reservation"}),e.jsx("dd",{children:n.reservation.status})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Idle cleanup"}),e.jsx("dd",{children:n.quotas?.idleTimeoutSeconds?`${Math.round(n.quotas.idleTimeoutSeconds/60)} min`:"-"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Updated"}),e.jsx("dd",{children:cn(n.updatedAt)})]}),_?e.jsxs("div",{children:[e.jsx("dt",{children:"Receipt"}),e.jsxs("dd",{children:[qs(_.id)," / ",Yt(_.totalUsd)]})]}):null]}):e.jsxs("div",{className:"sandbox-workspace-loading",children:[c==="summary"?e.jsx(Oe,{className:"spinning",size:16}):null,e.jsx("span",{children:c==="summary"?"Loading sandbox":"Sandbox unavailable"})]})]}),e.jsxs("section",{className:"sandbox-workspace-section",children:[e.jsxs("div",{className:"sandbox-workspace-heading",children:[e.jsx("h3",{children:"Integrations"}),e.jsxs("div",{className:"sandbox-workspace-heading-actions",children:[e.jsx("span",{children:N.length}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Refresh integrations","aria-label":"Refresh integrations",disabled:h!==null||!n,onClick:()=>{G()},children:h==="load"?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(as,{size:14})})]})]}),N.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:N.map(j=>e.jsxs("div",{className:"sandbox-workspace-integration-row",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:ae(j.provider)}),e.jsxs("small",{children:[j.required?"required":"optional"," / ",Wi(j)," / ",_i(j)]})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:`Revoke ${ae(j.provider)} lease`,"aria-label":`Revoke ${ae(j.provider)} lease`,disabled:h!==null,onClick:()=>{B(j.leaseId)},children:h===`remove:${j.leaseId}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(_a,{size:14})}),e.jsxs("div",{className:"sandbox-workspace-chip-row",children:[j.capabilities.slice(0,5).map(R=>e.jsx("span",{children:Ii(j.provider,R)},R)),j.capabilities.length>5?e.jsxs("span",{children:["+",j.capabilities.length-5]}):null]})]},j.leaseId))}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No active integration leases."}),E.length>0?e.jsx("div",{className:"sandbox-workspace-integration-list",children:E.map(j=>{const R=N.some(A=>A.provider===j.provider),M=zi(j)?.leasePolicy.allowedCapabilityIds.length??0;return e.jsxs("div",{className:"sandbox-workspace-integration-row compact",children:[e.jsxs("div",{className:"sandbox-workspace-integration-main",children:[e.jsx("span",{children:Bi(j)}),e.jsx("small",{children:Oi(j,M)})]}),e.jsx("button",{type:"button",className:"diff-icon-button",title:R?`${ae(j.provider)} already attached`:`Attach ${ae(j.provider)}`,"aria-label":R?`${ae(j.provider)} already attached`:`Attach ${ae(j.provider)}`,disabled:R||h!==null||M===0,onClick:()=>{U(j)},children:h===`attach:${j.id}`?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(di,{size:14})})]},j.id)})}):e.jsx("p",{className:"sandbox-workspace-empty",children:"No connected accounts available."})]})]}):e.jsx("div",{className:"sandbox-summary-tab",children:e.jsx("p",{className:"sandbox-workspace-empty",children:"No sandbox is attached yet."})})}function Ks(t){return{status:"active"}}function _i(t){return t.proxyUrl?"runtime proxy available":"metadata only, no runtime proxy"}function Mi(t){return t?.receipts?.at(-1)??null}function zi(t){const s=$t(t.provider);return s?Ft(s):null}function ae(t){const s=$t(t),n=s?Ft(s):null;return n?n.label:t==="microsoft_teams"?"Microsoft Teams":t?t.replace(/_/g," "):"Integration"}function Ii(t,s){const n=$t(t);return(n?Ft(n):null)?.capabilities.find(i=>i.id===s)?.label??s}function Wi(t){return t.expiresAt?`expires ${cn(t.expiresAt)}`:"active"}function Bi(t){const s=t.providerAccountName?.trim();return s?`${ae(t.provider)} / ${s}`:ae(t.provider)}function Oi(t,s){const n=[];return t.providerWorkspaceName&&n.push(t.providerWorkspaceName),n.push(`${s} lease ${s===1?"capability":"capabilities"}`),t.scopes.length>0&&n.push(`${t.scopes.length} ${t.scopes.length===1?"scope":"scopes"}`),n.join(" / ")}function qs(t){return t.length>10?`${t.slice(0,8)}...`:t}function cn(t){if(!t)return"-";const s=new Date(t);return Number.isNaN(s.valueOf())?"-":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(s)}function Yt(t){const s=Number(t??0);return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:s>=10?2:4}).format(Number.isFinite(s)?s:0)}function Ui({summary:t}){const s=Oa(t.taskset),n=t.taskset.learningSignals.demonstrations.filter(f=>f.approved).length,a=t.taskset.tasks.filter(f=>f.split==="frozen_eval").length,i=t.plan?.recipe.method==="sft"||t.plan?.recipe.method==="grpo"?t.plan.recipe:null,u=Ua(t.taskset,t.plan),c=t.job?Ha(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:Va(t.taskset.name)}),e.jsx("span",{children:t.job?Ga(t.job.status):t.taskset.readiness?.ready?"Ready to train":"Needs review"})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Run"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Primary recommendation",value:s.toUpperCase()}),e.jsx(O,{label:"Training stage",value:u}),e.jsx(O,{label:"Base model",value:i?.baseModel.id??"Not selected"}),e.jsx(O,{label:"Compute",value:t.plan?Ka(t.plan.destinationId):"Not selected"}),e.jsx(O,{label:"Started",value:qa(t.job?.startedAt??null)}),e.jsx(O,{label:"Duration",value:Xa(t.job?.startedAt??null,c)})]})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Data"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Training examples",value:String(n)}),e.jsx(O,{label:"Test examples",value:String(a)}),e.jsx(O,{label:"Dataset sources",value:String(t.taskset.sourceRefs.length)})]})]}),i?e.jsxs("section",{children:[e.jsx("h3",{children:"Recipe"}),e.jsxs("dl",{children:[i.method==="grpo"?e.jsx(O,{label:"RL loss",value:i.loss.method==="gspo-token"?"GSPO-token":i.loss.method.toUpperCase()}):null,e.jsx(O,{label:"LoRA rank",value:String(i.lora.rank)}),e.jsx(O,{label:"Learning rate",value:String(i.optimizer.learningRate)}),e.jsx(O,{label:"Optimizer steps",value:String(i.optimizer.maxSteps)}),e.jsx(O,{label:i.method==="grpo"?"Prompt length":"Sequence length",value:String(i.method==="grpo"?i.dataset.maxPromptTokens:i.dataset.maxSequenceLength)})]})]}):null,e.jsxs("section",{children:[e.jsx("h3",{children:"Result"}),e.jsxs("dl",{children:[e.jsx(O,{label:"Adapter",value:t.lineage?`${u} ready`:"Not created"}),e.jsx(O,{label:"Evaluation",value:t.lineage?.frozenEvaluationArtifactId?"Completed":"Not completed"}),e.jsx(O,{label:"Artifacts",value:String(t.artifacts.length)})]})]})]})}function O({label:t,value:s}){return e.jsxs("div",{children:[e.jsx("dt",{children:t}),e.jsx("dd",{children:s})]})}function Hi(t){const s=Xs("","","folder");for(const n of t){const a=n.endsWith("/"),i=n.split("/").filter(Boolean);if(i.length===0)continue;let u=s,c="";for(let f=0;f<i.length;f+=1){const h=i[f];c=c?`${c}/${h}`:h;const m=!a&&f===i.length-1?"file":"folder",o=`${m}:${h}`;let x=u.childMap.get(o);x||(x=Xs(h,c,m),u.childMap.set(o,x),u.children.push(x)),u=x}}return dn(s.children)}function Xs(t,s,n){return{name:t,path:s,type:n,children:[],childMap:new Map}}function dn(t){return t.sort((s,n)=>s.type!==n.type?s.type==="folder"?-1:1:s.name.localeCompare(n.name)).map(s=>({name:s.name,path:s.path,type:s.type,children:dn(s.children)}))}function is({className:t,currentStatus:s,onSetStatus:n}){const a=s==="pinned",i=s==="saved_for_later";return e.jsxs("span",{className:`workspace-file-bookmark-actions ${t??"workspace-file-heading-actions"}`,children:[e.jsx("button",{type:"button",className:a?"active":void 0,"data-tooltip":a?"Unpin file":"Pin file","aria-label":a?"Unpin file":"Pin file","aria-pressed":a,onClick:()=>n(a?"none":"pinned"),children:a?e.jsx(pa,{size:14}):e.jsx(ha,{size:14})}),e.jsx("button",{type:"button",className:i?"active":void 0,"data-tooltip":i?"Remove from Save for later":"Save file for later","aria-label":i?"Remove from Save for later":"Save file for later","aria-pressed":i,onClick:()=>n(i?"none":"saved_for_later"),children:i?e.jsx(ma,{size:14}):e.jsx(xa,{size:14})})]})}function Vi({changedByPath:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=r.useMemo(()=>Hi(a),[a]);return e.jsxs("div",{className:"workspace-file-tree-view",children:[e.jsxs("div",{className:"workspace-file-tree-header",children:[e.jsx(yt,{size:14}),e.jsx("strong",{title:n??void 0,children:n?n.split("/").at(-1):"Files"}),e.jsx("span",{children:a.length})]}),e.jsx("div",{className:"workspace-file-tree",children:m.map(o=>e.jsx(un,{changedByPath:t,expandedFolderPaths:s,node:o,rootPath:n,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h},`${o.type}:${o.path}`))})]})}function un({changedByPath:t,depth:s=0,expandedFolderPaths:n,node:a,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:f,onSetFileBookmarkStatus:h,onToggleFolder:m}){const o=i?`${i}/${a.path}`:a.path,x=a.type==="folder"&&n.has(o),S=t.get(o),k=2+s*11;return a.type==="folder"?e.jsxs("div",{className:"workspace-file-tree-node",children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row folder","aria-expanded":x,style:{paddingLeft:k},onClick:()=>m(o),children:[x?e.jsx(yt,{size:14}):e.jsx(ba,{size:14}),e.jsx("span",{children:a.name})]}),x&&a.children.map(N=>e.jsx(un,{changedByPath:t,depth:s+1,expandedFolderPaths:n,node:N,rootPath:i,selectedPath:u,getFileBookmarkStatus:c,onOpenFile:f,onSetFileBookmarkStatus:h,onToggleFolder:m},`${N.type}:${N.path}`))]}):e.jsxs("div",{className:`workspace-file-tree-row file ${S?"changed":""} ${u===o?"selected":""}`,style:{paddingLeft:k},children:[e.jsxs("button",{type:"button",className:"workspace-file-tree-row-main",title:o,onClick:()=>f(o),children:[e.jsx(Ma,{size:13}),e.jsx("span",{children:a.name}),S&&e.jsxs("small",{children:[e.jsxs("span",{className:"diff-addition",children:["+",S.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",S.deletions]})]})]}),h?e.jsx(is,{className:"workspace-file-tree-bookmark-actions",currentStatus:c?.(o)??null,onSetStatus:N=>h(o,N)}):null]})}function Qs({diff:t,expandedFolderPaths:s,rootPath:n,repoFiles:a,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h}){const m=t?.files??[],o=r.useMemo(()=>new Map(m.map(k=>[k.path,k])),[m]),x=n?.replace(/^\/+|\/+$/g,"")||null,S=r.useMemo(()=>{if(!x)return a;const k=`${x}/`;return a.filter(N=>N.startsWith(k)).map(N=>N.slice(k.length)).filter(Boolean)},[x,a]);return e.jsx("div",{className:"workspace-diff-files-view",children:e.jsx(Vi,{changedByPath:o,expandedFolderPaths:s,rootPath:x,repoFiles:S,selectedPath:i,getFileBookmarkStatus:u,onOpenFile:c,onSetFileBookmarkStatus:f,onToggleFolder:h})})}function Gi({collapsed:t,editorControlsVisible:s,hideWhiteSpace:n,loadFullFiles:a,renderMarkdown:i,wordDiffs:u,wordWrap:c,onClose:f,onCopyGitApply:h,onRefresh:m,onToggleCollapsed:o,onToggleEditorControlsVisible:x,onToggleHideWhiteSpace:S,onToggleLoadFullFiles:k,onToggleRenderMarkdown:N,onToggleWordDiffs:E,onToggleWordWrap:_}){return e.jsxs("div",{className:"workspace-diff-options-menu",role:"menu",children:[e.jsx(ce,{icon:e.jsx(as,{size:14}),label:"Refresh",onClick:m,onClose:f}),e.jsx(ce,{checked:c,icon:e.jsx(za,{size:14}),label:"Enable word wrap",onClick:_,onClose:f}),e.jsx(ce,{checked:t,icon:e.jsx(si,{size:14}),label:"Collapse all diffs",onClick:o,onClose:f}),e.jsx("div",{className:"workspace-diff-menu-divider"}),e.jsx(ce,{checked:s,icon:e.jsx(oi,{size:14}),label:"Show editor controls",onClick:x,onClose:f}),e.jsx(ce,{checked:i,icon:e.jsx(an,{size:14}),label:"Render Markdown",onClick:N,onClose:f}),e.jsx(ce,{checked:!a,icon:e.jsx(rt,{size:14}),label:"Show diffs first",onClick:k,onClose:f}),e.jsx(ce,{checked:u,icon:e.jsx(ei,{size:14}),label:"Enable word diffs",onClick:E,onClose:f}),e.jsx(ce,{checked:n,icon:e.jsx(li,{size:14}),label:"Hide white space",onClick:S,onClose:f}),e.jsx(ce,{icon:e.jsx(Ya,{size:14}),label:"Copy git apply command",onClick:h,onClose:f})]})}function ce({checked:t,icon:s,label:n,onClick:a,onClose:i}){return e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{a?.(),i()},children:[s,e.jsx("span",{children:n}),t&&e.jsx(ga,{size:14})]})}function Ki({addMenuOpen:t,expanded:s,filteredFiles:n,dirtyFilePaths:a,openFiles:i,goalDetailsAvailable:u,searchOpen:c,searchQuery:f,selectedPath:h,sideChatTabs:m=[],summaryAvailable:o,sourceStatus:x,sourceSwitcher:S,visibleTab:k,getFileBookmarkStatus:N,onCloseFileTab:E,onCloseSideChat:_,onCloseSearch:W,onOpenFile:G,onOpenBrowser:U,onOpenSearch:B,onOpenSideChat:j,onSearchQueryChange:R,onSetFileBookmarkStatus:T,onSelectFile:M,onSelectFiles:A,onSelectGoal:Z,onSelectSummary:q,onSelectSideChat:z,onToggleAddMenu:H,onToggleExpanded:le}){const re=r.useRef(null);r.useEffect(()=>{if(!t&&!c)return;function w(){t&&H(),c&&W()}function F(de){re.current?.contains(de.target)||w()}function D(de){de.key==="Escape"&&w()}return document.addEventListener("pointerdown",F),document.addEventListener("keydown",D),()=>{document.removeEventListener("pointerdown",F),document.removeEventListener("keydown",D)}},[t,W,H,c]);function Y(w){if(w.key==="Escape"){W();return}w.key==="Enter"&&n[0]&&G(n[0])}function J(w){if(!["ArrowRight","ArrowLeft","Home","End"].includes(w.key))return;const F=w.target;if(!(F instanceof HTMLButtonElement)||F.getAttribute("role")!=="tab")return;const D=Array.from(w.currentTarget.querySelectorAll('button[role="tab"]')),de=D.indexOf(F);if(de<0||D.length===0)return;w.preventDefault();const Et=Na(de,D.length,w.key),Ae=D[Et];if(!Ae)return;Ae.focus(),Ae.click();const X=Ae.id;X&&window.requestAnimationFrame(()=>document.getElementById(X)?.focus())}return e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsxs("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",onKeyDown:J,children:[u?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="goal"?"active":""}`,role:"tab","aria-selected":k==="goal",onClick:Z,children:[e.jsx(rt,{size:14}),e.jsx("span",{children:"Goal"})]}):null,o&&q?e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="summary"?"active":""}`,role:"tab","aria-selected":k==="summary",onClick:q,children:[e.jsx(Vs,{size:14}),e.jsx("span",{children:"Summary"})]}):null,e.jsxs("button",{type:"button",className:`workspace-diff-tab ${k==="files"?"active":""}`,role:"tab",id:"right-sidebar-files-tab","aria-controls":"right-sidebar-files-panel","aria-selected":k==="files",tabIndex:k==="files"?0:-1,onClick:A,children:[e.jsx(yt,{size:14}),e.jsx("span",{children:"Files"})]}),i.map(w=>e.jsxs("div",{className:`workspace-diff-tab file ${k==="file"&&h===w.path?"active":""}`,children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab","aria-selected":k==="file"&&h===w.path,title:w.path,onClick:()=>M(w.path),children:[e.jsx(rt,{className:"workspace-diff-tab-icon",size:13}),a.has(w.path)&&e.jsx("span",{className:"workspace-diff-tab-dirty","aria-hidden":"true"}),e.jsx("span",{children:w.path.split("/").pop()})]}),T?e.jsx(is,{className:"workspace-diff-tab-bookmark-actions",currentStatus:N?.(w.path)??null,onSetStatus:F=>T(w.path,F)}):null,e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${w.path}`,onClick:F=>E(w.path,F),children:e.jsx(Ws,{size:12})})]},w.path)),m.map(w=>e.jsxs("div",{className:"workspace-diff-tab right-chat-tab",children:[e.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab",id:`right-chat-tab-${w.id}`,"aria-controls":`right-chat-panel-${w.id}`,"aria-selected":!1,tabIndex:-1,title:w.title,onClick:()=>z?.(w.id),children:[w.running?e.jsx("span",{className:"right-chat-status-dot","aria-label":"Running"}):null,e.jsx("span",{children:w.title})]}),_?e.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${w.title}`,"aria-label":`Close ${w.title}`,onClick:F=>{F.stopPropagation(),_(w.id)},children:e.jsx(Ws,{size:12})}):null]},w.id)),e.jsxs("div",{className:"workspace-diff-add-anchor",ref:re,children:[e.jsx("button",{type:"button",className:`workspace-diff-add-tab ${t||c?"active":""}`,title:"Add","aria-label":"Add to right sidebar",onClick:H,children:e.jsx(ja,{size:15})}),t&&e.jsxs("div",{className:"workspace-diff-add-menu",role:"menu",children:[j?e.jsxs("button",{type:"button",role:"menuitem",onClick:j,children:[e.jsx(va,{size:14}),e.jsx("span",{children:"New task"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:A,children:[e.jsx(yt,{size:14}),e.jsx("span",{children:"Files"}),e.jsx("kbd",{})]}),o&&q?e.jsxs("button",{type:"button",role:"menuitem",onClick:q,children:[e.jsx(Vs,{size:14}),e.jsx("span",{children:"Summary"}),e.jsx("kbd",{})]}):null,e.jsxs("button",{type:"button",role:"menuitem",onClick:B,children:[e.jsx(ka,{size:14}),e.jsx("span",{children:"Open file"}),e.jsx("kbd",{children:"Ctrl+P"})]}),U?e.jsxs("button",{type:"button",role:"menuitem",onClick:U,children:[e.jsx(wa,{size:14}),e.jsx("span",{children:"Browser"}),e.jsx("kbd",{children:"Ctrl+I"})]}):null]}),c&&e.jsxs("div",{className:"workspace-file-search-popover",children:[e.jsx("input",{autoFocus:!0,placeholder:"Search files",value:f,onChange:w=>R(w.target.value),onKeyDown:Y}),e.jsx("span",{children:"Files"}),e.jsx("div",{className:"workspace-file-search-results",children:n.length===0?e.jsx("small",{children:"Type to search for files"}):n.map(w=>e.jsx("button",{type:"button",onClick:()=>G(w),children:w},w))})]})]})]}),S||x?e.jsxs("div",{className:"workspace-diff-source-bar","aria-label":"Workspace source",children:[S?e.jsx("div",{className:"workspace-diff-source-toggle",role:"group","aria-label":"File source",children:S.options.map(w=>e.jsx("button",{type:"button",className:S.value===w.value?"active":"","aria-pressed":S.value===w.value,onClick:()=>S.onChange(w.value),children:w.label},w.value))}):null,x?e.jsx("span",{className:`workspace-diff-source-status ${x.tone}`,children:x.label}):null]}):null,e.jsx("button",{type:"button",className:"diff-icon-button",title:s?"Restore files panel":"Expand files panel","aria-label":s?"Restore files panel":"Expand files panel",onClick:le,children:s?e.jsx(Qa,{size:14}):e.jsx(ya,{size:14})})]})}function qi({canCheckActiveFile:t,canSaveActiveFile:s,collapsed:n,editorControlsVisible:a,editorDiagnosticStatus:i,editorDiagnosticsChecking:u,hideWhiteSpace:c,loadFullFiles:f,menuOpen:h,renderMarkdown:m,showEditorCommandBar:o,showRenderMarkdownToggle:x,splitView:S,wordDiffs:k,wordWrap:N,onCopyGitApply:E,onEditorCheck:_,onEditorRedo:W,onEditorSave:G,onEditorUndo:U,onRefresh:B,onToggleCollapsed:j,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:T,onToggleLoadFullFiles:M,onToggleMenu:A,onToggleRenderMarkdown:Z,onToggleSplitView:q,onToggleWordDiffs:z,onToggleWordWrap:H}){return e.jsx("div",{className:"workspace-diff-toolbar",children:e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsxs("div",{className:"workspace-diff-menu-anchor",children:[e.jsx("button",{type:"button",className:"diff-icon-button",title:"Diff options","aria-haspopup":"menu","aria-expanded":h,onClick:()=>A(),children:e.jsx(Sa,{size:15})}),h&&e.jsx(Gi,{collapsed:n,editorControlsVisible:a,hideWhiteSpace:c,loadFullFiles:f,renderMarkdown:m,wordDiffs:k,wordWrap:N,onClose:()=>A(!1),onCopyGitApply:E,onRefresh:B,onToggleCollapsed:j,onToggleEditorControlsVisible:R,onToggleHideWhiteSpace:T,onToggleLoadFullFiles:M,onToggleRenderMarkdown:Z,onToggleWordDiffs:z,onToggleWordWrap:H})]}),o&&e.jsxs("div",{className:"workspace-editor-command-bar","aria-label":"Editor controls",children:[e.jsx("button",{type:"button",className:"diff-icon-button",title:"Save file","aria-label":"Save file",disabled:!s,onClick:G,children:e.jsx(Za,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Undo","aria-label":"Undo",onClick:U,children:e.jsx(hi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Redo","aria-label":"Redo",onClick:W,children:e.jsx(fi,{size:14})}),e.jsx("button",{type:"button",className:"diff-icon-button",title:"Check file","aria-label":"Check file",disabled:!t,onClick:_,children:u?e.jsx(Oe,{className:"spinning",size:14}):e.jsx(Bs,{size:14})}),i&&e.jsxs("span",{className:`workspace-editor-diagnostic-chip ${i.severity}`,children:[i.severity==="error"||i.severity==="warning"||i.severity==="unavailable"?e.jsx(nn,{size:13}):e.jsx(Bs,{size:13}),e.jsx("span",{children:i.label})]})]}),x&&e.jsx("button",{type:"button",className:`diff-icon-button ${m?"active":""}`,title:m?"Show Markdown source":"Render Markdown","aria-label":m?"Show Markdown source":"Render Markdown","aria-pressed":m,onClick:Z,children:e.jsx(an,{size:14})}),e.jsx("button",{type:"button",className:`diff-icon-button ${S?"active":""}`,title:S?"Show unified diff":"Show split diff","aria-label":S?"Show unified diff":"Show split diff","aria-pressed":S,onClick:q,children:e.jsx(ai,{size:14})})]})})}const Xi={cjs:"typescript",css:"css",html:"html",js:"typescript",json:"json",jsx:"typescript",md:"markdown",mjs:"typescript",py:"python",sh:"shell",ts:"typescript",tsx:"typescript",yaml:"yaml",yml:"yaml"};function ls(t){const s=t.split("/").pop()?.toLowerCase()??"";if(s==="dockerfile")return"shell";if(s==="readme"||s==="readme.md")return"markdown";const n=s.includes(".")?s.split(".").pop()??"":"";return Xi[n]??"text"}function Qi(t,s){return t?s==="markdown"?Zi(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 Zi(t){return/^\s{0,3}#{1,6}\s/.test(t)?[{text:t,kind:"keyword"}]:/^\s*[-*+]\s/.test(t)?[{text:t,kind:"property"}]:Fe(t,/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)]+\)|https?:\/\/\S+)/g)}function Yi(t){return/^(\/\/|#|\/\*|<!--)/.test(t)?"comment":/^["'`]/.test(t)?"string":/^[-]?\d/.test(t)||/^#[\da-fA-F]{3,8}\b/.test(t)?"number":/^\b[A-Z]/.test(t)?"type":/^[.#]?[\w-]+$/.test(t)&&t.includes("-")?"property":/^(?:[{}()[\],.:;<>/=+\-*&|!?%]+)$/.test(t)?"operator":/^(?:--|\$)/.test(t)?"property":"keyword"}function Fe(t,s){const n=[];let a=0;for(const i of t.matchAll(s)){const u=i.index??0;u>a&&n.push({text:t.slice(a,u),kind:"plain"});const c=i[0];if(n.push({text:c,kind:Yi(c)}),a=u+c.length,/^(\/\/|#|<!--)/.test(c))break}return a<t.length&&n.push({text:t.slice(a),kind:"plain"}),n.length>0?n:[{text:t,kind:"plain"}]}function Nt({language:t,text:s}){return e.jsx(e.Fragment,{children:Qi(s,t).map((n,a)=>e.jsx("span",{className:`syntax-token ${n.kind}`,children:n.text},`${a}-${n.text}`))})}const Ji=`
3
+
4
+ [file truncated]`,el=r.lazy(()=>fa(()=>import("./WorkspaceMonacoEditor-BpivuGzo.js").then(t=>t.jc),__vite__mapDeps([0,1,2,3]),import.meta.url)),Jt=6,tl=18,$e=22,Zs=44,sl=160,Ys=12;function Ct({path:t,workspaceName:s,workspaceRootPath:n,onSelectPath:a}){const i=ss(t,n),u=Ra(i),c=u?nl(i):s?.trim()||"Workspace",h=(u&&c!=="/"&&i.startsWith(`${c}/`)?i.slice(c.length+1):i).split("/").filter(Boolean),m=!!(a&&!u);return e.jsxs("span",{className:"workspace-file-breadcrumbs",title:u?i:`${c} > ${i}`,children:[a&&!u?e.jsx("button",{type:"button",onClick:()=>a(null),children:c}):e.jsx("span",{children:c}),h.map((o,x)=>{const S=x===h.length-1,k=h.slice(0,x+1).join("/");return e.jsxs("span",{className:"workspace-file-breadcrumb-segment",children:[e.jsx($a,{size:13}),a&&m&&!S?e.jsx("button",{type:"button",onClick:()=>a(k),children:o}):e.jsx("span",{children:o})]},`${x}-${o}`)})]})}function nl(t){const s=/^[A-Za-z]:\//.exec(t);return s?s[0].slice(0,-1):"/"}function al({collapsed:t=!1,diagnostics:s=[],draftContent:n,editable:a=!1,editorRef:i,error:u,file:c,hideWhiteSpace:f=!1,headerActions:h,imageSrc:m,loading:o,loadFullFiles:x,onOpenImage:S,onSelectBreadcrumbPath:k,onDraftContentChange:N,onLspAction:E,onSave:_,renderMarkdown:W,saveError:G,saving:U=!1,splitView:B=!1,wordDiffs:j=!1,wordWrap:R,workspaceName:T,workspaceRootPath:M}){Ee(u,{prefix:"File preview"}),Ee(G,{prefix:"Save failed"});const A=n??c.content??"",Z=r.useMemo(()=>A.split(`
5
+ `).slice(0,800),[A]),q=ls(c.path),z=n!=null||c.content!=null,H=A.endsWith(Ji),le=W&&z&&ts(c.path),re=z&&Ca(c.path)&&cl(A);return m?e.jsxs("div",{className:"workspace-file-preview",children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:c.path,workspaceName:T,workspaceRootPath:M,onSelectPath:k}),e.jsxs("span",{className:"diff-addition",children:["+",c.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",c.deletions]})]}),h]}),e.jsx("div",{className:"workspace-file-image-stage",children:e.jsx("button",{type:"button",className:"workspace-file-image-button","aria-label":`Open image preview for ${c.path}`,onClick:S,children:e.jsx("img",{alt:c.path,decoding:"async",src:m})})})]}):!x&&c.patch||!z&&c.patch?B?e.jsx(ll,{collapsed:t,file:c,hideWhiteSpace:f,onSelectBreadcrumbPath:k,wordDiffs:j,wordWrap:R,headerActions:h,workspaceName:T,workspaceRootPath:M}):e.jsx(il,{collapsed:t,file:c,hideWhiteSpace:f,wordWrap:R,workspaceName:T,workspaceRootPath:M,onSelectBreadcrumbPath:k,headerActions:h}):e.jsxs("div",{className:`workspace-file-preview ${R?"wrap":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:c.path,workspaceName:T,workspaceRootPath:M,onSelectPath:k}),e.jsxs("span",{className:"diff-addition",children:["+",c.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",c.deletions]})]}),e.jsxs("span",{className:"workspace-file-heading-end",children:[U?e.jsx("span",{className:"workspace-file-save-state",children:"Saving"}):null,h]})]}),z?le?e.jsx("div",{className:"workspace-markdown-preview",children:e.jsx(Ia,{content:A})}):re?e.jsx(rl,{file:c,contentBase64:A}):a&&!H?e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"workspace-diff-code-empty",children:"Loading editor"}),children:e.jsx(el,{diagnostics:s,filePath:c.path,onChange:Y=>N?.(Y),onLspAction:E,onSave:()=>_?.(),ref:i,value:A,wordWrap:R})}):e.jsx("div",{className:"workspace-file-code",children:Z.map((Y,J)=>e.jsxs("div",{className:"workspace-file-code-row",children:[e.jsx("span",{children:J+1}),e.jsx("code",{children:e.jsx(Nt,{language:q,text:Y||" "})})]},`${J}-${Y}`))}):e.jsx("div",{className:"workspace-diff-code-empty",children:o?"Loading file content":"No file content available."})]})}function il({collapsed:t=!1,file:s,hideWhiteSpace:n=!1,wordWrap:a,workspaceName:i,workspaceRootPath:u,onSelectBreadcrumbPath:c,headerActions:f}){const h=r.useMemo(()=>pn(s.patch,n),[s.patch,n]),m=ls(s.path);return e.jsxs("div",{className:`workspace-diff-preview ${a?"wrap":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:s.path,workspaceName:i??null,workspaceRootPath:u,onSelectPath:c}),e.jsxs("span",{className:"diff-addition",children:["+",s.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",s.deletions]})]}),f]}),t?e.jsx("div",{className:"workspace-diff-code-empty",children:"Diff collapsed"}):e.jsx(fn,{ariaLabel:`${s.path} diff`,className:"workspace-diff-code",emptyMessage:"No patch available.",rows:h,renderRow:(o,x)=>o.kind==="spacer"?e.jsx("div",{className:"workspace-diff-spacer",role:"row",children:o.label},`${o.label}-${x}`):e.jsxs("div",{className:`workspace-diff-code-row ${o.kind}`,role:"row",children:[e.jsx("span",{className:"workspace-diff-line-number",role:"cell",children:o.newLine||o.oldLine}),e.jsx("code",{role:"cell",children:e.jsx(Nt,{language:m,text:o.newContent||o.oldContent||" "})})]},`${o.oldLine}-${o.newLine}-${x}`),wordWrap:a})]})}function ll({collapsed:t,file:s,hideWhiteSpace:n,wordDiffs:a,wordWrap:i,workspaceName:u,workspaceRootPath:c,onSelectBreadcrumbPath:f,headerActions:h}){const m=r.useMemo(()=>pn(s.patch,n),[s.patch,n]),o=ls(s.path);return e.jsxs("div",{className:`workspace-diff-preview split ${i?"wrap":""} ${a?"word-diffs":""}`,children:[e.jsxs("div",{className:"workspace-diff-file-heading",children:[e.jsxs("div",{children:[e.jsx(Ct,{path:s.path,workspaceName:u,workspaceRootPath:c,onSelectPath:f}),e.jsxs("span",{className:"diff-addition",children:["+",s.additions]}),e.jsxs("span",{className:"diff-deletion",children:["-",s.deletions]})]}),e.jsxs("span",{className:"workspace-file-heading-end",children:[h,e.jsx(Wa,{size:14})]})]}),t?e.jsx("div",{className:"workspace-diff-code-empty",children:"Diff collapsed"}):e.jsx(fn,{ariaLabel:`${s.path} split diff`,className:"workspace-split-code",emptyMessage:"No patch available.",rows:m,renderRow:(x,S)=>x.kind==="spacer"?e.jsx("div",{className:"workspace-diff-spacer split",role:"row",children:x.label},`${x.label}-${S}`):e.jsxs("div",{className:`workspace-split-row ${x.kind}`,role:"row",children:[e.jsx("span",{className:"workspace-diff-line-number old",role:"cell",children:x.oldLine}),e.jsx("code",{className:"old",role:"cell",children:e.jsx(Nt,{language:o,text:x.oldContent||" "})}),e.jsx("span",{className:"workspace-diff-line-number new",role:"cell",children:x.newLine}),e.jsx("code",{className:"new",role:"cell",children:e.jsx(Nt,{language:o,text:x.newContent||" "})})]},`${x.oldLine}-${x.newLine}-${S}`),wordWrap:i})]})}function rl({file:t,contentBase64:s}){const n=r.useMemo(()=>{const a=dl(s);if(!a)return null;const i=new Blob([new Uint8Array(a)],{type:ol(t.path)});return URL.createObjectURL(i)},[s,t.path]);return r.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 ol(t){return/\.pdf$/i.test(t)?"application/pdf":/\.docx$/i.test(t)?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"application/msword"}function cl(t){return t.length>0&&/^[A-Za-z0-9+/=\s]+$/.test(t)}function dl(t){try{const s=atob(t.replace(/\s/g,"")),n=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)n[a]=s.charCodeAt(a);return n}catch{return null}}function fn({ariaLabel:t,className:s,emptyMessage:n,rows:a,renderRow:i,wordWrap:u}){const c=!u&&a.length>sl,{endIndex:f,offsetTop:h,scrollRef:m,startIndex:o,totalHeight:x}=ul(a.length,c);return a.length===0?e.jsx("div",{className:s,role:"table","aria-label":t,children:e.jsx("div",{className:"workspace-diff-code-empty",children:n})}):c?e.jsx("div",{className:`${s} virtualized`,ref:m,role:"table","aria-label":t,"aria-rowcount":a.length,children:e.jsx("div",{className:"workspace-diff-virtual-spacer",style:{height:x},children:e.jsx("div",{className:"workspace-diff-virtual-window",style:{transform:`translateY(${h}px)`},children:a.slice(o,f).map((S,k)=>i(S,o+k))})})}):e.jsx("div",{className:s,role:"table","aria-label":t,children:a.map(i)})}function ul(t,s){const n=r.useRef(null),[a,i]=r.useState({height:$e*Zs,scrollTop:0}),u=r.useCallback(()=>{const m=n.current;m&&i({height:m.clientHeight||$e*Zs,scrollTop:m.scrollTop})},[]);if(r.useEffect(()=>{if(!s)return;const m=n.current;if(!m)return;u();let o=0;const x=()=>{if(typeof window>"u"){u();return}window.cancelAnimationFrame(o),o=window.requestAnimationFrame(u)};m.addEventListener("scroll",x,{passive:!0});const S=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>x());return S?.observe(m),()=>{m.removeEventListener("scroll",x),S?.disconnect(),typeof window<"u"&&window.cancelAnimationFrame(o)}},[s,u]),!s)return{endIndex:t,offsetTop:0,scrollRef:n,startIndex:0,totalHeight:t*$e};const c=Math.ceil(a.height/$e),f=Math.max(0,Math.floor(a.scrollTop/$e)-Ys);return{endIndex:Math.min(t,f+c+Ys*2),offsetTop:f*$e,scrollRef:n,startIndex:f,totalHeight:t*$e}}function pn(t,s){if(!t.trim())return[];const n=[];let a=0,i=0,u=null,c=null,f=!1,h=[];function m(){n.push(...fl(h)),h=[]}function o(){f&&(m(),u=a,c=i,f=!1)}for(const x of t.split(`
6
+ `)){const S=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(x);if(S){o();const E=Number(S[1]),_=Number(S[2]);if(u!==null&&c!==null){const W=Math.max(E-u,_-c,0);W>0&&n.push({kind:"spacer",label:hn(W)})}a=E,i=_,f=!0;continue}if(x.startsWith("diff --git")||x.startsWith("index ")||x.startsWith("--- ")||x.startsWith("+++ ")||!f||x.startsWith("\\ No newline"))continue;const k=x.slice(1)||" ";if(s&&!k.trim())continue;if(x.startsWith("+")){m(),n.push({kind:"addition",oldLine:"",newLine:String(i||""),oldContent:"",newContent:k}),i+=1;continue}if(x.startsWith("-")){m(),n.push({kind:"deletion",oldLine:String(a||""),newLine:"",oldContent:k,newContent:""}),a+=1;continue}const N=x.startsWith(" ")?x.slice(1)||" ":x||" ";s&&!N.trim()||(h.push({kind:"context",oldLine:String(a||""),newLine:String(i||""),oldContent:N,newContent:N}),a+=1,i+=1)}return o(),n}function fl(t){if(t.length<tl)return t;const s=t.length-Jt*2;return s<=0?t:[...t.slice(0,Jt),{kind:"spacer",label:hn(s)},...t.slice(-Jt)]}function hn(t){return`${t} unmodified ${t===1?"line":"lines"}`}const Rt=`
7
+
8
+ [file truncated]`,pl="openpond.sandboxSourceReadback.v1";async function hl(t,s,n,a=[]){let i;try{i=await I.sandboxDownloadFile(t,s,n,{maxBytes:256*1024})}catch(c){const f=c instanceof Error?c.message:String(c);if(!ml(f))throw c;const h=gl(a,s,n);if(h)return h;const m=!!rs(a,s)?.artifact,o=await I.sandbox(t,s).catch(()=>null);throw new Error(xl(n,o?.sandbox??null,f,{hasReadbackArtifact:m}))}const u=i.file.isBinary?i.file.contentsBase64||null:`${i.contents}${i.file.truncated?Rt:""}`;return{path:i.file.path,status:"",additions:0,deletions:0,patch:"",content:u}}function ml(t){return t.includes("sandbox_not_ready")&&t.includes("placement_stale")||t.includes("sandbox_not_running")}function xl(t,s,n="sandbox_not_ready:placement_stale",a={}){const i=s?jl(s):null,u=t||"this file";if(a.hasReadbackArtifact)return`Sandbox file content is unavailable because the stopped runtime placement is stale. The latest source checkpoint has a saved readback artifact, but ${u} was not captured as text. Resume the sandbox to inspect it. ${n}`;if(!i)return`Sandbox file content is unavailable because the stopped runtime placement is stale. Resume the sandbox to inspect ${u}. ${n}`;const c=i.preservedSha?i.preservedSha.slice(0,12):null,f=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}`:""}${f}, but this Desktop app cannot read file bodies from preserved source refs yet. Resume the sandbox to inspect ${u}.`}function bl(t,s){if(!s)return null;const n=rs(t,s);if(!n)return null;const a=xn(n.artifact),i=new Map;for(const f of os(a))i.set(f.path,f);for(const f of bn(n.artifact)){const h=mn(n.artifact,f.path);h&&i.set(f.path,h)}const u=[...i.values()].sort((f,h)=>f.path.localeCompare(h.path)),c=[...new Set(u.map(f=>f.path))].sort((f,h)=>f.localeCompare(h));return{appId:s,repoPath:"",initialized:!0,dirty:!1,filesChanged:u.length,additions:u.reduce((f,h)=>f+h.additions,0),deletions:u.reduce((f,h)=>f+h.deletions,0),repoFiles:c,files:u,error:null,updatedAt:Ue(ie(n.artifact)?.createdAt)??n.event.timestamp}}function gl(t,s,n){if(!s)return null;const a=rs(t,s);return a?mn(a.artifact,n):null}function rs(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=ie(a.data),u=ie(i?.sourcePreservation),c=ie(u?.sourceReadbackArtifact);if(c&&c.schemaVersion===pl&&c.sandboxId===s)return{artifact:c,event:a}}return null}function mn(t,s){const n=os(xn(t)).find(u=>u.path===s),a=bn(t).find(u=>u.path===s);if(!n&&!a)return null;const i=typeof a?.content=="string"?`${a.content}${a.truncated?Rt:""}`:null;return{path:a?.path??n?.path??s,status:n?.status??"M",additions:n?.additions??0,deletions:n?.deletions??0,patch:n?.patch??"",content:i}}function xn(t){const s=ie(t.patch);return typeof s?.text=="string"?s.text:""}function bn(t){return(Array.isArray(t.files)?t.files:[]).map(n=>{const a=ie(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 jl(t){const s=ie(t.metadata)??{},n=ie(s.sourcePreservation)??ie(s.sourcePreserve),a=ie(s.sourceChangeDetection),i=Ue(n?.preservedSha)??Ue(a?.preservedSha)??null,u=Ue(n?.sourceRef)??Ue(a?.sourceRef)??(typeof t.repoRef=="string"?t.repoRef:null);return!i&&!u?null:{preservedSha:i,sourceRef:u}}function ie(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 vl(t,s,n,a){const i=await I.sandboxUploadFile(t,s,{path:n,contents:a});return await I.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 kl(t){return t.filter(s=>s.type==="file").map(s=>s.path).sort((s,n)=>s.localeCompare(n))}function wl(t,s){const n=new Map;for(const a of os(t?.diff??""))n.set(a.path,a);for(const a of yl(s?.porcelain??""))n.has(a.path)||n.set(a.path,a);return[...n.values()].sort((a,i)=>a.path.localeCompare(i.path))}function os(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:Nl(i)??"changed-file",status:"M",additions:0,deletions:0,patchLines:[i]};continue}if(n){if(n.patchLines.push(i),i.startsWith("+++ ")){const u=Js(i.slice(4));u&&(n.path=u);continue}if(i.startsWith("--- ")){const u=Js(i.slice(4));u&&n.path==="changed-file"&&(n.path=u);continue}i.startsWith("new file mode ")&&(n.status="A"),i.startsWith("deleted file mode ")&&(n.status="D"),i.startsWith("rename to ")&&(n.status="R",n.path=i.slice(10).trim()||n.path),i.startsWith("+")&&!i.startsWith("+++")&&(n.additions+=1),i.startsWith("-")&&!i.startsWith("---")&&(n.deletions+=1)}}return a(),s}function yl(t){const s=[];for(const n of t.split(`
11
+ `)){if(!n.trim())continue;const a=Sl(n);a&&s.push({path:a,status:n.slice(0,2).trim()||"M",additions:0,deletions:0,patch:"",content:null})}return s}function Sl(t){const s=t.slice(3).trim();return s?s.split(" -> ").pop()?.trim()||s:null}function Nl(t){const s=/^diff --git a\/(.+) b\/(.+)$/.exec(t.trim());return s?.[2]??s?.[1]??null}function Js(t){const s=t.trim();return!s||s==="/dev/null"?null:s.startsWith("a/")||s.startsWith("b/")?s.slice(2):s}const gn="openpond.workspace.editorControlsVisible";function en(){try{return ln.getItem(gn)==="true"}catch{return!1}}function Cl(t){try{ln.setItem(gn,String(t))}catch{}}function Rl({activeDiagnostics:t,activeServers:s,editorDiagnosticsChecking:n,editorLspEnabled:a,showEditorCommandBar:i}){if(!i)return null;if(!a)return{label:"LSP off",severity:"unavailable"};if(n)return{label:"Checking",severity:"info"};const u=t.filter(m=>m.severity==="error").length;if(u>0)return{label:`${u} error${u===1?"":"s"}`,severity:"error"};const c=t.filter(m=>m.severity==="warning").length;if(c>0)return{label:`${c} warning${c===1?"":"s"}`,severity:"warning"};const f=t.length;if(f>0)return{label:`${f} note${f===1?"":"s"}`,severity:"info"};if(!s)return null;const h=s.find(m=>m.status!=="connected");return h?{label:h.id==="none"?"No LSP":`${h.id} unavailable`,severity:"unavailable"}:{label:"No issues",severity:"none"}}const tn=3e3,$l=2e3,sn=[],Fl=[];function El({appId:t,workspaceId:s,workspaceKind:n,connection:a,runtimeEvents:i,diff:u,editorPreferences:c,loading:f,workspaceName:h,workspaceInitialized:m,workspaceError:o,expanded:x,fileRootPath:S,filesWithPreview:k=!1,openFileRequest:N,readOnly:E=!1,sideChatTabs:_,sourceSwitcher:W,tabRequest:G,viewState:U,onRefresh:B,onResizeStart:j,onToggleExpanded:R,onOpenBrowser:T,onViewStateChange:M,onCloseSideChat:A,onOpenSideChat:Z,onSelectSideChat:q,goalDetails:z,sandboxFileSource:H,trainingSummary:le,sidebarFileBookmarks:re=[],sidebarFileSourceSessionId:Y=null,onSetSidebarFileStatus:J}){return e.jsx(Tl,{appId:t,workspaceId:s,workspaceKind:n,connection:a,runtimeEvents:i??[],diff:u,editorPreferences:c??null,loading:f,workspaceName:h,workspaceInitialized:m,workspaceError:o,expanded:x,fileRootPath:S??null,filesWithPreview:k,openFileRequest:N,readOnly:E,sideChatTabs:_??[],sourceSwitcher:W??null,tabRequest:G??null,viewState:U??null,onRefresh:B,onResizeStart:j,onToggleExpanded:R,onOpenBrowser:T,onViewStateChange:M,onCloseSideChat:A,onOpenSideChat:Z,onSelectSideChat:q,goalDetails:z??null,sandboxFileSource:H??null,trainingSummary:le??null,sidebarFileBookmarks:re,sidebarFileSourceSessionId:Y,onSetSidebarFileStatus:J})}function Al(t,s,n,a){return t&&s?.content!=null?{...t,content:s.content}:s&&!t&&es(s)?s:t&&es(t)?t:s&&es(s)?s:t??s??n??ns(a)}function es(t){return!!(t.patch||t.content!=null)}function Pl({changedFiles:t,checkpointStatus:s,dirty:n,error:a,loading:i,preservedReadback:u,sandboxMode:c,sourcePending:f}){if(f)return{label:"sandbox pending",tone:"loading"};if(i)return{label:"refreshing",tone:"loading"};if(c&&u&&s)return s;if(a)return{label:"status unavailable",tone:"error"};if(c&&s?.tone==="error"||c&&s&&!n&&t===0)return s;if(n||t>0){const h=Math.max(1,t),m=h===1?"change":"changes";return{label:c?`${h} unpreserved ${m}`:`${h} local ${m}`,tone:"dirty"}}return{label:c?"sandbox clean":"local clean",tone:"clean"}}function Ll(t,s){if(!s)return null;for(let n=t.length-1;n>=0;n-=1){const a=t[n];if(a?.name!=="workspace_action_result")continue;const i=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:null,u=i?.sourcePreservation&&typeof i.sourcePreservation=="object"&&!Array.isArray(i.sourcePreservation)?i.sourcePreservation:null;if(u?.attempted===!0&&u.sandboxId===s)return u.ok!==!0?{label:"checkpoint failed",tone:"error"}:u.preserved===!0?{label:"checkpoint saved",tone:"clean"}:{label:"checkpoint clean",tone:"clean"}}return null}function Dl(t){const s=t.split("/").filter(Boolean);return s.map((n,a)=>s.slice(0,a+1).join("/"))}function Tl({appId:t,workspaceId:s,workspaceKind:n,connection:a,runtimeEvents:i,diff:u,editorPreferences:c,loading:f,workspaceName:h,workspaceInitialized:m,workspaceError:o,expanded:x,fileRootPath:S,filesWithPreview:k,openFileRequest:N,readOnly:E,sideChatTabs:_,sourceSwitcher:W,tabRequest:G,viewState:U,onRefresh:B,onResizeStart:j,onToggleExpanded:R,onOpenBrowser:T,onViewStateChange:M,onCloseSideChat:A,onOpenSideChat:Z,onSelectSideChat:q,goalDetails:z,sandboxFileSource:H,trainingSummary:le,sidebarFileBookmarks:re,sidebarFileSourceSessionId:Y,onSetSidebarFileStatus:J}){const w=U??Ta(),[F,D]=r.useState(w.activeTab),[de,Et]=r.useState(!1),[Ae,X]=r.useState(!1),[jn,se]=r.useState(!1),[At,Pt]=r.useState(""),[ee,He]=r.useState(()=>[...w.openFilePaths]),[b,ge]=r.useState(w.selectedPath),[cs,vn]=r.useState(!1),[ds,kn]=r.useState(!1),[Pe,wn]=r.useState(!1),[Lt,yn]=r.useState(!0),[us,fs]=r.useState(en);Fa(()=>fs(en()));const[ps,Sn]=r.useState(!1),[hs,Nn]=r.useState(!1),[ms,Cn]=r.useState(!1),[ne,Le]=r.useState({}),[ot,ct]=r.useState(()=>new Set),[xs,dt]=r.useState({}),[ue,Ve]=r.useState({}),[bs,Dt]=r.useState(()=>new Set),[Ge,Ke]=r.useState(null),[Rn,Tt]=r.useState(!1),[gs,qe]=r.useState(null),[js,_t]=r.useState({}),[$n,Mt]=r.useState({}),[Fn,zt]=r.useState(null),[En,je]=r.useState(null),[An,ve]=r.useState(null);Ee(o,{prefix:"Workspace"}),Ee(gs,{prefix:"Sandbox files"});const[It,ut]=r.useState(null),[Pn,Xe]=r.useState({}),[ft,Wt]=r.useState(null),[De,pt]=r.useState(null),[ht,mt]=r.useState(null),te=c??La.editor,vs=r.useRef(ne),Bt=r.useRef(Zt(w)),Ot=r.useRef(Zt(w)),ks=r.useRef(null),Ut=r.useRef(B),oe=r.useRef(!1),Qe=r.useRef(null),Ze=r.useRef(0),fe=r.useRef(null),Ye=r.useRef(null),P=H?.sandboxId?.trim()||null,C=!!H,Te=!!le||C&&!!P,xt=C?`sandbox:${P??"pending"}`:`workspace:${t??"none"}`,ws=C?!!P:!!t,ys=r.useRef(xt),pe=!!(z?.createRuntime||z?.goalRuntime||z?.subagentRuntime),_e=r.useCallback(async(l={})=>{if(C){if(!a){Ke(null),qe("OpenPond App server is not connected.");return}if(!P){Ke(null),qe(null);return}l.silent||Tt(!0);try{const[p,d,v]=await Promise.allSettled([I.sandboxFiles(a,P,{recursive:!0,maxEntries:$l}),I.sandboxGitStatus(a,P),I.sandboxGitDiff(a,P,{})]);if(p.status==="rejected")throw p.reason;const y=kl(p.value.files),g=d.status==="fulfilled"?d.value.status:null,$=v.status==="fulfilled"?v.value.diff:null,L=wl($,g),at=L.reduce((Xt,Qt)=>Xt+Qt.additions,0),ua=L.reduce((Xt,Qt)=>Xt+Qt.deletions,0);Ke({appId:P,repoPath:"",initialized:!0,dirty:g?!g.clean:L.length>0,filesChanged:L.length,additions:at,deletions:ua,repoFiles:y,files:L,error:null,updatedAt:new Date().toISOString()}),qe(null)}catch(p){Ke(null),qe(p instanceof Error?p.message:String(p))}finally{l.silent||Tt(!1)}}},[a,P,C]),Ss=r.useMemo(()=>bl(i,P),[i,P]),Ns=!!(Ge&&((Ge.files?.length??0)>0||(Ge.repoFiles?.length??0)>0)),Ln=C&&!Ns&&!!Ss,he=C?Ns?Ge:Ss??Ge:u,Je=he?.repoPath??null,Dn=r.useMemo(()=>Ll(i,P),[i,P]),Me=he?.files??sn,Cs=he?.files??sn,ke=r.useMemo(()=>new Map(Cs.map(l=>[l.path,l])),[Cs]),we=r.useMemo(()=>new Map(Me.map(l=>[l.path,l])),[Me]),ze=he?.repoFiles??(Me.length>0?Me.map(l=>l.path):Fl),Ie=r.useMemo(()=>Me.filter(l=>!Ea(l,ze)),[ze,Me]),ye=r.useMemo(()=>ht&&!ze.includes(ht)?[ht,...ze]:ze,[ze,ht]),Rs=r.useMemo(()=>ee.map(l=>ke.get(l)??ne[l]??we.get(l)??ns(l)),[ke,we,ne,ee]),bt=r.useMemo(()=>{const l={};for(const p of ee){if(Ce(p))continue;const d=ke.get(p)??ne[p]??we.get(p)??ns(p);d.content!=null&&(l[p]=d.content)}return l},[ke,we,ne,ee]),We=r.useMemo(()=>{const l=new Set;for(const[p,d]of Object.entries(ue))d.content!==d.savedContent&&l.add(p);return l},[ue]),Tn=r.useMemo(()=>{const l=At.trim().toLowerCase(),p=ye;return l?p.filter(d=>d.toLowerCase().includes(l)):p},[ye,At]),Ht=r.useMemo(()=>({activeTab:F,openFilePaths:ee,selectedPath:b}),[F,ee,b]);r.useEffect(()=>{vs.current=ne},[ne]),r.useEffect(()=>{Qe.current=ft},[ft]),r.useEffect(()=>{Ve(l=>{let p=!1;const d={...l},v=new Set(ee),y=u?.updatedAt?Date.parse(u.updatedAt):null;for(const[g,$]of Object.entries(d))v.has(g)||$.content!==$.savedContent||(delete d[g],p=!0);for(const[g,$]of Object.entries(bt)){const L=d[g];if(!L){d[g]={content:$,savedContent:$},p=!0;continue}if(L.content===L.savedContent&&L.savedContent!==$){if(L.savedAt&&(y===null||y<L.savedAt))continue;d[g]={content:$,savedContent:$},p=!0}}return p?d:l})},[u?.updatedAt,bt,ee]),r.useEffect(()=>{Ut.current=B},[B]),r.useEffect(()=>{if(!U)return;const l=Aa(U,Je);Os(Bt.current,l)||(Bt.current=l,Ot.current=l,D(l.activeTab),He(l.openFilePaths),ge(l.selectedPath))},[U,Je]),r.useEffect(()=>{if(ot.size>0||Os(Ot.current,Ht))return;const l=Zt(Ht);Ot.current=l,Bt.current=l,M?.(l)},[Ht,M,ot]),r.useEffect(()=>{E||C||!a||!t||!m||u||o||oe.current||(oe.current=!0,Promise.resolve(Ut.current({silent:!0})).catch(()=>{}).finally(()=>{oe.current=!1}))},[t,a,u,E,C,o,m]),r.useEffect(()=>(ys.current!==xt&&(ys.current=xt,fe.current?.abort(new Error("lsp_diagnostics_source_changed")),fe.current=null,He([]),ge(null),Le({}),ct(new Set),dt({}),Ve({}),Dt(new Set),Ke(null),qe(null),Tt(!1),_t({}),Mt({}),zt(null),je(null),ve(null),ut(null),Xe({}),Wt(null),pt(null),mt(null)),()=>{fe.current?.abort(new Error("lsp_diagnostics_unmounted")),fe.current=null}),[xt]),r.useEffect(()=>{if(!(!N||ks.current===N.id)&&!(!N.file&&!ws)){if(ks.current=N.id,N.file){_n(N.file,N.imageUrl);return}gt(N.path)}},[ws,N]),r.useEffect(()=>{if(!C||(_e(),!a||!P))return;let l=!1;async function p(){if(!(l||oe.current)&&!(typeof document<"u"&&document.visibilityState==="hidden")){oe.current=!0;try{await _e({silent:!0})}finally{oe.current=!1}}}const d=window.setInterval(()=>{p()},tn),v=()=>{p()};return window.addEventListener("focus",v),()=>{l=!0,window.clearInterval(d),window.removeEventListener("focus",v)}},[a,_e,P,C]),r.useEffect(()=>{if(E||C||!a||!t||!m)return;let l=!1;async function p(){if(!(l||oe.current)&&!(typeof document<"u"&&document.visibilityState==="hidden")){oe.current=!0;try{await Ut.current({silent:!0})}catch{}finally{oe.current=!1}}}const d=window.setInterval(()=>{p()},tn),v=()=>{p()};return window.addEventListener("focus",v),()=>{l=!0,window.clearInterval(d),window.removeEventListener("focus",v)}},[t,a,E,C,m]),r.useEffect(()=>{if(C||!a||!t||n==="local_project"){mt(null);return}let l=!1;return I.workspaceTemplateConfig(a,t).then(p=>{l||mt(p.exists?p.configPath??Pa:null)}).catch(()=>{l||mt(null)}),()=>{l=!0}},[t,a,C,n]),r.useEffect(()=>{!b||ye.includes(b)||ee.includes(b)||ge(Ie[0]?.path??null)},[Ie,ee,ye,b]),r.useEffect(()=>{z?.active&&pe&&D("goal")},[z?.active,pe]),r.useEffect(()=>{G&&D(G.tab)},[G]),r.useEffect(()=>{!pe&&F==="goal"&&D("files")},[F,pe]),r.useEffect(()=>{!Te&&F==="summary"&&D("files")},[F,Te]);const K=F==="file"||k&&F==="files"?b:null;r.useEffect(()=>{if(!a||!K)return;if(Ce(K)){ve(null),je(g=>g===K?null:g);return}const l=It?.path===K,p=et(K);if(E&&(p?.content!=null||p?.patch)){ve(null),je(g=>g===K?null:g);return}if(!l&&(p?.content!=null||p?.patch&&!Pe)){ve(null),je(g=>g===K?null:g);return}let d=!1;const v=vs.current[K];return v?.content==null&&(Pe||!v?.patch)&&je(K),ve(null),(C?P?hl(a,P,K,i):Promise.reject(new Error(H?.emptyMessage??"No sandbox filesystem is available.")):t?I.workspaceFile(a,t,K):Promise.reject(new Error("Workspace files are unavailable."))).then(g=>{d||Le($=>{const L=$[g.path];return L?.content===g.content&&L.patch===g.patch&&L.status===g.status?$:{...$,[g.path]:g}})}).catch(g=>{d||ve(g instanceof Error?g.message:String(g))}).finally(()=>{d||(je(g=>g===K?null:g),ut(g=>g&&g.id===It?.id&&g.path===K?null:g))}),()=>{d=!0}},[F,t,a,It,Pe,E,i,H?.emptyMessage,P,C,K]);function gt(l){const p=ss(l,Je);p&&(ct(d=>{if(!d.has(p))return d;const v=new Set(d);return v.delete(p),v}),Le(d=>{if(!(p in d))return d;const v={...d};return delete v[p],v}),dt(d=>{if(!(p in d))return d;const v={...d};return delete v[p],v}),ut({id:Date.now(),path:p}),k||He(d=>d.includes(p)?d:[...d,p]),ge(p),D(k?"files":"file"),!C&&a&&t&&Ce(p)&&pt(p),X(!1),se(!1),Pt(""))}function _n(l,p){const d=ss(l.path,Je);if(!d)return;const v={...l,path:d};Le(y=>({...y,[d]:v})),ct(y=>{const g=new Set(y);return g.add(d),g}),dt(y=>{if(!p){if(!(d in y))return y;const g={...y};return delete g[d],g}return y[d]===p?y:{...y,[d]:p}}),ut(null),ve(null),je(null),k||He(y=>y.includes(d)?y:[...y,d]),ge(d),D(k?"files":"file"),X(!1),se(!1),Pt("")}const Mn=r.useCallback(()=>{fs(l=>{const p=!l;return Cl(p),p})},[]),et=l=>Al(ke.get(l),ne[l],we.get(l),l),zn=r.useCallback((l,p)=>{Ve(d=>{const v=d[l],y=v?.savedContent??bt[l]??et(l).content??"";return{...d,[l]:{content:p,savedContent:y,savedAt:v?.savedAt}}}),Xe(d=>{if(!(l in d))return d;const v={...d};return delete v[l],v})},[ke,we,ne,bt]),Be=r.useCallback(async(l,p={})=>{if(C||!a||!t||Ce(l))return;const d=et(l),v=p.content??ue[l]?.content??d.content??void 0;if(v?.endsWith(Rt))return;const y=Ze.current+1;Ze.current=y,fe.current?.abort(new Error("lsp_diagnostics_superseded"));const g=new AbortController;fe.current=g,zt(l);try{const $=await I.workspaceLspTouch(a,t,{path:l,content:v,waitForDiagnostics:p.waitForDiagnostics??!0},{signal:g.signal});if(y!==Ze.current)return;_t(L=>({...L,[$.path]:$.diagnostics})),Mt(L=>({...L,[$.path]:$.servers}))}catch($){if(g.signal.aborted||y!==Ze.current)return;const L=$ instanceof Error?$.message:String($);_t(at=>({...at,[l]:[]})),Mt(at=>({...at,[l]:[{id:"lsp",root:"",status:"error",message:L}]}))}finally{if(fe.current===g&&(fe.current=null),g.signal.aborted)return;y===Ze.current&&zt($=>$===l?null:$)}},[t,a,ke,we,ue,ne,C]),In=r.useCallback(async l=>{if(C||!a||!t)throw new Error("Workspace LSP is unavailable.");return I.workspaceLspAction(a,t,l)},[t,a,C]),tt=r.useCallback(async l=>{if(!a||!t&&!P||Qe.current===l)return;const p=ue[l];if(!p||p.content===p.savedContent)return;const d=p.content,v=Date.now();Qe.current=l,Wt(l),Xe(y=>{if(!(l in y))return y;const g={...y};return delete g[l],g});try{const y=C?await vl(a,P,l,d):await I.saveWorkspaceFile(a,t,{path:l,content:d});Le(g=>({...g,[y.path]:y})),Ve(g=>{const $=g[l];return $?{...g,[l]:{content:$.content,savedContent:d,savedAt:v}}:g}),te.languageServers!=="off"&&te.checkOnSave&&await Be(l,{content:d,waitForDiagnostics:!0}),C?await _e({silent:!0}):await B({silent:!0})}catch(y){Xe(g=>({...g,[l]:y instanceof Error?y.message:String(y)}))}finally{Qe.current===l&&(Qe.current=null),Wt(y=>y===l?null:y)}},[te.checkOnSave,te.languageServers,t,a,ue,B,Be,_e,P,C]),$s=b?et(b):null,st=!!(b&&ot.has(b)),Se=b?ue[b]?.content??$s?.content??null:null,Wn=!!($s?.patch&&!Pe),Vt=!!(!E&&!st&&F==="file"&&!Wn&&b&&Se!=null&&!Ce(b)&&!(Lt&&ts(b))&&!Se.endsWith(Rt));r.useEffect(()=>{if(te.languageServers==="off"||!te.diagnosticsWhileEditing||!b||!Vt||Se==null)return;const l=window.setTimeout(()=>{Be(b,{content:Se,waitForDiagnostics:!0})},700);return()=>window.clearTimeout(l)},[te.diagnosticsWhileEditing,te.languageServers,Be,Se,Vt,b]),r.useEffect(()=>{function l(p){!(p.ctrlKey||p.metaKey)||p.key.toLowerCase()!=="s"||F!=="file"||!b||(p.preventDefault(),We.has(b)&&tt(b))}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[F,We,tt,b]);const Bn=r.useCallback(()=>{b&&(Ye.current?Ye.current.save():tt(b))},[tt,b]),On=r.useCallback(()=>{Ye.current?.undo()},[]),Un=r.useCallback(()=>{Ye.current?.redo()},[]),Hn=r.useCallback(()=>{b&&te.languageServers!=="off"&&Be(b,{content:Se??void 0,waitForDiagnostics:!0})},[te.languageServers,Be,Se,b]);function Vn(l,p){if(p.stopPropagation(),!(We.has(l)&&!window.confirm(`Discard unsaved changes to ${l}?`))&&(We.has(l)&&(Ve(d=>{if(!(l in d))return d;const v={...d};return delete v[l],v}),Xe(d=>{if(!(l in d))return d;const v={...d};return delete v[l],v})),He(d=>d.filter(v=>v!==l)),ot.has(l)&&Le(d=>{if(!(l in d))return d;const v={...d};return delete v[l],v}),dt(d=>{if(!(l in d))return d;const v={...d};return delete v[l],v}),ct(d=>{if(!d.has(l))return d;const v=new Set(d);return v.delete(l),v}),b===l)){const d=Rs.find(v=>v.path!==l)??null;ge(d?.path??Ie[0]?.path??null),d||D("files")}}function Gn(){D("files"),X(!1),se(!1)}function Fs(l){Dt(p=>{const d=new Set(p);return d.has(l)?d.delete(l):d.add(l),d})}function Kn(l){l&&Dt(p=>{const d=new Set(p);for(const v of Dl(l))d.add(v);return d}),D("files"),X(!1),se(!1)}function qn(){const p=`git apply <<'PATCH'
12
+ ${Ie.map(d=>d.patch).filter(Boolean).join(`
13
+ `)}
14
+ PATCH`;navigator.clipboard?.writeText(p)}const Xn=Ie.length>0,Qn=ye.length>0,Zn=ee.length>0,Yn=pe||Te||Xn||Qn||Zn,me=F==="goal"&&pe?"goal":F==="summary"&&Te?"summary":F==="file"&&b?"file":"files",Jn=me==="files"?"No files to show":"No local changes",ea=n==="local_project"&&!m&&!o,Es=C?Rn:f,As=C?gs:o,ta=Pl({changedFiles:he?.filesChanged??Ie.length,checkpointStatus:Dn,dirty:!!he?.dirty,error:As,loading:Es,preservedReadback:Ln,sandboxMode:C,sourcePending:C&&!P}),sa=Es?"Loading workspace files":As?"Workspace files are unavailable":C&&!P?H?.emptyMessage??"No sandbox filesystem is available.":ea?"Loading workspace files":m?Jn:"No local files to show",Ps=b?xs[b]??null:null,na=!Ps&&!C&&b&&Ce(b)?b:null,Ls=De?xs[De]??null:null,aa=!Ls&&!C&&De&&Ce(De)?De:null,ia=Hs(a,t,na),la=Hs(a,t,aa),Gt=Ps??ia,Ds=Ls??la,Ts=me==="file"||k&&me==="files"?b:null,ra=!!(Ts&&ts(Ts)),_s=b?js[b]??[]:[],Ms=b?$n[b]??null:null,Kt=!!(b&&Fn===b),qt=us&&Vt,nt=!E&&!st&&!C&&te.languageServers!=="off",oa=r.useMemo(()=>Rl({activeDiagnostics:_s,activeServers:Ms,editorDiagnosticsChecking:Kt,editorLspEnabled:nt,showEditorCommandBar:qt}),[_s,Ms,Kt,nt,qt]),ca=r.useCallback(async l=>{if(!a)throw new Error("OpenPond server connection is unavailable.");await I.runSubagentLifecycleAction(a,l.runId,{action:l.action,reason:"User requested from Goal details."}),await B({silent:!0})},[a,B]),xe=C?"sandbox":n==="local_project"?"local":null,jt=r.useMemo(()=>{const l=new Map;if(!xe||!s)return l;for(const p of re)p.workspaceKind!==xe||p.workspaceId!==s||l.set(p.path,p);return l},[re,xe,s]),vt=r.useCallback(l=>{try{return jt.get(Us(l))?.status??null}catch{return null}},[jt]),kt=r.useCallback((l,p)=>{if(!xe||!s||!h||!J)return;let d;try{d=Us(l)}catch{return}const v=jt.get(d),y=new Date().toISOString(),g=v??{id:Da({workspaceKind:xe,workspaceId:s,path:d}),workspaceKind:xe,workspaceId:s,workspaceName:h,path:d,status:"pinned",order:null,sourceSessionId:Y,available:!0,createdAt:y,updatedAt:y};J(g,p)},[J,jt,Y,xe,s,h]),Ne=!!(xe&&s&&h&&J),da=b&&Ne&&!st?e.jsx(is,{currentStatus:vt(b),onSetStatus:l=>kt(b,l)}):null,zs=b?e.jsx(al,{diagnostics:nt?js[b]??[]:[],draftContent:ue[b]?.content,editorRef:Ye,editable:!E&&!st&&!Gt,error:An,file:et(b),collapsed:ds,hideWhiteSpace:hs,headerActions:da,imageSrc:Gt,loading:En===b,loadFullFiles:Pe,saveError:Pn[b]??null,saving:ft===b,onOpenImage:()=>{Gt&&pt(b)},onDraftContentChange:l=>zn(b,l),onLspAction:nt?In:void 0,onSave:()=>{tt(b)},onSelectBreadcrumbPath:Kn,renderMarkdown:Lt,splitView:ms,wordDiffs:ps,wordWrap:cs,workspaceName:h,workspaceRootPath:Je}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:`workspace-diff-panel ${x?"expanded":""}`,id:"right-sidebar-files-panel",role:"tabpanel","aria-label":"Workspace diffs",children:[!x&&e.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize diff panel",onPointerDown:j}),e.jsx(Ki,{addMenuOpen:Ae,expanded:x,filteredFiles:Tn,openFiles:Rs,dirtyFilePaths:We,goalDetailsAvailable:pe,searchOpen:jn,searchQuery:At,selectedPath:b,sideChatTabs:_,summaryAvailable:Te,sourceStatus:ta,sourceSwitcher:W,visibleTab:me,getFileBookmarkStatus:Ne?vt:void 0,onCloseFileTab:Vn,onCloseSideChat:A,onCloseSearch:()=>se(!1),onOpenFile:gt,onOpenBrowser:T?()=>{X(!1),se(!1),T()}:void 0,onOpenSearch:()=>{X(!1),se(!0)},onOpenSideChat:Z?()=>{X(!1),se(!1),Z()}:void 0,onSearchQueryChange:Pt,onSetFileBookmarkStatus:Ne?kt:void 0,onSelectFile:l=>{ge(l),D("file")},onSelectFiles:Gn,onSelectGoal:()=>D("goal"),onSelectSummary:()=>{D("summary"),X(!1),se(!1)},onSelectSideChat:q,onToggleAddMenu:()=>{X(l=>!l),se(!1)},onToggleExpanded:R}),me==="goal"&&pe?e.jsx(mi,{createRuntime:z?.createRuntime??null,goalRuntime:z?.goalRuntime??null,subagentRuntime:z?.subagentRuntime??null,onRunSubagentLifecycleAction:a?ca:void 0}):me==="summary"&&Te?le?e.jsx(Ui,{summary:le}):e.jsx(Ti,{sandboxId:P,connection:a}):Yn?e.jsxs(e.Fragment,{children:[e.jsx(qi,{canSaveActiveFile:!!(!E&&!st&&b&&We.has(b)&&ft!==b),canCheckActiveFile:nt,collapsed:ds,editorControlsVisible:us,editorDiagnosticStatus:oa,editorDiagnosticsChecking:Kt,hideWhiteSpace:hs,loadFullFiles:Pe,menuOpen:de,renderMarkdown:Lt,showEditorCommandBar:qt,showRenderMarkdownToggle:ra,splitView:ms,wordDiffs:ps,wordWrap:cs,onCopyGitApply:qn,onEditorCheck:Hn,onEditorRedo:Un,onEditorSave:Bn,onEditorUndo:On,onRefresh:()=>{C?_e():B()},onToggleCollapsed:()=>kn(l=>!l),onToggleEditorControlsVisible:Mn,onToggleHideWhiteSpace:()=>Nn(l=>!l),onToggleLoadFullFiles:()=>wn(l=>!l),onToggleMenu:l=>Et(p=>l??!p),onToggleRenderMarkdown:()=>yn(l=>!l),onToggleSplitView:()=>Cn(l=>!l),onToggleWordDiffs:()=>Sn(l=>!l),onToggleWordWrap:()=>vn(l=>!l)}),me==="files"&&(k?e.jsxs("div",{className:"workspace-diff-files-preview-layout",children:[e.jsx(Qs,{diff:he,expandedFolderPaths:bs,rootPath:S,repoFiles:ye,selectedPath:b,getFileBookmarkStatus:Ne?vt:void 0,onOpenFile:gt,onSetFileBookmarkStatus:Ne?kt:void 0,onToggleFolder:Fs}),zs??e.jsx("div",{className:"workspace-diff-files-preview-empty",children:"Select a file to review its changes."})]}):e.jsx(Qs,{diff:he,expandedFolderPaths:bs,rootPath:S,repoFiles:ye,selectedPath:b,getFileBookmarkStatus:Ne?vt:void 0,onOpenFile:gt,onSetFileBookmarkStatus:Ne?kt:void 0,onToggleFolder:Fs})),me==="file"&&b&&zs]}):e.jsx("div",{className:"workspace-diff-empty",children:e.jsx("span",{children:sa})})]}),e.jsx(Ba,{open:!!Ds,src:Ds,title:De??"",onClose:()=>pt(null)})]})}const Gl=Object.freeze(Object.defineProperty({__proto__:null,WorkspaceDiffPanel:El},Symbol.toStringTag,{value:"Module"}));export{ai as C,El as W,Gl as a};