openpond 0.1.0 → 0.1.1

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 (87) hide show
  1. package/dist/chunks/{app-server-runtime-Y6MW4XCG.js → app-server-runtime-FJM2EQPH.js} +3 -3
  2. package/dist/chunks/{chunk-TGM5IPYO.js → chunk-C5TKGE5Y.js} +1 -1
  3. package/dist/chunks/{chunk-AN2EYCN3.js → chunk-DJL4TJYG.js} +1 -1
  4. package/dist/chunks/{chunk-P6JLLWMI.js → chunk-KWDOAJJI.js} +1 -1
  5. package/dist/chunks/{chunk-TZWAUV2L.js → chunk-O6B6YCMI.js} +3 -3
  6. package/dist/chunks/{cli-L5VPOV6I.js → cli-6PFRZ2WV.js} +2 -2
  7. package/dist/chunks/{src-A6O6ZGIL.js → src-RTGN2O4H.js} +22 -33
  8. package/dist/chunks/{workspaces-XM5BY3MO.js → workspaces-IJQPWX3H.js} +2 -2
  9. package/dist/cli.js +5 -5
  10. package/dist/skills/openpond-desktop-harness/SKILL.md +1 -1
  11. package/dist/web/assets/{App-DfiCmBv6.js → App-BOkhmdHu.js} +17 -17
  12. package/dist/web/assets/{AppDialog-CSXu5wRu.js → AppDialog-BCjKFUBn.js} +1 -1
  13. package/dist/web/assets/{AppTerminalPanel-y2bVL2RV.js → AppTerminalPanel-DRU8GIfy.js} +2 -2
  14. package/dist/web/assets/{AppsView-Bs9pwD2H.js → AppsView-Ck_OzQWf.js} +1 -1
  15. package/dist/web/assets/{BrowserSidebar-CUgT5V1m.js → BrowserSidebar-CqciX8aL.js} +1 -1
  16. package/dist/web/assets/{CartesianChart-DA85hfrP.js → CartesianChart-Y0lsL4vC.js} +1 -1
  17. package/dist/web/assets/{CollaborationTabs-B8mlPhM3.js → CollaborationTabs-BOb9PjvS.js} +1 -1
  18. package/dist/web/assets/{CommandMenu-EwUGCeC_.js → CommandMenu-Co6JnmTu.js} +1 -1
  19. package/dist/web/assets/{CommunityView-IHNq-YJz.js → CommunityView-BbTSeL7h.js} +1 -1
  20. package/dist/web/assets/{ComposerCreateImproveStrip-qOL2zA26.js → ComposerCreateImproveStrip-BGzCWVFp.js} +1 -1
  21. package/dist/web/assets/{GetStartedView-C2ypO0v7.js → GetStartedView-jEogFjxP.js} +1 -1
  22. package/dist/web/assets/{LabModelVersionDetailPage-BK0eoUlW.js → LabModelVersionDetailPage-CrudId_1.js} +1 -1
  23. package/dist/web/assets/{LabSkillSidebar-CRPb4qBn.js → LabSkillSidebar-C5oS6UmH.js} +1 -1
  24. package/dist/web/assets/{LabsRoute-Bw-HD6QC.js → LabsRoute-9v8qwEBc.js} +2 -2
  25. package/dist/web/assets/{MainChatThread-Cu6_UnNE.js → MainChatThread-VtMpAxlP.js} +2 -2
  26. package/dist/web/assets/{MainPane-k1iII9e9.js → MainPane-BbknUzp3.js} +4 -4
  27. package/dist/web/assets/{MarkdownText-N60tvLug.js → MarkdownText-DqJarmTh.js} +1 -1
  28. package/dist/web/assets/{Messages-CYQFLElK.js → Messages-BaT7HOzB.js} +4 -4
  29. package/dist/web/assets/{NativeSkillSidebar-zbx7WmOk.js → NativeSkillSidebar-DXp8snN5.js} +1 -1
  30. package/dist/web/assets/{NewExperienceSwitcher-B0zev5Sx.js → NewExperienceSwitcher-CLHuGUN5.js} +1 -1
  31. package/dist/web/assets/{NewProjectDialog-lZlzrp-R.js → NewProjectDialog-CzpHCAaC.js} +1 -1
  32. package/dist/web/assets/{OutputsPage-B4zYYUT5.js → OutputsPage-DIzx-Ge6.js} +1 -1
  33. package/dist/web/assets/{ProjectsPage-97wgc84s.js → ProjectsPage-DojwrhOy.js} +1 -1
  34. package/dist/web/assets/{RightChatPanelStack-I2znDCc7.js → RightChatPanelStack-CIE5bgmO.js} +1 -1
  35. package/dist/web/assets/{RightSidebarHomePanel-BUcWVJi-.js → RightSidebarHomePanel-DTzfuEX3.js} +1 -1
  36. package/dist/web/assets/{ScheduledWorkPage-Bp-t0eVj.js → ScheduledWorkPage-DdbcQGSv.js} +1 -1
  37. package/dist/web/assets/SettingsView-CC5GXaE1.css +1 -0
  38. package/dist/web/assets/SettingsView-QT_OLmDh.js +6 -0
  39. package/dist/web/assets/{TeamChatView-Fj5_yjVE.js → TeamChatView-C4-nG1tC.js} +2 -2
  40. package/dist/web/assets/{TerminalOverlay-D2WBeJvp.js → TerminalOverlay-DnNVrCtu.js} +1 -1
  41. package/dist/web/assets/{TrainingCreationPanel-dYW_dh3M.js → TrainingCreationPanel-CDwwyucO.js} +1 -1
  42. package/dist/web/assets/{TrainingDraftPanel-zeJWmmW6.js → TrainingDraftPanel-BijDnV_0.js} +1 -1
  43. package/dist/web/assets/{UsageSettingsSection-B6SBqYuB.js → UsageSettingsSection-Y5BFAu1p.js} +1 -1
  44. package/dist/web/assets/{WorkSidebarPanel-BwbWKpOZ.js → WorkSidebarPanel-CkJlvZKm.js} +1 -1
  45. package/dist/web/assets/{WorkspaceDiffPanel-D9Kp0vFw.js → WorkspaceDiffPanel-CBgzmBk8.js} +3 -3
  46. package/dist/web/assets/{WorkspaceEnvironmentMenu-D-3YGp06.js → WorkspaceEnvironmentMenu-D8knAy1q.js} +3 -3
  47. package/dist/web/assets/{WorkspaceGitDialogs-BUbzUN4m.js → WorkspaceGitDialogs-_LHTrvh6.js} +1 -1
  48. package/dist/web/assets/{WorkspaceMonacoEditor-CXPY7bBI.js → WorkspaceMonacoEditor-B2B7OM_L.js} +3 -3
  49. package/dist/web/assets/{arrow-up-right-C7VWgGQP.js → arrow-up-right-4nAzMtjW.js} +1 -1
  50. package/dist/web/assets/{chat-file-links-CqfMdhHQ.js → chat-file-links-Bned0MT7.js} +1 -1
  51. package/dist/web/assets/chevron-up-DK7ejCfk.js +1 -0
  52. package/dist/web/assets/{clipboard-B-8k7mlT.js → clipboard-BzjUoZFo.js} +1 -1
  53. package/dist/web/assets/{cloud-upload-CUVFzURz.js → cloud-upload-CsrrwS-b.js} +1 -1
  54. package/dist/web/assets/{cssMode-DYvfmqoL.js → cssMode-CIbSSHKJ.js} +1 -1
  55. package/dist/web/assets/{folder-open-CnbcQIy8.js → folder-open-vRTuLzpS.js} +1 -1
  56. package/dist/web/assets/{folder-plus-BOaLAKy4.js → folder-plus-hyqwgUnx.js} +1 -1
  57. package/dist/web/assets/{git-commit-horizontal-DQeHsooT.js → git-commit-horizontal-CaxKfeYa.js} +1 -1
  58. package/dist/web/assets/{htmlMode-BXEI-BVY.js → htmlMode-C3MGQGam.js} +1 -1
  59. package/dist/web/assets/index-66-ohHD5.js +1 -0
  60. package/dist/web/assets/{index-CGMb_VXm.css → index-ByQIHpc9.css} +1 -1
  61. package/dist/web/assets/{index-D-VK8mST.js → index-Dvq7bpBG.js} +1 -1
  62. package/dist/web/assets/{info-DtzDuGLn.js → info-aYWeE1Iw.js} +1 -1
  63. package/dist/web/assets/{jsonMode-Dosjh_hK.js → jsonMode-CpD6UkT7.js} +1 -1
  64. package/dist/web/assets/{lspLanguageFeatures-BNe-6FJA.js → lspLanguageFeatures-DpcK8ZI6.js} +1 -1
  65. package/dist/web/assets/{minimize-2-DnxKN5oK.js → minimize-2-DeYg7XqB.js} +1 -1
  66. package/dist/web/assets/{monaco.contribution-CnkROzNv.js → monaco.contribution-BDTM0ZJq.js} +2 -2
  67. package/dist/web/assets/{monaco.contribution-CfF-ajhi.js → monaco.contribution-C-_ekTxy.js} +2 -2
  68. package/dist/web/assets/{monaco.contribution-ytyanGyj.js → monaco.contribution-CrrdDQgP.js} +2 -2
  69. package/dist/web/assets/{monaco.contribution-Dyns81H2.js → monaco.contribution-JWFq0HzV.js} +2 -2
  70. package/dist/web/assets/{play-B3o6IAQd.js → play-BqgRTddV.js} +1 -1
  71. package/dist/web/assets/{python-B7zZ_9Z_.js → python-B67wope9.js} +1 -1
  72. package/dist/web/assets/{refresh-cw-DSJZXa8S.js → refresh-cw-DwMA_2On.js} +1 -1
  73. package/dist/web/assets/{save-iC-AXHN6.js → save-B0BKh5oQ.js} +1 -1
  74. package/dist/web/assets/{square-B2roZTxf.js → square-LY3oz82L.js} +1 -1
  75. package/dist/web/assets/{toggleHighContrast-CjlV4YHK.js → toggleHighContrast-B2jka5B1.js} +1 -1
  76. package/dist/web/assets/{tsMode-XmKmSq0B.js → tsMode-1MUwluYD.js} +1 -1
  77. package/dist/web/assets/{upload-BgHXNjfJ.js → upload-bSKSkFVa.js} +1 -1
  78. package/dist/web/assets/{useLocalAgentSchedules-CVJz0AMr.js → useLocalAgentSchedules--jnnM4Fz.js} +1 -1
  79. package/dist/web/assets/{wifi-off-CneL8bDZ.js → wifi-off-DA34iPmr.js} +1 -1
  80. package/dist/web/assets/{workers-CT7VYBR5.js → workers-CczIcRcl.js} +1 -1
  81. package/dist/web/assets/{yaml-CF8jchCz.js → yaml-DwEGoHA9.js} +1 -1
  82. package/dist/web/index.html +2 -2
  83. package/package.json +1 -1
  84. package/dist/web/assets/SettingsView-BRPrJuP5.css +0 -1
  85. package/dist/web/assets/SettingsView-C1xyn1Y4.js +0 -6
  86. package/dist/web/assets/chevron-up-DD9Tei-Q.js +0 -1
  87. package/dist/web/assets/index-D-WCyNdJ.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as $,j as C}from"./index-D-VK8mST.js";import{c as ra,c8 as U0,c9 as Pe,o as aa,aC as f1,X as p1,cd as M0,bm as z0,by as v1,d as g1,aT as wt}from"./App-DfiCmBv6.js";import{n as jt,m as b1,C as y1}from"./chat-file-links-CqfMdhHQ.js";import{r as w1}from"./desktop-files-BQj1J-ob.js";const x1=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],k1=ra("copy",x1);const S1=[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],M1=ra("text-wrap",S1);function na(r,e,t){const a=ia(r),[n,i]=$.useState(()=>a.getUrl(e,t));return $.useEffect(()=>{let o=!1;return i(a.getUrl(e,t)),a.loadUrl(e,t).then(u=>{o||i(u)}),()=>{o=!0}},[e,t,a]),n}function ia(r){const[,e]=$.useState(0),t=$.useCallback((i,o)=>!r||!i||!o?null:(U0.activateConnection(r),U0.get(Pe(r,"workspace-image",i,o))),[r]),a=$.useCallback(async(i,o)=>{if(!r||!i||!o)return null;U0.activateConnection(r);const u=Pe(r,"workspace-image",i,o);return U0.load(u,()=>aa.signWorkspaceImageUrl(r,{appId:i,path:o})).finally(()=>e(c=>c+1))},[r]),n=$.useCallback((i,o)=>{a(i,o)},[a]);return $.useMemo(()=>({ensureUrl:n,getUrl:t,loadUrl:a}),[n,t,a])}function z1({open:r,src:e,title:t,onClose:a}){const[n,i]=$.useState(!1);if($.useEffect(()=>{if(!r)return;const c=d=>{d.key==="Escape"&&a()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a,r]),$.useEffect(()=>{i(!1)},[e]),!r||!e)return null;const o=(()=>{const c=t.split("/").pop()?.trim();if(c&&/\.[A-Za-z0-9]+$/.test(c))return c;try{const v=new URL(e,window.location.href).pathname.split("/").pop()?.trim();if(v&&/\.[A-Za-z0-9]+$/.test(v))return v}catch{}return"image.png"})(),u=()=>{const c=document.createElement("a");c.href=e,c.download=o,c.rel="noopener",document.body.appendChild(c),c.click(),c.remove()};return C.jsx("div",{className:"image-lightbox-backdrop",role:"presentation",onMouseDown:c=>{c.target===c.currentTarget&&a()},children:C.jsxs("section",{"aria-label":t?`Image preview: ${t}`:"Image preview","aria-modal":"true",className:"image-lightbox-dialog",role:"dialog",children:[C.jsxs("header",{className:"image-lightbox-header",children:[C.jsx("span",{title:t,children:t}),C.jsxs("div",{className:"image-lightbox-actions",children:[C.jsx("button",{type:"button","aria-label":"Download image",title:"Download",onClick:u,children:C.jsx(f1,{size:16})}),C.jsx("button",{type:"button","aria-label":"Close image preview",title:"Close",onClick:a,children:C.jsx(p1,{size:16})})]})]}),C.jsx("div",{className:"image-lightbox-frame",children:n?C.jsx("div",{className:"image-lightbox-error",children:"Image preview unavailable"}):C.jsx("img",{alt:t||"Image preview",decoding:"async",draggable:!1,src:e,onError:()=>i(!0)})})]})})}function sa(r,e){const t=la(r),[a,n]=$.useState(()=>t.getUrl(e));return $.useEffect(()=>{let i=!1;return n(t.getUrl(e)),t.loadUrl(e).then(o=>{i||n(o)}),()=>{i=!0}},[e,t]),a}function la(r){const[,e]=$.useState(0),t=$.useCallback(n=>!r||!n?null:(U0.activateConnection(r),U0.get(Pe(r,"local-image",n))),[r]),a=$.useCallback(async n=>{if(!r||!n)return null;U0.activateConnection(r);const i=Pe(r,"local-image",n);return U0.load(i,()=>aa.signLocalImageUrl(r,{path:n})).finally(()=>e(o=>o+1))},[r]);return $.useMemo(()=>({getUrl:t,loadUrl:a}),[t,a])}function Le(r){const e=r.replace(/\r\n/g,`
1
+ import{r as $,j as C}from"./index-Dvq7bpBG.js";import{c as ra,c8 as U0,c9 as Pe,o as aa,aD as f1,X as p1,cd as M0,bm as z0,by as v1,d as g1,aU as wt}from"./App-BOkhmdHu.js";import{n as jt,m as b1,C as y1}from"./chat-file-links-Bned0MT7.js";import{r as w1}from"./desktop-files-BQj1J-ob.js";const x1=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],k1=ra("copy",x1);const S1=[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],M1=ra("text-wrap",S1);function na(r,e,t){const a=ia(r),[n,i]=$.useState(()=>a.getUrl(e,t));return $.useEffect(()=>{let o=!1;return i(a.getUrl(e,t)),a.loadUrl(e,t).then(u=>{o||i(u)}),()=>{o=!0}},[e,t,a]),n}function ia(r){const[,e]=$.useState(0),t=$.useCallback((i,o)=>!r||!i||!o?null:(U0.activateConnection(r),U0.get(Pe(r,"workspace-image",i,o))),[r]),a=$.useCallback(async(i,o)=>{if(!r||!i||!o)return null;U0.activateConnection(r);const u=Pe(r,"workspace-image",i,o);return U0.load(u,()=>aa.signWorkspaceImageUrl(r,{appId:i,path:o})).finally(()=>e(c=>c+1))},[r]),n=$.useCallback((i,o)=>{a(i,o)},[a]);return $.useMemo(()=>({ensureUrl:n,getUrl:t,loadUrl:a}),[n,t,a])}function z1({open:r,src:e,title:t,onClose:a}){const[n,i]=$.useState(!1);if($.useEffect(()=>{if(!r)return;const c=d=>{d.key==="Escape"&&a()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a,r]),$.useEffect(()=>{i(!1)},[e]),!r||!e)return null;const o=(()=>{const c=t.split("/").pop()?.trim();if(c&&/\.[A-Za-z0-9]+$/.test(c))return c;try{const v=new URL(e,window.location.href).pathname.split("/").pop()?.trim();if(v&&/\.[A-Za-z0-9]+$/.test(v))return v}catch{}return"image.png"})(),u=()=>{const c=document.createElement("a");c.href=e,c.download=o,c.rel="noopener",document.body.appendChild(c),c.click(),c.remove()};return C.jsx("div",{className:"image-lightbox-backdrop",role:"presentation",onMouseDown:c=>{c.target===c.currentTarget&&a()},children:C.jsxs("section",{"aria-label":t?`Image preview: ${t}`:"Image preview","aria-modal":"true",className:"image-lightbox-dialog",role:"dialog",children:[C.jsxs("header",{className:"image-lightbox-header",children:[C.jsx("span",{title:t,children:t}),C.jsxs("div",{className:"image-lightbox-actions",children:[C.jsx("button",{type:"button","aria-label":"Download image",title:"Download",onClick:u,children:C.jsx(f1,{size:16})}),C.jsx("button",{type:"button","aria-label":"Close image preview",title:"Close",onClick:a,children:C.jsx(p1,{size:16})})]})]}),C.jsx("div",{className:"image-lightbox-frame",children:n?C.jsx("div",{className:"image-lightbox-error",children:"Image preview unavailable"}):C.jsx("img",{alt:t||"Image preview",decoding:"async",draggable:!1,src:e,onError:()=>i(!0)})})]})})}function sa(r,e){const t=la(r),[a,n]=$.useState(()=>t.getUrl(e));return $.useEffect(()=>{let i=!1;return n(t.getUrl(e)),t.loadUrl(e).then(o=>{i||n(o)}),()=>{i=!0}},[e,t]),a}function la(r){const[,e]=$.useState(0),t=$.useCallback(n=>!r||!n?null:(U0.activateConnection(r),U0.get(Pe(r,"local-image",n))),[r]),a=$.useCallback(async n=>{if(!r||!n)return null;U0.activateConnection(r);const i=Pe(r,"local-image",n);return U0.load(i,()=>aa.signLocalImageUrl(r,{path:n})).finally(()=>e(o=>o+1))},[r]);return $.useMemo(()=>({getUrl:t,loadUrl:a}),[t,a])}function Le(r){const e=r.replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `),t=[];let a=[],n=[],i=[],o=!1,u,c=null,d,v=0,b=null;function y(){a.length!==0&&(t.push({type:"paragraph",content:a.join(`
4
4
  `).trim()}),a=[])}function w(){n.length!==0&&(t.push({type:"blockquote",content:n.join(`
@@ -1,10 +1,10 @@
1
- import{r as d,j as n}from"./index-D-VK8mST.js";import{c as O,o as W,c8 as v,c9 as U,C as _,ca as M,cb as Oe,aO as oe,i as y,a_ as We,cc as Ge,aY as de,aT as ue,s as he,cd as qe,aB as De,ai as Ke,c0 as Ve,ah as He,aJ as G,b9 as Qe,ce as Ye,cf as Ze,cg as Xe,ch as H,ci as Je,b3 as et}from"./App-DfiCmBv6.js";import{C as tt}from"./chevron-up-DD9Tei-Q.js";import{r as nt,M as me,C as fe,I as pe,a as ge,u as st}from"./MarkdownText-N60tvLug.js";import{I as q,h as it,j as at}from"./MainPane-k1iII9e9.js";import{A as B}from"./arrow-up-right-C7VWgGQP.js";import{W as rt,n as lt,B as xe}from"./chat-file-links-CqfMdhHQ.js";import{F as je}from"./folder-open-CnbcQIy8.js";import{P as ct}from"./play-B3o6IAQd.js";import{r as be}from"./desktop-files-BQj1J-ob.js";import{R as ot}from"./refresh-cw-DSJZXa8S.js";import{r as dt}from"./index-D-WCyNdJ.js";const ut=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],ht=O("circle-dashed",ut);const mt=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Ce=O("lightbulb",mt);const ft=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],pt=O("circle-x",ft);function gt(e){const t=yt(e);if(t)return t;const s=wt();let i="";const a=[],r=[],l=[];for(const h of e){if(!i&&h.label&&(i=h.label),Pt(r,h.label),Ft(l,h),h.kind==="command"&&h.content){St(s,Nt(h.content));continue}$t(s,h)||Lt(a,h.label)}const c=[...Rt(s),...r,...l],o=s.runCount>0?zt(s.runCount):"",u=Wt(a),m=(e.length===1&&e[0]?.kind==="command"&&e[0].content&&r.length===0&&l.length===0?ve(e[0].content,"completed"):null)||_t(c,o)||u||i||"Ran command";return{kind:Et(s,o),text:m}}function ve(e,t="completed"){const s=$e(e);if(s.length===0)return null;const i=t==="running"||t==="pending";if(s.some(Ne))return i?"Running shell command":"Ran shell command";const a=we(s);if(!a)return null;const[r,l]=a;if(r==="cat"){const o=w(l);return o.length===0?i?"Reading standard input":"Read standard input":`${i?"Reading":"Read"} ${S(o)}`}if(r==="sed")return vt(qt([r,...l]),i);if(r==="rg")return Dt([r,...l],i);if(["grep","ag"].includes(r)||r==="git"&&l[0]==="grep")return i?"Searching code":"Searched code";if(["ls","find","tree","fd"].includes(r)){const o=r==="ls"?w(l):[];return o.length===0?i?"Listing files":"Listed files":`${i?"Listing":"Listed"} files in ${S(o)}`}if(["head","tail","nl","wc","awk","jq"].includes(r)){const o=Se(r,l);return o.length===0?i?`Running ${r}`:`Ran ${r}`:`${i?"Reading":"Read"} ${S(o)}`}if(r==="apply_patch")return i?"Editing files":"Edited files";if(r==="write_stdin")return i?"Continuing command":"Continued command";if(r==="wait")return i?"Waiting for command":"Waited for command";if(r==="js")return i?"Running JavaScript":"Ran JavaScript";if(r==="exec_command")return i?"Running shell command":"Ran shell command";if(r==="read_file")return i?"Reading file":"Read file";if(r==="view_image")return i?"Viewing image":"Viewed image";if(r==="update_plan")return i?"Updating plan":"Updated plan";if(r==="tool_search")return i?"Searching tools":"Searched tools";if(r==="rm")return i?"Removing files":"Removed files";if(r==="mv")return i?"Moving files":"Moved files";if(r==="cp")return i?"Copying files":"Copied files";if(r==="mkdir")return i?"Creating directories":"Created directories";if(r==="touch")return i?"Creating files":"Created files";if(r==="git")return xt(l,i);if(Ct(r))return jt(r,l,i);if(ye(r))return bt(r,i);if(["curl","wget"].includes(r))return i?"Fetching URL":"Fetched URL";if(["node","tsx","python","python3","bash","sh","zsh"].includes(r))return i?`Running ${R(r)} script`:`Ran ${R(r)} script`;const c=R(r);return i?`Running ${c} command`:`Ran ${c} command`}function xt(e,t){const s=e.find(i=>!i.startsWith("-"))??"";return s==="status"?t?"Checking Git status":"Checked Git status":s==="diff"?t?"Reviewing changes":"Reviewed changes":s==="show"||s==="log"?t?"Reading Git history":"Read Git history":s==="add"?t?"Staging changes":"Staged changes":s==="commit"?t?"Committing changes":"Committed changes":s==="push"?t?"Pushing changes":"Pushed changes":s==="pull"||s==="fetch"?t?"Fetching changes":"Fetched changes":s==="checkout"||s==="switch"?t?"Switching branches":"Switched branches":s==="branch"?t?"Listing branches":"Listed branches":t?"Running Git command":"Ran Git command"}function jt(e,t,s){const i=t.join(" ").toLowerCase();return/\b(typecheck|tsc)\b/.test(i)?s?"Checking types":"Checked types":/\b(lint|eslint|prettier)\b/.test(i)?s?"Running lint":"Ran lint":/\b(test|vitest|jest|playwright)\b/.test(i)?s?"Running tests":"Ran tests":/\bbuild\b/.test(i)?s?"Building project":"Built project":/\b(install|add)\b/.test(i)?s?"Installing dependencies":"Installed dependencies":s?`Running ${R(e)} command`:`Ran ${R(e)} command`}function bt(e,t){return e==="tsc"?t?"Checking types":"Checked types":e==="eslint"||e==="prettier"?t?"Running lint":"Ran lint":t?"Running tests":"Ran tests"}function Ct(e){return["bun","npm","pnpm","yarn"].includes(e)}function R(e){const t=e.split("/").filter(Boolean).at(-1)??e;return t==="python"||t==="python3"?"Python":t==="node"||t==="tsx"?"Node":["bash","sh","zsh"].includes(t)?"shell":t==="git"?"Git":t}function vt(e,t){return!e||!t?e:e.startsWith("Read ")?`Reading ${e.slice(5)}`:e.startsWith("Run ")?`Running ${e.slice(4)}`:e}function wt(){return{approvals:0,controlCount:0,editCount:0,goalContextUpdates:0,imageCount:0,listedFiles:0,readFileCount:0,readFiles:new Set,reasoningCount:0,runCount:0,searchedCode:0,subagentStatuses:new Map,testsOrChecks:0,turnInterruptions:0,webSearches:0}}function yt(e){if(e.length===0)return null;const t=e.map(r=>r.subagentMessage).filter(r=>!!r);if(t.length===0||t.length!==e.length)return null;if(t.length===1){const r=t[0];return{kind:"subagent",text:`${r.direction==="received"?"Child Message Received":"Child Message Sent"}: ${r.summary}`}}const s=t.filter(r=>r.direction==="received").length,i=t.length-s,a=[s>0?Q(s,"received"):null,i>0?Q(i,"sent"):null].filter(r=>!!r);return{kind:"subagent",text:E(D(a))}}function Q(e,t){return e===1?`child message ${t}`:`${e} child messages ${t}`}function St(e,t){e.editCount+=t.editCount??0,e.listedFiles+=t.listedFiles??0,e.searchedCode+=t.searchedCode??0,e.testsOrChecks+=t.testsOrChecks??0;for(const s of t.readFiles??[])e.readFiles.add(s);t.readFiles?.length&&(e.readFileCount+=t.readFiles.length),t.countedAsRun&&(e.runCount+=1)}function $t(e,t){const s=t.label.toLowerCase();if(t.controlKind)return e.controlCount+=1,t.controlKind==="goal_context"&&(e.goalContextUpdates+=1),t.controlKind==="turn_aborted"&&(e.turnInterruptions+=1),!0;if(s==="reasoning")return e.reasoningCount+=1,!0;if(s.includes("approval"))return e.approvals+=1,!0;if(s.includes("subagent"))return Tt(e,t,i(s)),!0;if(s.includes("image"))return e.imageCount+=1,!0;function i(a){return a.includes("failed")?"failed":a.includes("blocked")?"blocked":a.includes("stale")?"stale":a.includes("needs revision")?"needs revision":a.includes("archived")?"archived":a.includes("accepted")?"accepted":a.includes("submitted")?"submitted":a.includes("completed")?"completed":"running"}return s.includes("web")?(e.webSearches+=1,!0):/\b(searching|searched)\b/.test(s)?(e.searchedCode+=1,!0):/\b(listing|listed)\b/.test(s)?(e.listedFiles+=1,!0):/\b(reading|read)\b/.test(s)?(e.readFileCount+=1,!0):/\b(editing|edited|writing|wrote|deleting|deleted|moving|moved|uploading|uploaded|creating|created)\b/.test(s)?(e.editCount+=1,!0):!1}function Nt(e){const t=$e(e);if(t.length===0||t.some(Ne))return{countedAsRun:!0};const s=we(t);if(!s)return{countedAsRun:!0};const[i,a]=s;if(i==="apply_patch")return{countedAsRun:!1,editCount:1};if(["rm","mv","cp","mkdir","touch"].includes(i))return{countedAsRun:!1,editCount:1};if(kt(i,a)||ye(i))return{countedAsRun:!1,testsOrChecks:1};if(i==="rg")return a.includes("--files")?{countedAsRun:!1,listedFiles:1}:{countedAsRun:!1,searchedCode:1};if(["grep","ag"].includes(i))return{countedAsRun:!1,searchedCode:1};if(i==="git"&&a[0]==="grep")return{countedAsRun:!1,searchedCode:1};if(["ls","find","tree","fd"].includes(i))return{countedAsRun:!1,listedFiles:1};const r=Se(i,a);return r.length>0?{countedAsRun:!1,readFiles:r}:{countedAsRun:!0}}function we(e){let t=0;for(;/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(e[t]??"");)t+=1;const s=e[t];if(!s)return null;if(s==="bunx"||s==="npx"){const i=e[t+1];return i?[i,e.slice(t+2)]:[s,[]]}return[s,e.slice(t+1)]}function kt(e,t){if(!["bun","npm","pnpm","yarn"].includes(e))return!1;const s=t.join(" ").toLowerCase();return/\b(test|typecheck|check|lint|vitest|jest|playwright|tsc)\b/.test(s)}function ye(e){return["eslint","jest","playwright","prettier","tsc","vitest"].includes(e)}function Se(e,t){if(e==="cat"||e==="nl"||e==="head"||e==="tail"||e==="wc")return F(w(t));if(e==="sed"){const s=t.findIndex(i=>i!=="-n"&&!i.startsWith("--"));return F(s>=0?w(t.slice(s+1)):[])}return e==="awk"||e==="jq"?F(w(t.slice(1))):[]}function F(e){return e.filter(t=>!(!t||t==="."||t==="-"||/^\d+$/.test(t)))}function Rt(e){const t=[],s=Mt(e);s&&t.push(s),e.editCount>0&&t.push("made edits");const i=e.readFiles.size||e.readFileCount;return i>0&&t.push(Z("read",i,"file")),e.searchedCode>0&&t.push("searched code"),e.listedFiles>0&&t.push("listed files"),e.testsOrChecks>0&&t.push(e.testsOrChecks===1?"ran checks":`ran ${e.testsOrChecks} checks`),e.webSearches>0&&t.push("searched web"),e.imageCount>0&&t.push(Z("read",e.imageCount,"image")),e.reasoningCount>0&&t.length===0&&t.push("thought through the request"),e.approvals>0&&t.push("requested approval"),t.push(...At(e)),t}function At(e){const t=[];e.goalContextUpdates===1&&t.push("goal context updated"),e.goalContextUpdates>1&&t.push(`${e.goalContextUpdates} goal context updates`),e.turnInterruptions===1&&t.push("turn interrupted"),e.turnInterruptions>1&&t.push(`${e.turnInterruptions} turns interrupted`);const s=e.controlCount-e.goalContextUpdates-e.turnInterruptions;return s===1&&t.push("context updated"),s>1&&t.push(`${s} context updates`),t}function Mt(e){const t=It(e);return t.failed>0?b(t.failed,"failed"):t.blocked>0?b(t.blocked,"blocked"):t.stale>0?b(t.stale,"stale"):t["needs revision"]>0?b(t["needs revision"],"needs revision"):t.submitted>0?b(t.submitted,"submitted"):t.running>0&&t.completed===0&&t.accepted===0?b(t.running,"running"):t.accepted>0?b(t.accepted,"accepted"):t.completed>0?b(t.completed,"completed"):t.archived>0?b(t.archived,"archived"):null}function Tt(e,t,s){const i=t.openSession?.sessionId??(t.content.trim()||t.id),a=e.subagentStatuses.get(i);(!a||Y(s)>Y(a))&&e.subagentStatuses.set(i,s)}function It(e){const t={accepted:0,archived:0,blocked:0,completed:0,failed:0,"needs revision":0,running:0,stale:0,submitted:0};for(const s of e.subagentStatuses.values())t[s]+=1;return t}function Y(e){return e==="running"?1:e==="submitted"?2:e==="accepted"||e==="completed"||e==="archived"?3:e==="needs revision"?4:e==="blocked"?5:e==="stale"?6:7}function b(e,t){return e===1?`subagent ${t}`:`${e} subagents ${t}`}function Et(e,t){const s=[];return e.subagentStatuses.size>0&&s.push("subagent"),e.editCount>0&&s.push("edit"),(e.readFiles.size>0||e.readFileCount>0)&&s.push("read"),e.searchedCode>0&&s.push("search"),e.listedFiles>0&&s.push("list"),e.webSearches>0&&s.push("web"),e.imageCount>0&&s.push("image"),e.reasoningCount>0&&s.push("reasoning"),e.approvals>0&&s.push("approval"),e.controlCount>0&&s.push("control"),(e.testsOrChecks>0||t)&&s.push("command"),s[0]??"command"}function zt(e){return e===1?"ran a command":`ran ${e} commands`}function Z(e,t,s){return t===1?`${e} a ${s}`:`${e} ${t} ${s}s`}function _t(e,t){return e.length===0?t?E(t):"":E(D(t?[...e,t]:e))}function Lt(e,t){const s=t.trim();s&&(e.includes(s)||e.push(s))}function Pt(e,t){const s=Ut(t);!s||e.includes(s)||e.push(s)}function Ft(e,t){const s=t.receipt;if(!s)return;const i=`${s.status} receipt ${Ot(s.id)} ${Bt(s.totalUsd)}`;e.includes(i)||e.push(i)}function Ut(e){switch(e.trim().toLowerCase()){case"applied locally":return"applied locally";case"apply locally failed":return"apply locally failed";case"exported sandbox patch":return"exported patch";case"patch export failed":return"patch export failed";case"preserved sandbox source":return"preserved sandbox source";case"preserve failed":return"preserve failed";case"stopped sandbox":return"stopped sandbox";case"sandbox stop failed":return"sandbox stop failed";default:return null}}function Bt(e){const t=e.trim();return t.startsWith("$")?t:`$${t}`}function Ot(e){const t=e.trim();return t.length<=14?t:`${t.slice(0,6)}...${t.slice(-4)}`}function Wt(e){return e.length===0?"":E(D(e.map(Gt)))}function Gt(e){return e&&`${e[0].toLowerCase()}${e.slice(1)}`}function D(e){return e.length===0?"":e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`}function E(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function qt(e){const t=e.findIndex((r,l)=>l>0&&r!=="-n"&&!r.startsWith("--")),s=t>=0?e[t]??"":"",i=t>=0?w(e.slice(t+1)):[],a=/^(\d+)(?:,(\d+))?p$/.exec(s);if(a){const r=a[1],l=a[2],c=l?`lines ${r}-${l}`:`line ${r}`;return i.length>0?`Read ${c} of ${S(i)}`:`Read ${c}`}return i.length>0?`Read ${S(i)} with sed`:"Run sed"}function Dt(e,t=!1){const s=e.slice(1);if(s.includes("--files")){const l=w(s.filter(c=>c!=="--files"));return l.length>0?`${t?"Listing":"Listed"} files matching ${S(l)}`:t?"Listing files":"Listed files"}const i=w(s),a=i[0],r=i.slice(1);return a?r.length>0?`${t?"Searching":"Searched"} for ${X(a)} in ${S(r)}`:`${t?"Searching":"Searched"} for ${X(a)}`:t?"Searching files":"Searched files"}function $e(e){return(e.match(/"([^"\\]|\\.)*"|'[^']*'|[^\s]+/g)??[]).map(s=>Kt(s)).filter(Boolean)}function Kt(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Ne(e){return["|","&&","||",";",">",">>","<","(",")"].includes(e)}function w(e){const t=[];for(let s=0;s<e.length;s+=1){const i=e[s];if(!i.startsWith("-")){t.push(i);continue}Vt(i)&&s+1<e.length&&(s+=1)}return t}function Vt(e){return["-e","-f","-g","--glob","--type","-t","--context","-C","-A","-B","-m","-n","-c"].includes(e)}function S(e){return e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e[0]} and ${e.length-1} more`}function X(e){return`"${e}"`}function Ht(e,t,s){return new Set(e.filter(i=>{if(t.has(i.id))return!1;if(s===void 0)return!0;if(typeof i.timestamp!="string")return!1;const a=Date.parse(i.timestamp);return Number.isFinite(a)&&a>=s}).map(i=>i.id))}function J(e){let t=null;for(const s of e){if(typeof s.timestamp!="string")continue;const i=Date.parse(s.timestamp);Number.isFinite(i)&&(t=t===null?i:Math.max(t,i))}return t}function Ws(e,t){const s=d.useRef({scopeKey:t,ids:new Set(e.map(l=>l.id)),initialized:!1,liveCutoff:null}),i=s.current.scopeKey===t,r=i&&s.current.initialized?Ht(e,s.current.ids,s.current.liveCutoff??void 0):new Set;return d.useLayoutEffect(()=>{const l=s.current,c=l.scopeKey!==t,o=Date.now();s.current={scopeKey:t,ids:new Set(e.map(u=>u.id)),initialized:!c,liveCutoff:c?Math.max(o,J(e)??0):l.liveCutoff??Math.max(o,J(e)??0)}},[e,i,t]),r}const ee=new Map,Qt=[200,600,1500];function Gs({connection:e,latestTurnId:t,sessionId:s,turnRunning:i}){const[a,r]=d.useState(()=>({sessionId:null,summaries:ee}));return d.useEffect(()=>{if(!e||!s)return;let l=!1,c=null;const o=i?null:t,u=m=>{const h=Qt[m];h===void 0||l||(c=setTimeout(()=>{f(m+1)},h))},f=async m=>{try{const h=await W.usageTurnCache(e,s);if(l)return;const x=new Map(h.turns.map(g=>[g.turnId,g]));r({sessionId:s,summaries:x}),o&&!x.has(o)&&u(m)}catch{u(m)}};return f(0),()=>{l=!0,c!==null&&clearTimeout(c)}},[e,t,s,i]),a.sessionId===s?a.summaries:ee}function Yt(e,t){const s=Zt(e),[i,a]=d.useState(()=>s.getUrl(t));return d.useEffect(()=>{let r=!1;return a(s.getUrl(t)),s.loadUrl(t).then(l=>{r||a(l)}),()=>{r=!0}},[t,s]),i}function Zt(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:(v.activateConnection(e),v.get(te(e,a))),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;const r=te(e,a);return v.activateConnection(e),v.load(r,()=>W.signChatAttachmentImageUrl(e,a)).finally(()=>t(l=>l+1))},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function te(e,t){return U(e,"chat-attachment-image",t.sessionId,t.turnId,t.attachmentId,t.storageName,t.contentType)}const Xt=64,Jt=120,en=210,tn=360,nn=40,sn=120,an=600,rn=100,ne=33,I=new Set;let T=!1;function ln(e,t,s=0){if(e<=0)return{characterCount:0,remainder:0};const i=e>an?tn:e>sn?en:e>nn?Jt:Xt,a=s+Math.min(Math.max(t,0),rn)*i/1e3,r=Math.min(e,Math.floor(a));return{characterCount:r,remainder:a-r}}function ke(e,t,s){let i=Math.min(t.length,e.length+s);const a=t.charCodeAt(i-1),r=t.charCodeAt(i);return a>=55296&&a<=56319&&r>=56320&&r<=57343&&(i+=1),t.slice(0,i)}function se(){return typeof window<"u"&&typeof window.matchMedia=="function"&&typeof document<"u"&&document.visibilityState==="visible"&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}function cn(e,t,s){return t&&s?ke("",e,1):e}function on(e,t=!1){const[s,i]=d.useState(()=>cn(e,t,se())),a=d.useRef(s),r=d.useRef(e),l=d.useRef(null),c=d.useRef(null),o=d.useRef(0),u=d.useRef(!0);return d.useEffect(()=>(u.current=!0,()=>{u.current=!1,l.current!==null&&(window.clearTimeout(l.current),l.current=null)}),[]),d.useEffect(()=>{if(r.current=e,!se()||!e.startsWith(a.current)){l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=e,u.current&&i(e);return}if(a.current.length===e.length||l.current!==null)return;const f=()=>{if(!u.current){l.current=null;return}const m=a.current,h=r.current,x=performance.now();if(!h.startsWith(m)){a.current=h,i(h),l.current=null,c.current=null,o.current=0;return}const g=h.length-m.length;if(g===0){l.current=null,c.current=null,o.current=0;return}const $=c.current===null?16:x-c.current,C=ln(g,$,o.current);if(c.current=x,o.current=C.remainder,C.characterCount>0){const j=ke(m,h,C.characterCount);a.current=j,i(j)}l.current=window.setTimeout(f,ne)};return l.current=window.setTimeout(f,ne),()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[e]),d.useEffect(()=>{const m=dn(()=>{document.visibilityState!=="visible"&&(l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=r.current,u.current&&i(r.current))});return()=>{m(),l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[]),s}function dn(e){return I.add(e),T||(document.addEventListener("visibilitychange",ie),T=!0),()=>{I.delete(e),I.size===0&&T&&(document.removeEventListener("visibilitychange",ie),T=!1)}}function ie(){for(const e of I)e()}function Re({animateInitialContent:e=!1,content:t,...s}){const i=on(t,e),a=nt(i,i.length===t.length),r=un(a,i.length===t.length);return n.jsx(me,{...s,content:a,finalizedContent:r.finalized,mutableContent:r.mutable})}function un(e,t){if(t||!e)return{finalized:e,mutable:""};const s=e.split(`
2
- `);let i=!1,a=null,r=0,l=0;for(let c=0;c<s.length-1;c+=1){const o=s[c]??"",u=o.trim();!a&&/^\s*```/.test(o)&&(i=!i),i||(a&&u.endsWith(a)?a=null:!a&&u.startsWith("\\[")&&!u.endsWith("\\]")?a="\\]":!a&&u.startsWith("$$")&&u.indexOf("$$",2)<0&&(a="$$")),r+=o.length+1,!i&&!a&&u===""&&(l=r)}return{finalized:e.slice(0,l),mutable:e.slice(l)}}function L({children:e,className:t="",controls:s,danger:i=!1,expanded:a=!1,icon:r,onToggle:l,running:c=!1}){const o=["activity-summary",l?"":"static",i?"danger":"",c?"working":"",t].filter(Boolean).join(" "),u=n.jsxs(n.Fragment,{children:[r,n.jsx("span",{className:"activity-summary-text",children:n.jsx("span",{children:e})}),l?n.jsx(_,{"aria-hidden":!0,className:`activity-summary-toggle ${a?"expanded":""}`,size:14}):null]});return l?n.jsx("button",{type:"button","aria-controls":s,"aria-expanded":a,className:o,onClick:l,children:u}):n.jsx("div",{className:o,role:c?"status":void 0,children:u})}function hn({actionRun:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i=null}){const a=gn(e.status),r=xn(e);return n.jsxs("div",{className:`action-run-card ${e.status}`,children:[n.jsxs("div",{className:"action-run-header",children:[n.jsx("span",{className:"action-run-status",title:e.status,children:n.jsx(a,{size:15})}),n.jsxs("div",{className:"action-run-title",children:[n.jsx("strong",{children:e.title}),n.jsx("span",{children:e.actionName})]})]}),r.length>0&&n.jsx("div",{className:"action-run-meta","aria-label":"Action run metadata",children:r.map(l=>n.jsxs("span",{className:"action-run-chip",children:[l.icon,n.jsx("span",{children:l.label}),n.jsx("code",{children:l.value})]},l.label))}),e.responseText&&n.jsx("p",{className:"action-run-response",children:e.responseText}),e.refs.length>0&&n.jsx("div",{className:"action-run-ref-list","aria-label":"Action run references",children:e.refs.slice(0,8).map(l=>n.jsx(pn,{refItem:l,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i},l.id))}),e.childCalls.length>0&&n.jsx("div",{className:"action-run-child-list","aria-label":"Child implementation calls",children:e.childCalls.map(l=>n.jsxs("div",{className:`action-run-child ${l.status}`,children:[n.jsx("span",{children:l.label}),n.jsx("small",{children:l.status}),l.detail&&n.jsx("code",{children:l.detail})]},l.id))})]})}function ae(e){return e.implementationType==="openpond-profile-action"}function mn(e){const t=e.agentName??e.agentId;return e.actionName.endsWith(".chat")?M({actionId:e.actionName,label:e.title,name:t}):t?M({actionId:e.actionName,name:t}):e.title&&!Oe(e.title)?M({actionId:e.actionName,label:e.title}):M({actionId:e.actionName})}function fn(e){return e.status==="failed"?`${e.title} failed.`:e.status==="completed"?`${e.title} completed.`:e.status==="pending"?`${e.title} is pending.`:`${e.title} is running...`}function pn({refItem:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i}){const a=s?lt(e.target,{workspaceRootPath:i}):null,r=jn(e.target)&&t,l=!!(a&&s);return n.jsxs("div",{className:`action-run-ref ${e.kind}`,children:[n.jsx("span",{children:e.label}),n.jsx("code",{children:e.target}),r&&n.jsx("button",{type:"button",title:`Open ${e.target}`,"aria-label":`Open ${e.label}`,onClick:()=>t(e.target,{newTab:!0}),children:n.jsx(B,{size:13})}),l&&n.jsx("button",{type:"button",title:`Open ${e.target}`,"aria-label":`Open ${e.label}`,onClick:()=>{a&&s&&s(a.path)},children:n.jsx(B,{size:13})})]})}function gn(e){return e==="completed"?oe:e==="failed"?pt:ht}function xn(e){const t=[];return e.implementationType&&t.push({label:"Type",value:e.implementationType,icon:n.jsx(rt,{size:12})}),e.runId&&t.push({label:"Run",value:e.runId,icon:n.jsx(y,{size:12})}),e.sandboxId&&t.push({label:"Sandbox",value:e.sandboxId,icon:n.jsx(y,{size:12})}),e.sourceRef&&t.push({label:"Source",value:e.sourceRef,icon:n.jsx(We,{size:12})}),e.manifestHash&&t.push({label:"Manifest",value:e.manifestHash,icon:n.jsx(y,{size:12})}),t}function jn(e){return/^https?:\/\//i.test(e)}function bn(e,t){const s=Cn(e),[i,a]=d.useState(()=>s.getUrl(t));return d.useEffect(()=>{let r=!1;return a(s.getUrl(t)),s.loadUrl(t).then(l=>{r||a(l)}),()=>{r=!0}},[t,s]),i}function Cn(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:(v.activateConnection(e),v.get(U(e,"local-video",a))),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;v.activateConnection(e);const r=U(e,"local-video",a);return v.load(r,()=>W.signLocalVideoUrl(e,{path:a})).finally(()=>t(l=>l+1))},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function vn(e,t){return{toolCount:e.reduce((i,a)=>i+(re(a)?0:1),0),toolsExpanded:t,visibleActivities:t?e.filter(i=>!re(i)):[]}}function re(e){return e.kind==="reasoning"}function wn(e,t){if(!e||!t)return null;const s=Date.parse(t)-Date.parse(e);if(!Number.isFinite(s)||s<1e3)return null;const i=Math.round(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60),r=i%60;if(a<60)return r>0?`${a}m ${r}s`:`${a}m`;const l=Math.floor(a/60),c=a%60;return c>0?`${l}h ${c}m`:`${l}h`}const yn=4;function Sn({onOpenSession:e,onShowAll:t,sessions:s}){const i=s.slice(0,yn),a=Math.max(0,s.length-i.length),r=s.map(Me).join(", ");return n.jsxs("div",{"aria-label":`Subagent conversations: ${r}`,className:"activity-subagent-avatar-group",title:`Subagent conversations: ${r}`,children:[i.map(l=>n.jsx(Ae,{openSession:l,onOpenSession:e},l.sessionId)),a>0?n.jsxs("button",{type:"button","aria-label":`Show ${a} more subagent conversation${a===1?"":"s"}`,className:"activity-subagent-avatar activity-subagent-avatar-count",onClick:t,title:`Show ${a} more subagent conversation${a===1?"":"s"}`,children:["+",a]}):null]})}function Ae({className:e="",onOpenSession:t,openSession:s}){const i=Ie(s.roleId),a=kn(s.status),r=`Open ${Me(s)} conversation`;return n.jsx("button",{type:"button","aria-label":r,className:`activity-subagent-avatar ${e}`,"data-role":i,"data-status":a,onClick:()=>t(s.sessionId),title:r,children:n.jsx($n,{roleId:i})})}function $n({roleId:e}){return e==="coding"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M9.4 7.2 4.8 12l4.6 4.8"}),n.jsx("path",{d:"m14.6 7.2 4.6 4.8-4.6 4.8"}),n.jsx("path",{d:"m12.9 5.7-1.8 12.6"})]}):e==="research"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.2"}),n.jsx("path",{d:"m15 15 4 4"}),n.jsx("path",{d:"M8.6 10.8h4.4"}),n.jsx("path",{d:"M10.8 8.6v4.4"})]}):e==="review"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M7 4.8h7.2L18 8.6v10.6H7z"}),n.jsx("path",{d:"M14 4.8v4h4"}),n.jsx("path",{d:"m8.9 14.2 2 2 4.3-4.7"})]}):e==="test"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M9.2 4.8h5.6"}),n.jsx("path",{d:"M10.4 4.8v5.4l-4 6.8a1.8 1.8 0 0 0 1.6 2.7h8a1.8 1.8 0 0 0 1.6-2.7l-4-6.8V4.8"}),n.jsx("path",{d:"M8.2 15.8h7.6"})]}):e==="docs"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M7 4.8h7.2L18 8.6v10.6H7z"}),n.jsx("path",{d:"M14 4.8v4h4"}),n.jsx("path",{d:"M9.2 11.4h5.6"}),n.jsx("path",{d:"M9.2 14.2h5.6"}),n.jsx("path",{d:"M9.2 17h3.4"})]}):e==="planner"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("circle",{cx:"7.2",cy:"7.2",r:"2.1"}),n.jsx("circle",{cx:"16.8",cy:"7.2",r:"2.1"}),n.jsx("circle",{cx:"12",cy:"16.8",r:"2.1"}),n.jsx("path",{d:"M9 8.2h6"}),n.jsx("path",{d:"m8.5 9 2.4 5.4"}),n.jsx("path",{d:"m15.5 9-2.4 5.4"})]}):e==="summarizer"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M7 6.8h10"}),n.jsx("path",{d:"M7 10.4h8.2"}),n.jsx("path",{d:"M7 14h6.2"}),n.jsx("path",{d:"M7 17.6h4.2"})]}):n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("circle",{cx:"12",cy:"8.2",r:"3.2"}),n.jsx("path",{d:"M6.5 19.2c.6-3 2.5-5 5.5-5s4.9 2 5.5 5"}),n.jsx("path",{d:"M5.2 11.8h2"}),n.jsx("path",{d:"M16.8 11.8h2"})]})}function Nn(e){const t=new Map;for(const s of e){const i=s.openSession;i&&t.set(i.sessionId,{...t.get(i.sessionId),...i})}return[...t.values()].reverse()}function Me(e){const t=`${Te(e.roleId)} subagent`,s=e.status?.replace(/_/g," ").trim();return s?`${t} (${s})`:t}function Te(e){return Ie(e).split(/[-_]+/).filter(Boolean).map(s=>s.slice(0,1).toUpperCase()+s.slice(1)).join(" ")||"Subagent"}function Ie(e){const t=e?.trim().toLowerCase()||"subagent";return/^[a-z][a-z0-9_-]*$/.test(t)?t:"subagent"}function kn(e){const t=e?.trim().toLowerCase()||"unknown";return/^[a-z][a-z0-9_-]*$/.test(t)?t:"unknown"}function Rn({activity:e,defaultExpanded:t=!1}){const[s,i]=d.useState(t),a=d.useId(),r=Tn(e);return n.jsxs("section",{className:`harness-refiner-receipt ${e.state} ${e.result??""}`,children:[n.jsxs("button",{"aria-controls":r?a:void 0,"aria-expanded":r?s:void 0,className:"harness-refiner-receipt-summary",disabled:!r,onClick:()=>r&&i(l=>!l),type:"button",children:[n.jsx(ot,{"aria-hidden":!0,className:e.state==="running"?"spinning":void 0,size:12}),n.jsx("span",{children:Ge(e)}),r?n.jsx(_,{"aria-hidden":!0,className:`harness-refiner-receipt-toggle ${s?"expanded":""}`,size:13}):null]}),r&&s?n.jsxs("div",{className:"harness-refiner-receipt-details",id:a,children:[n.jsx(An,{activity:e}),e.reason?n.jsxs("section",{children:[n.jsx("strong",{children:"Reason"}),n.jsx("p",{children:e.reason})]}):null,e.expectedOutcome?n.jsxs("section",{children:[n.jsx("strong",{children:"Expected outcome"}),n.jsx("p",{children:e.expectedOutcome})]}):null,e.evidenceBasis?n.jsxs("section",{children:[n.jsx("strong",{children:"Evidence basis"}),n.jsx("p",{children:e.evidenceBasis.kind.replaceAll("_"," ")}),n.jsxs("small",{children:[e.evidenceBasis.supportingEvidenceIds.length," supporting item",e.evidenceBasis.supportingEvidenceIds.length===1?"":"s",e.evidenceBasis.counterevidence.length?` · ${e.evidenceBasis.counterevidence.length} counterexample${e.evidenceBasis.counterevidence.length===1?"":"s"}`:" · no material counterevidence"]})]}):null,e.validations.length?n.jsxs("section",{children:[n.jsx("strong",{children:"Validation"}),n.jsx("div",{className:"harness-refiner-validation-list",children:e.validations.map(l=>n.jsxs("div",{children:[n.jsx("span",{className:l.status,children:l.status}),n.jsx("p",{children:l.summary})]},l.id))})]}):null,e.edits.length?n.jsxs("details",{className:"harness-refiner-exact-edits",children:[n.jsxs("summary",{children:["Review ",e.edits.length," exact edit",e.edits.length===1?"":"s"]}),e.edits.map(l=>n.jsxs("section",{children:[n.jsxs("strong",{children:[l.operation," · ",l.target]}),n.jsx("p",{children:l.summary}),l.content===null?n.jsx("small",{children:"File deleted."}):n.jsx("pre",{children:l.content})]},l.id))]}):null,n.jsx(Mn,{refs:e.refs})]}):null]})}function An({activity:e}){const t=[e.route?[e.decision==="route"?"Owner":"Layer",e.route]:null,e.operation?["Operation",e.operation]:null,e.target?["Target",e.target]:null,e.critiqueStatus!=="not_applicable"?["Critique",e.critiqueStatus]:null,e.validationStatus!=="not_applicable"?["Validation",e.validationStatus]:null].filter(s=>!!s);return t.length?n.jsx("dl",{className:"harness-refiner-receipt-facts",children:t.map(([s,i])=>n.jsxs("div",{children:[n.jsx("dt",{children:s}),n.jsx("dd",{children:i?.replaceAll("_"," ")})]},s))}):null}function Mn({refs:e}){const t=Object.entries(e).filter(s=>!!s[1]);return t.length?n.jsxs("details",{className:"harness-refiner-references",children:[n.jsx("summary",{children:"Receipt references"}),n.jsx("dl",{children:t.map(([s,i])=>n.jsxs("div",{children:[n.jsx("dt",{children:In(s)}),n.jsx("dd",{children:n.jsx("code",{children:i})})]},s))})]}):null}function Tn(e){return e.state!=="running"&&!!(e.reason||e.expectedOutcome||e.route||e.operation||e.target||e.evidenceBasis||e.validations.length||e.edits.length||Object.values(e.refs).some(Boolean))}function In(e){const t=e.replace(/([a-z])([A-Z])/g,"$1 $2");return`${t[0]?.toUpperCase()??""}${t.slice(1)}`}function En({artifact:e,onOpenFileInSidebar:t}){const[s,i]=d.useState(null),a=d.useCallback(()=>i(null),[]);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"activity-artifact",title:e.path,onContextMenu:r=>{r.preventDefault(),i({path:e.path,title:e.title,..._n(r.clientX,r.clientY)})},children:[t?n.jsxs("button",{"aria-label":`Open ${e.title} in right sidebar`,className:"activity-artifact-name",type:"button",onClick:()=>t(e.path),children:[n.jsx(y,{"aria-hidden":!0,size:14}),n.jsx("strong",{children:e.title})]}):n.jsxs("span",{className:"activity-artifact-name",children:[n.jsx(y,{"aria-hidden":!0,size:14}),n.jsx("strong",{children:e.title})]}),n.jsxs("span",{className:"activity-artifact-actions",children:[n.jsx("button",{"aria-label":`Show ${e.title} in file browser`,"data-tooltip":"Open in file browser",type:"button",onClick:()=>{be(e.path)},children:n.jsx(je,{"aria-hidden":!0,size:14})}),t?n.jsx("button",{"aria-label":`Open ${e.title} in right sidebar`,"data-tooltip":"Open in right sidebar",type:"button",onClick:()=>t(e.path),children:n.jsx(de,{"aria-hidden":!0,size:14})}):null]})]}),n.jsx(zn,{menu:s,onClose:a})]})}function zn({menu:e,onClose:t}){const s=d.useRef(null);return d.useEffect(()=>{if(!e)return;s.current?.focus();const i=()=>t(),a=r=>{r.key==="Escape"&&i()};return window.addEventListener("pointerdown",i),window.addEventListener("blur",i),window.addEventListener("keydown",a),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("pointerdown",i),window.removeEventListener("blur",i),window.removeEventListener("keydown",a),window.removeEventListener("scroll",i,!0)}},[e,t]),!e||typeof document>"u"?null:dt.createPortal(n.jsx("div",{"aria-label":`${e.title} file actions`,className:"activity-artifact-context-menu",role:"menu",style:{left:e.x,top:e.y},onPointerDown:i=>i.stopPropagation(),children:n.jsxs("button",{ref:s,role:"menuitem",type:"button",onClick:()=>{ue(e.path),t()},children:[n.jsx(fe,{"aria-hidden":!0,size:14}),n.jsx("span",{children:"Copy path"})]})}),document.body)}function _n(e,t){return{x:Math.max(8,Math.min(e,window.innerWidth-164-8)),y:Math.max(8,Math.min(t,window.innerHeight-42-8))}}const Ee=5,Ln=280;function Pn({activeWorkspaceAppId:e,connection:t,message:s,onOpenFileInSidebar:i,onOpenSession:a}){const r=s.activities??[],[l,c]=d.useState(!1),[o,u]=d.useState(null),f=d.useId(),m=d.useMemo(()=>gt(r),[r]),h=d.useMemo(()=>vn(r,l),[r,l]),x=r.find(p=>p.imagePreview)?.imagePreview??null,g=s.deliverables??[],$=K(o,t,e),C=s.traceState==="running",j=s.traceState==="failed"||s.traceState==="interrupted",N=wn(s.traceStartedAt,s.traceCompletedAt),P=Vn(m.text,s.traceState,N,r),k=Nn(r);return r.length>0&&r.every(p=>p.subagentMessage)?n.jsxs(n.Fragment,{children:[n.jsx(qn,{activities:r}),n.jsx(le,{activity:s.refinerActivity})]}):n.jsxs(n.Fragment,{children:[r.length>0||g.length>0?n.jsxs("article",{className:`activity-group work-trace ${C?"running":"settled"}`,children:[r.length>0?n.jsxs("div",{className:"activity-summary-row",children:[n.jsx(L,{controls:h.toolCount>0?f:void 0,danger:j,expanded:h.toolsExpanded,icon:x?n.jsx(es,{activeWorkspaceAppId:e,connection:t,image:x}):n.jsx(ts,{kind:m.kind}),onToggle:h.toolCount>0?()=>c(p=>!p):void 0,running:C,children:P}),k.length>0&&a?n.jsx(Sn,{onOpenSession:a,onShowAll:()=>c(!0),sessions:k}):null]}):null,g.length>0?n.jsx(Bn,{artifacts:g,connection:t,onOpenFileInSidebar:i}):null,h.visibleActivities.length>0?n.jsx("div",{className:"work-trace-flow",id:f,children:h.visibleActivities.map(p=>n.jsx(Fn,{activeWorkspaceAppId:e,activity:p,connection:t,onOpenImage:u,onOpenSession:a},p.id))}):null,n.jsx(pe,{open:!!$,src:$,title:o?.path??"",onClose:()=>u(null)})]}):null,n.jsx(le,{activity:s.refinerActivity})]})}function le({activity:e}){return e?n.jsx("article",{className:"refiner-activity-row",children:n.jsx(Rn,{activity:e})}):null}function Fn({activeWorkspaceAppId:e,activity:t,connection:s,onOpenImage:i,onOpenSession:a}){const[r,l]=d.useState(!1),c=d.useId();return t.subagentMessage?n.jsx(ze,{activity:t}):n.jsxs("div",{className:`activity-tool-row ${t.controlKind==="turn_aborted"?"danger":""}`,children:[n.jsx(L,{className:"activity-tool-summary",controls:c,danger:t.controlKind==="turn_aborted",expanded:r,icon:t.kind==="command"?n.jsx(he,{"aria-hidden":!0,className:"activity-summary-kind-icon",size:12}):void 0,onToggle:()=>l(o=>!o),children:Qn(t)}),r?n.jsx(Un,{activeWorkspaceAppId:e,activity:t,connection:s,detailsId:c,onOpenImage:i,onOpenSession:a}):null]})}function Un({activeWorkspaceAppId:e,activity:t,connection:s,detailsId:i,onOpenImage:a,onOpenSession:r}){const l=K(t.imagePreview??null,s,e);return n.jsxs("div",{className:"activity-tool-details",id:i,children:[t.kind==="command"&&t.content?n.jsx(Yn,{command:t.content,exitCode:t.terminal?.exitCode,output:t.detail,state:t.state}):t.content?is(t.content)?n.jsx("pre",{className:"activity-detail-output",children:t.content}):n.jsx("code",{className:"activity-tool-content",children:t.content}):null,t.detail&&t.kind!=="command"?n.jsx("pre",{className:"activity-detail-output",children:t.detail.replace(/\r\n/g,`
1
+ import{r as d,j as n}from"./index-Dvq7bpBG.js";import{c as O,o as W,c8 as v,c9 as U,C as _,ca as M,cb as Oe,aP as oe,i as y,a$ as We,cc as Ge,aZ as de,aU as ue,s as he,cd as qe,aC as De,ai as Ke,c0 as Ve,ah as He,aK as G,b9 as Qe,ce as Ye,cf as Ze,cg as Xe,ch as H,ci as Je,ay as et}from"./App-BOkhmdHu.js";import{C as tt}from"./chevron-up-DK7ejCfk.js";import{r as nt,M as me,C as fe,I as pe,a as ge,u as st}from"./MarkdownText-DqJarmTh.js";import{I as q,h as it,j as at}from"./MainPane-BbknUzp3.js";import{A as B}from"./arrow-up-right-4nAzMtjW.js";import{W as rt,n as lt,B as xe}from"./chat-file-links-Bned0MT7.js";import{F as je}from"./folder-open-vRTuLzpS.js";import{P as ct}from"./play-BqgRTddV.js";import{r as be}from"./desktop-files-BQj1J-ob.js";import{R as ot}from"./refresh-cw-DwMA_2On.js";import{r as dt}from"./index-66-ohHD5.js";const ut=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],ht=O("circle-dashed",ut);const mt=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Ce=O("lightbulb",mt);const ft=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],pt=O("circle-x",ft);function gt(e){const t=yt(e);if(t)return t;const s=wt();let i="";const a=[],r=[],l=[];for(const h of e){if(!i&&h.label&&(i=h.label),Pt(r,h.label),Ft(l,h),h.kind==="command"&&h.content){$t(s,Nt(h.content));continue}St(s,h)||Lt(a,h.label)}const c=[...Rt(s),...r,...l],o=s.runCount>0?zt(s.runCount):"",u=Wt(a),m=(e.length===1&&e[0]?.kind==="command"&&e[0].content&&r.length===0&&l.length===0?ve(e[0].content,"completed"):null)||_t(c,o)||u||i||"Ran command";return{kind:Et(s,o),text:m}}function ve(e,t="completed"){const s=Se(e);if(s.length===0)return null;const i=t==="running"||t==="pending";if(s.some(Ne))return i?"Running shell command":"Ran shell command";const a=we(s);if(!a)return null;const[r,l]=a;if(r==="cat"){const o=w(l);return o.length===0?i?"Reading standard input":"Read standard input":`${i?"Reading":"Read"} ${$(o)}`}if(r==="sed")return vt(qt([r,...l]),i);if(r==="rg")return Dt([r,...l],i);if(["grep","ag"].includes(r)||r==="git"&&l[0]==="grep")return i?"Searching code":"Searched code";if(["ls","find","tree","fd"].includes(r)){const o=r==="ls"?w(l):[];return o.length===0?i?"Listing files":"Listed files":`${i?"Listing":"Listed"} files in ${$(o)}`}if(["head","tail","nl","wc","awk","jq"].includes(r)){const o=$e(r,l);return o.length===0?i?`Running ${r}`:`Ran ${r}`:`${i?"Reading":"Read"} ${$(o)}`}if(r==="apply_patch")return i?"Editing files":"Edited files";if(r==="write_stdin")return i?"Continuing command":"Continued command";if(r==="wait")return i?"Waiting for command":"Waited for command";if(r==="js")return i?"Running JavaScript":"Ran JavaScript";if(r==="exec_command")return i?"Running shell command":"Ran shell command";if(r==="read_file")return i?"Reading file":"Read file";if(r==="view_image")return i?"Viewing image":"Viewed image";if(r==="update_plan")return i?"Updating plan":"Updated plan";if(r==="tool_search")return i?"Searching tools":"Searched tools";if(r==="rm")return i?"Removing files":"Removed files";if(r==="mv")return i?"Moving files":"Moved files";if(r==="cp")return i?"Copying files":"Copied files";if(r==="mkdir")return i?"Creating directories":"Created directories";if(r==="touch")return i?"Creating files":"Created files";if(r==="git")return xt(l,i);if(Ct(r))return jt(r,l,i);if(ye(r))return bt(r,i);if(["curl","wget"].includes(r))return i?"Fetching URL":"Fetched URL";if(["node","tsx","python","python3","bash","sh","zsh"].includes(r))return i?`Running ${R(r)} script`:`Ran ${R(r)} script`;const c=R(r);return i?`Running ${c} command`:`Ran ${c} command`}function xt(e,t){const s=e.find(i=>!i.startsWith("-"))??"";return s==="status"?t?"Checking Git status":"Checked Git status":s==="diff"?t?"Reviewing changes":"Reviewed changes":s==="show"||s==="log"?t?"Reading Git history":"Read Git history":s==="add"?t?"Staging changes":"Staged changes":s==="commit"?t?"Committing changes":"Committed changes":s==="push"?t?"Pushing changes":"Pushed changes":s==="pull"||s==="fetch"?t?"Fetching changes":"Fetched changes":s==="checkout"||s==="switch"?t?"Switching branches":"Switched branches":s==="branch"?t?"Listing branches":"Listed branches":t?"Running Git command":"Ran Git command"}function jt(e,t,s){const i=t.join(" ").toLowerCase();return/\b(typecheck|tsc)\b/.test(i)?s?"Checking types":"Checked types":/\b(lint|eslint|prettier)\b/.test(i)?s?"Running lint":"Ran lint":/\b(test|vitest|jest|playwright)\b/.test(i)?s?"Running tests":"Ran tests":/\bbuild\b/.test(i)?s?"Building project":"Built project":/\b(install|add)\b/.test(i)?s?"Installing dependencies":"Installed dependencies":s?`Running ${R(e)} command`:`Ran ${R(e)} command`}function bt(e,t){return e==="tsc"?t?"Checking types":"Checked types":e==="eslint"||e==="prettier"?t?"Running lint":"Ran lint":t?"Running tests":"Ran tests"}function Ct(e){return["bun","npm","pnpm","yarn"].includes(e)}function R(e){const t=e.split("/").filter(Boolean).at(-1)??e;return t==="python"||t==="python3"?"Python":t==="node"||t==="tsx"?"Node":["bash","sh","zsh"].includes(t)?"shell":t==="git"?"Git":t}function vt(e,t){return!e||!t?e:e.startsWith("Read ")?`Reading ${e.slice(5)}`:e.startsWith("Run ")?`Running ${e.slice(4)}`:e}function wt(){return{approvals:0,controlCount:0,editCount:0,goalContextUpdates:0,imageCount:0,listedFiles:0,readFileCount:0,readFiles:new Set,reasoningCount:0,runCount:0,searchedCode:0,subagentStatuses:new Map,testsOrChecks:0,turnInterruptions:0,webSearches:0}}function yt(e){if(e.length===0)return null;const t=e.map(r=>r.subagentMessage).filter(r=>!!r);if(t.length===0||t.length!==e.length)return null;if(t.length===1){const r=t[0];return{kind:"subagent",text:`${r.direction==="received"?"Child Message Received":"Child Message Sent"}: ${r.summary}`}}const s=t.filter(r=>r.direction==="received").length,i=t.length-s,a=[s>0?Q(s,"received"):null,i>0?Q(i,"sent"):null].filter(r=>!!r);return{kind:"subagent",text:E(D(a))}}function Q(e,t){return e===1?`child message ${t}`:`${e} child messages ${t}`}function $t(e,t){e.editCount+=t.editCount??0,e.listedFiles+=t.listedFiles??0,e.searchedCode+=t.searchedCode??0,e.testsOrChecks+=t.testsOrChecks??0;for(const s of t.readFiles??[])e.readFiles.add(s);t.readFiles?.length&&(e.readFileCount+=t.readFiles.length),t.countedAsRun&&(e.runCount+=1)}function St(e,t){const s=t.label.toLowerCase();if(t.controlKind)return e.controlCount+=1,t.controlKind==="goal_context"&&(e.goalContextUpdates+=1),t.controlKind==="turn_aborted"&&(e.turnInterruptions+=1),!0;if(s==="reasoning")return e.reasoningCount+=1,!0;if(s.includes("approval"))return e.approvals+=1,!0;if(s.includes("subagent"))return Tt(e,t,i(s)),!0;if(s.includes("image"))return e.imageCount+=1,!0;function i(a){return a.includes("failed")?"failed":a.includes("blocked")?"blocked":a.includes("stale")?"stale":a.includes("needs revision")?"needs revision":a.includes("archived")?"archived":a.includes("accepted")?"accepted":a.includes("submitted")?"submitted":a.includes("completed")?"completed":"running"}return s.includes("web")?(e.webSearches+=1,!0):/\b(searching|searched)\b/.test(s)?(e.searchedCode+=1,!0):/\b(listing|listed)\b/.test(s)?(e.listedFiles+=1,!0):/\b(reading|read)\b/.test(s)?(e.readFileCount+=1,!0):/\b(editing|edited|writing|wrote|deleting|deleted|moving|moved|uploading|uploaded|creating|created)\b/.test(s)?(e.editCount+=1,!0):!1}function Nt(e){const t=Se(e);if(t.length===0||t.some(Ne))return{countedAsRun:!0};const s=we(t);if(!s)return{countedAsRun:!0};const[i,a]=s;if(i==="apply_patch")return{countedAsRun:!1,editCount:1};if(["rm","mv","cp","mkdir","touch"].includes(i))return{countedAsRun:!1,editCount:1};if(kt(i,a)||ye(i))return{countedAsRun:!1,testsOrChecks:1};if(i==="rg")return a.includes("--files")?{countedAsRun:!1,listedFiles:1}:{countedAsRun:!1,searchedCode:1};if(["grep","ag"].includes(i))return{countedAsRun:!1,searchedCode:1};if(i==="git"&&a[0]==="grep")return{countedAsRun:!1,searchedCode:1};if(["ls","find","tree","fd"].includes(i))return{countedAsRun:!1,listedFiles:1};const r=$e(i,a);return r.length>0?{countedAsRun:!1,readFiles:r}:{countedAsRun:!0}}function we(e){let t=0;for(;/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(e[t]??"");)t+=1;const s=e[t];if(!s)return null;if(s==="bunx"||s==="npx"){const i=e[t+1];return i?[i,e.slice(t+2)]:[s,[]]}return[s,e.slice(t+1)]}function kt(e,t){if(!["bun","npm","pnpm","yarn"].includes(e))return!1;const s=t.join(" ").toLowerCase();return/\b(test|typecheck|check|lint|vitest|jest|playwright|tsc)\b/.test(s)}function ye(e){return["eslint","jest","playwright","prettier","tsc","vitest"].includes(e)}function $e(e,t){if(e==="cat"||e==="nl"||e==="head"||e==="tail"||e==="wc")return F(w(t));if(e==="sed"){const s=t.findIndex(i=>i!=="-n"&&!i.startsWith("--"));return F(s>=0?w(t.slice(s+1)):[])}return e==="awk"||e==="jq"?F(w(t.slice(1))):[]}function F(e){return e.filter(t=>!(!t||t==="."||t==="-"||/^\d+$/.test(t)))}function Rt(e){const t=[],s=Mt(e);s&&t.push(s),e.editCount>0&&t.push("made edits");const i=e.readFiles.size||e.readFileCount;return i>0&&t.push(Z("read",i,"file")),e.searchedCode>0&&t.push("searched code"),e.listedFiles>0&&t.push("listed files"),e.testsOrChecks>0&&t.push(e.testsOrChecks===1?"ran checks":`ran ${e.testsOrChecks} checks`),e.webSearches>0&&t.push("searched web"),e.imageCount>0&&t.push(Z("read",e.imageCount,"image")),e.reasoningCount>0&&t.length===0&&t.push("thought through the request"),e.approvals>0&&t.push("requested approval"),t.push(...At(e)),t}function At(e){const t=[];e.goalContextUpdates===1&&t.push("goal context updated"),e.goalContextUpdates>1&&t.push(`${e.goalContextUpdates} goal context updates`),e.turnInterruptions===1&&t.push("turn interrupted"),e.turnInterruptions>1&&t.push(`${e.turnInterruptions} turns interrupted`);const s=e.controlCount-e.goalContextUpdates-e.turnInterruptions;return s===1&&t.push("context updated"),s>1&&t.push(`${s} context updates`),t}function Mt(e){const t=It(e);return t.failed>0?b(t.failed,"failed"):t.blocked>0?b(t.blocked,"blocked"):t.stale>0?b(t.stale,"stale"):t["needs revision"]>0?b(t["needs revision"],"needs revision"):t.submitted>0?b(t.submitted,"submitted"):t.running>0&&t.completed===0&&t.accepted===0?b(t.running,"running"):t.accepted>0?b(t.accepted,"accepted"):t.completed>0?b(t.completed,"completed"):t.archived>0?b(t.archived,"archived"):null}function Tt(e,t,s){const i=t.openSession?.sessionId??(t.content.trim()||t.id),a=e.subagentStatuses.get(i);(!a||Y(s)>Y(a))&&e.subagentStatuses.set(i,s)}function It(e){const t={accepted:0,archived:0,blocked:0,completed:0,failed:0,"needs revision":0,running:0,stale:0,submitted:0};for(const s of e.subagentStatuses.values())t[s]+=1;return t}function Y(e){return e==="running"?1:e==="submitted"?2:e==="accepted"||e==="completed"||e==="archived"?3:e==="needs revision"?4:e==="blocked"?5:e==="stale"?6:7}function b(e,t){return e===1?`subagent ${t}`:`${e} subagents ${t}`}function Et(e,t){const s=[];return e.subagentStatuses.size>0&&s.push("subagent"),e.editCount>0&&s.push("edit"),(e.readFiles.size>0||e.readFileCount>0)&&s.push("read"),e.searchedCode>0&&s.push("search"),e.listedFiles>0&&s.push("list"),e.webSearches>0&&s.push("web"),e.imageCount>0&&s.push("image"),e.reasoningCount>0&&s.push("reasoning"),e.approvals>0&&s.push("approval"),e.controlCount>0&&s.push("control"),(e.testsOrChecks>0||t)&&s.push("command"),s[0]??"command"}function zt(e){return e===1?"ran a command":`ran ${e} commands`}function Z(e,t,s){return t===1?`${e} a ${s}`:`${e} ${t} ${s}s`}function _t(e,t){return e.length===0?t?E(t):"":E(D(t?[...e,t]:e))}function Lt(e,t){const s=t.trim();s&&(e.includes(s)||e.push(s))}function Pt(e,t){const s=Ut(t);!s||e.includes(s)||e.push(s)}function Ft(e,t){const s=t.receipt;if(!s)return;const i=`${s.status} receipt ${Ot(s.id)} ${Bt(s.totalUsd)}`;e.includes(i)||e.push(i)}function Ut(e){switch(e.trim().toLowerCase()){case"applied locally":return"applied locally";case"apply locally failed":return"apply locally failed";case"exported sandbox patch":return"exported patch";case"patch export failed":return"patch export failed";case"preserved sandbox source":return"preserved sandbox source";case"preserve failed":return"preserve failed";case"stopped sandbox":return"stopped sandbox";case"sandbox stop failed":return"sandbox stop failed";default:return null}}function Bt(e){const t=e.trim();return t.startsWith("$")?t:`$${t}`}function Ot(e){const t=e.trim();return t.length<=14?t:`${t.slice(0,6)}...${t.slice(-4)}`}function Wt(e){return e.length===0?"":E(D(e.map(Gt)))}function Gt(e){return e&&`${e[0].toLowerCase()}${e.slice(1)}`}function D(e){return e.length===0?"":e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`}function E(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function qt(e){const t=e.findIndex((r,l)=>l>0&&r!=="-n"&&!r.startsWith("--")),s=t>=0?e[t]??"":"",i=t>=0?w(e.slice(t+1)):[],a=/^(\d+)(?:,(\d+))?p$/.exec(s);if(a){const r=a[1],l=a[2],c=l?`lines ${r}-${l}`:`line ${r}`;return i.length>0?`Read ${c} of ${$(i)}`:`Read ${c}`}return i.length>0?`Read ${$(i)} with sed`:"Run sed"}function Dt(e,t=!1){const s=e.slice(1);if(s.includes("--files")){const l=w(s.filter(c=>c!=="--files"));return l.length>0?`${t?"Listing":"Listed"} files matching ${$(l)}`:t?"Listing files":"Listed files"}const i=w(s),a=i[0],r=i.slice(1);return a?r.length>0?`${t?"Searching":"Searched"} for ${X(a)} in ${$(r)}`:`${t?"Searching":"Searched"} for ${X(a)}`:t?"Searching files":"Searched files"}function Se(e){return(e.match(/"([^"\\]|\\.)*"|'[^']*'|[^\s]+/g)??[]).map(s=>Kt(s)).filter(Boolean)}function Kt(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Ne(e){return["|","&&","||",";",">",">>","<","(",")"].includes(e)}function w(e){const t=[];for(let s=0;s<e.length;s+=1){const i=e[s];if(!i.startsWith("-")){t.push(i);continue}Vt(i)&&s+1<e.length&&(s+=1)}return t}function Vt(e){return["-e","-f","-g","--glob","--type","-t","--context","-C","-A","-B","-m","-n","-c"].includes(e)}function $(e){return e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e[0]} and ${e.length-1} more`}function X(e){return`"${e}"`}function Ht(e,t,s){return new Set(e.filter(i=>{if(t.has(i.id))return!1;if(s===void 0)return!0;if(typeof i.timestamp!="string")return!1;const a=Date.parse(i.timestamp);return Number.isFinite(a)&&a>=s}).map(i=>i.id))}function J(e){let t=null;for(const s of e){if(typeof s.timestamp!="string")continue;const i=Date.parse(s.timestamp);Number.isFinite(i)&&(t=t===null?i:Math.max(t,i))}return t}function Ws(e,t){const s=d.useRef({scopeKey:t,ids:new Set(e.map(l=>l.id)),initialized:!1,liveCutoff:null}),i=s.current.scopeKey===t,r=i&&s.current.initialized?Ht(e,s.current.ids,s.current.liveCutoff??void 0):new Set;return d.useLayoutEffect(()=>{const l=s.current,c=l.scopeKey!==t,o=Date.now();s.current={scopeKey:t,ids:new Set(e.map(u=>u.id)),initialized:!c,liveCutoff:c?Math.max(o,J(e)??0):l.liveCutoff??Math.max(o,J(e)??0)}},[e,i,t]),r}const ee=new Map,Qt=[200,600,1500];function Gs({connection:e,latestTurnId:t,sessionId:s,turnRunning:i}){const[a,r]=d.useState(()=>({sessionId:null,summaries:ee}));return d.useEffect(()=>{if(!e||!s)return;let l=!1,c=null;const o=i?null:t,u=m=>{const h=Qt[m];h===void 0||l||(c=setTimeout(()=>{f(m+1)},h))},f=async m=>{try{const h=await W.usageTurnCache(e,s);if(l)return;const x=new Map(h.turns.map(g=>[g.turnId,g]));r({sessionId:s,summaries:x}),o&&!x.has(o)&&u(m)}catch{u(m)}};return f(0),()=>{l=!0,c!==null&&clearTimeout(c)}},[e,t,s,i]),a.sessionId===s?a.summaries:ee}function Yt(e,t){const s=Zt(e),[i,a]=d.useState(()=>s.getUrl(t));return d.useEffect(()=>{let r=!1;return a(s.getUrl(t)),s.loadUrl(t).then(l=>{r||a(l)}),()=>{r=!0}},[t,s]),i}function Zt(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:(v.activateConnection(e),v.get(te(e,a))),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;const r=te(e,a);return v.activateConnection(e),v.load(r,()=>W.signChatAttachmentImageUrl(e,a)).finally(()=>t(l=>l+1))},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function te(e,t){return U(e,"chat-attachment-image",t.sessionId,t.turnId,t.attachmentId,t.storageName,t.contentType)}const Xt=64,Jt=120,en=210,tn=360,nn=40,sn=120,an=600,rn=100,ne=33,I=new Set;let T=!1;function ln(e,t,s=0){if(e<=0)return{characterCount:0,remainder:0};const i=e>an?tn:e>sn?en:e>nn?Jt:Xt,a=s+Math.min(Math.max(t,0),rn)*i/1e3,r=Math.min(e,Math.floor(a));return{characterCount:r,remainder:a-r}}function ke(e,t,s){let i=Math.min(t.length,e.length+s);const a=t.charCodeAt(i-1),r=t.charCodeAt(i);return a>=55296&&a<=56319&&r>=56320&&r<=57343&&(i+=1),t.slice(0,i)}function se(){return typeof window<"u"&&typeof window.matchMedia=="function"&&typeof document<"u"&&document.visibilityState==="visible"&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}function cn(e,t,s){return t&&s?ke("",e,1):e}function on(e,t=!1){const[s,i]=d.useState(()=>cn(e,t,se())),a=d.useRef(s),r=d.useRef(e),l=d.useRef(null),c=d.useRef(null),o=d.useRef(0),u=d.useRef(!0);return d.useEffect(()=>(u.current=!0,()=>{u.current=!1,l.current!==null&&(window.clearTimeout(l.current),l.current=null)}),[]),d.useEffect(()=>{if(r.current=e,!se()||!e.startsWith(a.current)){l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=e,u.current&&i(e);return}if(a.current.length===e.length||l.current!==null)return;const f=()=>{if(!u.current){l.current=null;return}const m=a.current,h=r.current,x=performance.now();if(!h.startsWith(m)){a.current=h,i(h),l.current=null,c.current=null,o.current=0;return}const g=h.length-m.length;if(g===0){l.current=null,c.current=null,o.current=0;return}const S=c.current===null?16:x-c.current,C=ln(g,S,o.current);if(c.current=x,o.current=C.remainder,C.characterCount>0){const j=ke(m,h,C.characterCount);a.current=j,i(j)}l.current=window.setTimeout(f,ne)};return l.current=window.setTimeout(f,ne),()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[e]),d.useEffect(()=>{const m=dn(()=>{document.visibilityState!=="visible"&&(l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=r.current,u.current&&i(r.current))});return()=>{m(),l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[]),s}function dn(e){return I.add(e),T||(document.addEventListener("visibilitychange",ie),T=!0),()=>{I.delete(e),I.size===0&&T&&(document.removeEventListener("visibilitychange",ie),T=!1)}}function ie(){for(const e of I)e()}function Re({animateInitialContent:e=!1,content:t,...s}){const i=on(t,e),a=nt(i,i.length===t.length),r=un(a,i.length===t.length);return n.jsx(me,{...s,content:a,finalizedContent:r.finalized,mutableContent:r.mutable})}function un(e,t){if(t||!e)return{finalized:e,mutable:""};const s=e.split(`
2
+ `);let i=!1,a=null,r=0,l=0;for(let c=0;c<s.length-1;c+=1){const o=s[c]??"",u=o.trim();!a&&/^\s*```/.test(o)&&(i=!i),i||(a&&u.endsWith(a)?a=null:!a&&u.startsWith("\\[")&&!u.endsWith("\\]")?a="\\]":!a&&u.startsWith("$$")&&u.indexOf("$$",2)<0&&(a="$$")),r+=o.length+1,!i&&!a&&u===""&&(l=r)}return{finalized:e.slice(0,l),mutable:e.slice(l)}}function L({children:e,className:t="",controls:s,danger:i=!1,expanded:a=!1,icon:r,onToggle:l,running:c=!1}){const o=["activity-summary",l?"":"static",i?"danger":"",c?"working":"",t].filter(Boolean).join(" "),u=n.jsxs(n.Fragment,{children:[r,n.jsx("span",{className:"activity-summary-text",children:n.jsx("span",{children:e})}),l?n.jsx(_,{"aria-hidden":!0,className:`activity-summary-toggle ${a?"expanded":""}`,size:14}):null]});return l?n.jsx("button",{type:"button","aria-controls":s,"aria-expanded":a,className:o,onClick:l,children:u}):n.jsx("div",{className:o,role:c?"status":void 0,children:u})}function hn({actionRun:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i=null}){const a=gn(e.status),r=xn(e);return n.jsxs("div",{className:`action-run-card ${e.status}`,children:[n.jsxs("div",{className:"action-run-header",children:[n.jsx("span",{className:"action-run-status",title:e.status,children:n.jsx(a,{size:15})}),n.jsxs("div",{className:"action-run-title",children:[n.jsx("strong",{children:e.title}),n.jsx("span",{children:e.actionName})]})]}),r.length>0&&n.jsx("div",{className:"action-run-meta","aria-label":"Action run metadata",children:r.map(l=>n.jsxs("span",{className:"action-run-chip",children:[l.icon,n.jsx("span",{children:l.label}),n.jsx("code",{children:l.value})]},l.label))}),e.responseText&&n.jsx("p",{className:"action-run-response",children:e.responseText}),e.refs.length>0&&n.jsx("div",{className:"action-run-ref-list","aria-label":"Action run references",children:e.refs.slice(0,8).map(l=>n.jsx(pn,{refItem:l,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i},l.id))}),e.childCalls.length>0&&n.jsx("div",{className:"action-run-child-list","aria-label":"Child implementation calls",children:e.childCalls.map(l=>n.jsxs("div",{className:`action-run-child ${l.status}`,children:[n.jsx("span",{children:l.label}),n.jsx("small",{children:l.status}),l.detail&&n.jsx("code",{children:l.detail})]},l.id))})]})}function ae(e){return e.implementationType==="openpond-profile-action"}function mn(e){const t=e.agentName??e.agentId;return e.actionName.endsWith(".chat")?M({actionId:e.actionName,label:e.title,name:t}):t?M({actionId:e.actionName,name:t}):e.title&&!Oe(e.title)?M({actionId:e.actionName,label:e.title}):M({actionId:e.actionName})}function fn(e){return e.status==="failed"?`${e.title} failed.`:e.status==="completed"?`${e.title} completed.`:e.status==="pending"?`${e.title} is pending.`:`${e.title} is running...`}function pn({refItem:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i}){const a=s?lt(e.target,{workspaceRootPath:i}):null,r=jn(e.target)&&t,l=!!(a&&s);return n.jsxs("div",{className:`action-run-ref ${e.kind}`,children:[n.jsx("span",{children:e.label}),n.jsx("code",{children:e.target}),r&&n.jsx("button",{type:"button",title:`Open ${e.target}`,"aria-label":`Open ${e.label}`,onClick:()=>t(e.target,{newTab:!0}),children:n.jsx(B,{size:13})}),l&&n.jsx("button",{type:"button",title:`Open ${e.target}`,"aria-label":`Open ${e.label}`,onClick:()=>{a&&s&&s(a.path)},children:n.jsx(B,{size:13})})]})}function gn(e){return e==="completed"?oe:e==="failed"?pt:ht}function xn(e){const t=[];return e.implementationType&&t.push({label:"Type",value:e.implementationType,icon:n.jsx(rt,{size:12})}),e.runId&&t.push({label:"Run",value:e.runId,icon:n.jsx(y,{size:12})}),e.sandboxId&&t.push({label:"Sandbox",value:e.sandboxId,icon:n.jsx(y,{size:12})}),e.sourceRef&&t.push({label:"Source",value:e.sourceRef,icon:n.jsx(We,{size:12})}),e.manifestHash&&t.push({label:"Manifest",value:e.manifestHash,icon:n.jsx(y,{size:12})}),t}function jn(e){return/^https?:\/\//i.test(e)}function bn(e,t){const s=Cn(e),[i,a]=d.useState(()=>s.getUrl(t));return d.useEffect(()=>{let r=!1;return a(s.getUrl(t)),s.loadUrl(t).then(l=>{r||a(l)}),()=>{r=!0}},[t,s]),i}function Cn(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:(v.activateConnection(e),v.get(U(e,"local-video",a))),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;v.activateConnection(e);const r=U(e,"local-video",a);return v.load(r,()=>W.signLocalVideoUrl(e,{path:a})).finally(()=>t(l=>l+1))},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function vn(e,t){return{toolCount:e.reduce((i,a)=>i+(re(a)?0:1),0),toolsExpanded:t,visibleActivities:t?e.filter(i=>!re(i)):[]}}function re(e){return e.kind==="reasoning"}function wn(e,t){if(!e||!t)return null;const s=Date.parse(t)-Date.parse(e);if(!Number.isFinite(s)||s<1e3)return null;const i=Math.round(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60),r=i%60;if(a<60)return r>0?`${a}m ${r}s`:`${a}m`;const l=Math.floor(a/60),c=a%60;return c>0?`${l}h ${c}m`:`${l}h`}const yn=4;function $n({onOpenSession:e,onShowAll:t,sessions:s}){const i=s.slice(0,yn),a=Math.max(0,s.length-i.length),r=s.map(Me).join(", ");return n.jsxs("div",{"aria-label":`Subagent conversations: ${r}`,className:"activity-subagent-avatar-group",title:`Subagent conversations: ${r}`,children:[i.map(l=>n.jsx(Ae,{openSession:l,onOpenSession:e},l.sessionId)),a>0?n.jsxs("button",{type:"button","aria-label":`Show ${a} more subagent conversation${a===1?"":"s"}`,className:"activity-subagent-avatar activity-subagent-avatar-count",onClick:t,title:`Show ${a} more subagent conversation${a===1?"":"s"}`,children:["+",a]}):null]})}function Ae({className:e="",onOpenSession:t,openSession:s}){const i=Ie(s.roleId),a=kn(s.status),r=`Open ${Me(s)} conversation`;return n.jsx("button",{type:"button","aria-label":r,className:`activity-subagent-avatar ${e}`,"data-role":i,"data-status":a,onClick:()=>t(s.sessionId),title:r,children:n.jsx(Sn,{roleId:i})})}function Sn({roleId:e}){return e==="coding"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M9.4 7.2 4.8 12l4.6 4.8"}),n.jsx("path",{d:"m14.6 7.2 4.6 4.8-4.6 4.8"}),n.jsx("path",{d:"m12.9 5.7-1.8 12.6"})]}):e==="research"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.2"}),n.jsx("path",{d:"m15 15 4 4"}),n.jsx("path",{d:"M8.6 10.8h4.4"}),n.jsx("path",{d:"M10.8 8.6v4.4"})]}):e==="review"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M7 4.8h7.2L18 8.6v10.6H7z"}),n.jsx("path",{d:"M14 4.8v4h4"}),n.jsx("path",{d:"m8.9 14.2 2 2 4.3-4.7"})]}):e==="test"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M9.2 4.8h5.6"}),n.jsx("path",{d:"M10.4 4.8v5.4l-4 6.8a1.8 1.8 0 0 0 1.6 2.7h8a1.8 1.8 0 0 0 1.6-2.7l-4-6.8V4.8"}),n.jsx("path",{d:"M8.2 15.8h7.6"})]}):e==="docs"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M7 4.8h7.2L18 8.6v10.6H7z"}),n.jsx("path",{d:"M14 4.8v4h4"}),n.jsx("path",{d:"M9.2 11.4h5.6"}),n.jsx("path",{d:"M9.2 14.2h5.6"}),n.jsx("path",{d:"M9.2 17h3.4"})]}):e==="planner"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("circle",{cx:"7.2",cy:"7.2",r:"2.1"}),n.jsx("circle",{cx:"16.8",cy:"7.2",r:"2.1"}),n.jsx("circle",{cx:"12",cy:"16.8",r:"2.1"}),n.jsx("path",{d:"M9 8.2h6"}),n.jsx("path",{d:"m8.5 9 2.4 5.4"}),n.jsx("path",{d:"m15.5 9-2.4 5.4"})]}):e==="summarizer"?n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("path",{d:"M7 6.8h10"}),n.jsx("path",{d:"M7 10.4h8.2"}),n.jsx("path",{d:"M7 14h6.2"}),n.jsx("path",{d:"M7 17.6h4.2"})]}):n.jsxs("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",className:"activity-subagent-avatar-svg",children:[n.jsx("circle",{cx:"12",cy:"8.2",r:"3.2"}),n.jsx("path",{d:"M6.5 19.2c.6-3 2.5-5 5.5-5s4.9 2 5.5 5"}),n.jsx("path",{d:"M5.2 11.8h2"}),n.jsx("path",{d:"M16.8 11.8h2"})]})}function Nn(e){const t=new Map;for(const s of e){const i=s.openSession;i&&t.set(i.sessionId,{...t.get(i.sessionId),...i})}return[...t.values()].reverse()}function Me(e){const t=`${Te(e.roleId)} subagent`,s=e.status?.replace(/_/g," ").trim();return s?`${t} (${s})`:t}function Te(e){return Ie(e).split(/[-_]+/).filter(Boolean).map(s=>s.slice(0,1).toUpperCase()+s.slice(1)).join(" ")||"Subagent"}function Ie(e){const t=e?.trim().toLowerCase()||"subagent";return/^[a-z][a-z0-9_-]*$/.test(t)?t:"subagent"}function kn(e){const t=e?.trim().toLowerCase()||"unknown";return/^[a-z][a-z0-9_-]*$/.test(t)?t:"unknown"}function Rn({activity:e,defaultExpanded:t=!1}){const[s,i]=d.useState(t),a=d.useId(),r=Tn(e);return n.jsxs("section",{className:`harness-refiner-receipt ${e.state} ${e.result??""}`,children:[n.jsxs("button",{"aria-controls":r?a:void 0,"aria-expanded":r?s:void 0,className:"harness-refiner-receipt-summary",disabled:!r,onClick:()=>r&&i(l=>!l),type:"button",children:[n.jsx(ot,{"aria-hidden":!0,className:e.state==="running"?"spinning":void 0,size:12}),n.jsx("span",{children:Ge(e)}),r?n.jsx(_,{"aria-hidden":!0,className:`harness-refiner-receipt-toggle ${s?"expanded":""}`,size:13}):null]}),r&&s?n.jsxs("div",{className:"harness-refiner-receipt-details",id:a,children:[n.jsx(An,{activity:e}),e.reason?n.jsxs("section",{children:[n.jsx("strong",{children:"Reason"}),n.jsx("p",{children:e.reason})]}):null,e.expectedOutcome?n.jsxs("section",{children:[n.jsx("strong",{children:"Expected outcome"}),n.jsx("p",{children:e.expectedOutcome})]}):null,e.evidenceBasis?n.jsxs("section",{children:[n.jsx("strong",{children:"Evidence basis"}),n.jsx("p",{children:e.evidenceBasis.kind.replaceAll("_"," ")}),n.jsxs("small",{children:[e.evidenceBasis.supportingEvidenceIds.length," supporting item",e.evidenceBasis.supportingEvidenceIds.length===1?"":"s",e.evidenceBasis.counterevidence.length?` · ${e.evidenceBasis.counterevidence.length} counterexample${e.evidenceBasis.counterevidence.length===1?"":"s"}`:" · no material counterevidence"]})]}):null,e.validations.length?n.jsxs("section",{children:[n.jsx("strong",{children:"Validation"}),n.jsx("div",{className:"harness-refiner-validation-list",children:e.validations.map(l=>n.jsxs("div",{children:[n.jsx("span",{className:l.status,children:l.status}),n.jsx("p",{children:l.summary})]},l.id))})]}):null,e.edits.length?n.jsxs("details",{className:"harness-refiner-exact-edits",children:[n.jsxs("summary",{children:["Review ",e.edits.length," exact edit",e.edits.length===1?"":"s"]}),e.edits.map(l=>n.jsxs("section",{children:[n.jsxs("strong",{children:[l.operation," · ",l.target]}),n.jsx("p",{children:l.summary}),l.content===null?n.jsx("small",{children:"File deleted."}):n.jsx("pre",{children:l.content})]},l.id))]}):null,n.jsx(Mn,{refs:e.refs})]}):null]})}function An({activity:e}){const t=[e.route?[e.decision==="route"?"Owner":"Layer",e.route]:null,e.operation?["Operation",e.operation]:null,e.target?["Target",e.target]:null,e.critiqueStatus!=="not_applicable"?["Critique",e.critiqueStatus]:null,e.validationStatus!=="not_applicable"?["Validation",e.validationStatus]:null].filter(s=>!!s);return t.length?n.jsx("dl",{className:"harness-refiner-receipt-facts",children:t.map(([s,i])=>n.jsxs("div",{children:[n.jsx("dt",{children:s}),n.jsx("dd",{children:i?.replaceAll("_"," ")})]},s))}):null}function Mn({refs:e}){const t=Object.entries(e).filter(s=>!!s[1]);return t.length?n.jsxs("details",{className:"harness-refiner-references",children:[n.jsx("summary",{children:"Receipt references"}),n.jsx("dl",{children:t.map(([s,i])=>n.jsxs("div",{children:[n.jsx("dt",{children:In(s)}),n.jsx("dd",{children:n.jsx("code",{children:i})})]},s))})]}):null}function Tn(e){return e.state!=="running"&&!!(e.reason||e.expectedOutcome||e.route||e.operation||e.target||e.evidenceBasis||e.validations.length||e.edits.length||Object.values(e.refs).some(Boolean))}function In(e){const t=e.replace(/([a-z])([A-Z])/g,"$1 $2");return`${t[0]?.toUpperCase()??""}${t.slice(1)}`}function En({artifact:e,onOpenFileInSidebar:t}){const[s,i]=d.useState(null),a=d.useCallback(()=>i(null),[]);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"activity-artifact",title:e.path,onContextMenu:r=>{r.preventDefault(),i({path:e.path,title:e.title,..._n(r.clientX,r.clientY)})},children:[t?n.jsxs("button",{"aria-label":`Open ${e.title} in right sidebar`,className:"activity-artifact-name",type:"button",onClick:()=>t(e.path),children:[n.jsx(y,{"aria-hidden":!0,size:14}),n.jsx("strong",{children:e.title})]}):n.jsxs("span",{className:"activity-artifact-name",children:[n.jsx(y,{"aria-hidden":!0,size:14}),n.jsx("strong",{children:e.title})]}),n.jsxs("span",{className:"activity-artifact-actions",children:[n.jsx("button",{"aria-label":`Show ${e.title} in file browser`,"data-tooltip":"Open in file browser",type:"button",onClick:()=>{be(e.path)},children:n.jsx(je,{"aria-hidden":!0,size:14})}),t?n.jsx("button",{"aria-label":`Open ${e.title} in right sidebar`,"data-tooltip":"Open in right sidebar",type:"button",onClick:()=>t(e.path),children:n.jsx(de,{"aria-hidden":!0,size:14})}):null]})]}),n.jsx(zn,{menu:s,onClose:a})]})}function zn({menu:e,onClose:t}){const s=d.useRef(null);return d.useEffect(()=>{if(!e)return;s.current?.focus();const i=()=>t(),a=r=>{r.key==="Escape"&&i()};return window.addEventListener("pointerdown",i),window.addEventListener("blur",i),window.addEventListener("keydown",a),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("pointerdown",i),window.removeEventListener("blur",i),window.removeEventListener("keydown",a),window.removeEventListener("scroll",i,!0)}},[e,t]),!e||typeof document>"u"?null:dt.createPortal(n.jsx("div",{"aria-label":`${e.title} file actions`,className:"activity-artifact-context-menu",role:"menu",style:{left:e.x,top:e.y},onPointerDown:i=>i.stopPropagation(),children:n.jsxs("button",{ref:s,role:"menuitem",type:"button",onClick:()=>{ue(e.path),t()},children:[n.jsx(fe,{"aria-hidden":!0,size:14}),n.jsx("span",{children:"Copy path"})]})}),document.body)}function _n(e,t){return{x:Math.max(8,Math.min(e,window.innerWidth-164-8)),y:Math.max(8,Math.min(t,window.innerHeight-42-8))}}const Ee=5,Ln=280;function Pn({activeWorkspaceAppId:e,connection:t,message:s,onOpenFileInSidebar:i,onOpenSession:a}){const r=s.activities??[],[l,c]=d.useState(!1),[o,u]=d.useState(null),f=d.useId(),m=d.useMemo(()=>gt(r),[r]),h=d.useMemo(()=>vn(r,l),[r,l]),x=r.find(p=>p.imagePreview)?.imagePreview??null,g=s.deliverables??[],S=K(o,t,e),C=s.traceState==="running",j=s.traceState==="failed"||s.traceState==="interrupted",N=wn(s.traceStartedAt,s.traceCompletedAt),P=Vn(m.text,s.traceState,N,r),k=Nn(r);return r.length>0&&r.every(p=>p.subagentMessage)?n.jsxs(n.Fragment,{children:[n.jsx(qn,{activities:r}),n.jsx(le,{activity:s.refinerActivity})]}):n.jsxs(n.Fragment,{children:[r.length>0||g.length>0?n.jsxs("article",{className:`activity-group work-trace ${C?"running":"settled"}`,children:[r.length>0?n.jsxs("div",{className:"activity-summary-row",children:[n.jsx(L,{controls:h.toolCount>0?f:void 0,danger:j,expanded:h.toolsExpanded,icon:x?n.jsx(es,{activeWorkspaceAppId:e,connection:t,image:x}):n.jsx(ts,{kind:m.kind}),onToggle:h.toolCount>0?()=>c(p=>!p):void 0,running:C,children:P}),k.length>0&&a?n.jsx($n,{onOpenSession:a,onShowAll:()=>c(!0),sessions:k}):null]}):null,g.length>0?n.jsx(Bn,{artifacts:g,connection:t,onOpenFileInSidebar:i}):null,h.visibleActivities.length>0?n.jsx("div",{className:"work-trace-flow",id:f,children:h.visibleActivities.map(p=>n.jsx(Fn,{activeWorkspaceAppId:e,activity:p,connection:t,onOpenImage:u,onOpenSession:a},p.id))}):null,n.jsx(pe,{open:!!S,src:S,title:o?.path??"",onClose:()=>u(null)})]}):null,n.jsx(le,{activity:s.refinerActivity})]})}function le({activity:e}){return e?n.jsx("article",{className:"refiner-activity-row",children:n.jsx(Rn,{activity:e})}):null}function Fn({activeWorkspaceAppId:e,activity:t,connection:s,onOpenImage:i,onOpenSession:a}){const[r,l]=d.useState(!1),c=d.useId();return t.subagentMessage?n.jsx(ze,{activity:t}):n.jsxs("div",{className:`activity-tool-row ${t.controlKind==="turn_aborted"?"danger":""}`,children:[n.jsx(L,{className:"activity-tool-summary",controls:c,danger:t.controlKind==="turn_aborted",expanded:r,icon:t.kind==="command"?n.jsx(he,{"aria-hidden":!0,className:"activity-summary-kind-icon",size:12}):void 0,onToggle:()=>l(o=>!o),children:Qn(t)}),r?n.jsx(Un,{activeWorkspaceAppId:e,activity:t,connection:s,detailsId:c,onOpenImage:i,onOpenSession:a}):null]})}function Un({activeWorkspaceAppId:e,activity:t,connection:s,detailsId:i,onOpenImage:a,onOpenSession:r}){const l=K(t.imagePreview??null,s,e);return n.jsxs("div",{className:"activity-tool-details",id:i,children:[t.kind==="command"&&t.content?n.jsx(Yn,{command:t.content,exitCode:t.terminal?.exitCode,output:t.detail,state:t.state}):t.content?is(t.content)?n.jsx("pre",{className:"activity-detail-output",children:t.content}):n.jsx("code",{className:"activity-tool-content",children:t.content}):null,t.detail&&t.kind!=="command"?n.jsx("pre",{className:"activity-detail-output",children:t.detail.replace(/\r\n/g,`
3
3
  `).trimEnd()}):null,t.meta?n.jsx("small",{className:"activity-detail-meta",children:t.meta}):null,t.imagePreview&&l?n.jsx("button",{type:"button",className:"activity-image-preview",title:`Open ${t.imagePreview.path}`,onClick:()=>a(t.imagePreview??null),children:n.jsx("img",{alt:qe(t.imagePreview.path),decoding:"async",loading:"lazy",src:l})}):null,t.openSession&&r?n.jsx(Ae,{className:"activity-subagent-detail-avatar",openSession:t.openSession,onOpenSession:r}):null]})}function Bn({artifacts:e,connection:t,onOpenFileInSidebar:s}){return n.jsx("div",{className:"activity-artifact-list",children:e.map(i=>i.contentType.startsWith("video/")?n.jsx(Wn,{artifact:i,connection:t,onOpenFileInSidebar:s},i.path):i.contentType.startsWith("image/")?n.jsx(On,{artifact:i,connection:t},i.path):n.jsx(En,{artifact:i,onOpenFileInSidebar:s},i.path))})}function On({artifact:e,connection:t}){const[s,i]=d.useState(!1),a=ge(t,e.path);return n.jsxs("div",{className:"activity-artifact-image",title:e.path,children:[n.jsx("button",{type:"button",disabled:!a,onClick:()=>i(!0),title:`Open ${e.title}`,children:a?n.jsx("img",{alt:e.title,decoding:"async",loading:"lazy",src:a}):n.jsx(q,{"aria-hidden":!0,size:20})}),n.jsx("strong",{children:e.title}),n.jsx(pe,{open:s&&!!a,src:a,title:e.title,onClose:()=>i(!1)})]})}function Wn({artifact:e,connection:t,onOpenFileInSidebar:s}){const i=d.useRef(null),[a,r]=d.useState(!1),l=bn(t,e.path),c=()=>{const o=i.current;o&&o.play().then(()=>r(!0)).catch(()=>{})};return n.jsxs("div",{className:"activity-artifact-video",title:e.path,children:[n.jsxs("div",{className:"activity-artifact-video-stage",children:[l?n.jsx("video",{controls:!0,onPlay:()=>r(!0),preload:"metadata",ref:i,src:l}):n.jsx("div",{className:"activity-artifact-video-loading",children:"Preparing video…"}),l&&!a?n.jsx("button",{type:"button",className:"activity-artifact-video-play",onClick:c,"aria-label":`Play ${e.title}`,children:n.jsx(ct,{"aria-hidden":!0,fill:"currentColor",size:22})}):null]}),n.jsxs("div",{className:"activity-artifact-video-footer",children:[n.jsxs("button",{type:"button",className:"activity-artifact-video-file",onClick:()=>{be(e.path)},title:`Show ${e.path} in its folder`,children:[n.jsx(je,{"aria-hidden":!0,size:13}),n.jsxs("span",{children:[n.jsx("strong",{children:e.title}),n.jsx("code",{children:e.path})]}),n.jsx("small",{children:e.sizeBytes==null?e.contentType:Gn(e.sizeBytes)})]}),s?n.jsxs("button",{type:"button",className:"activity-artifact-video-sidebar",onClick:()=>s(e.path),title:"Open video in sidebar",children:[n.jsx(de,{"aria-hidden":!0,size:13}),"Open in sidebar"]}):null]})]})}function Gn(e){return e<1024?`${e} B`:e<1024**2?`${(e/1024).toFixed(1)} KB`:e<1024**3?`${(e/1024**2).toFixed(1)} MB`:`${(e/1024**3).toFixed(1)} GB`}function ze({activity:e}){const[t,s]=d.useState(!1),i=e.subagentMessage;if(!i)return null;const a=`${Te(i.roleId??e.openSession?.roleId)} subagent`,r=i.direction==="received"?`${a} update`:`Message to ${a.toLowerCase()}`,l=i.modelRef?.modelId?`${r} · ${i.modelRef.modelId}`:r,c=Dn(i),o=Kn(i.body);return n.jsx("div",{className:`activity-child-message ${i.direction}`,children:n.jsxs("div",{className:"activity-child-message-card",children:[n.jsxs("div",{className:"activity-child-message-header",children:[n.jsxs("span",{className:"activity-child-message-title",children:[n.jsx(xe,{"aria-hidden":!0,size:14}),n.jsx("strong",{title:l,children:l})]}),n.jsx("small",{children:i.kind.replace(/_/g," ")})]}),n.jsx("p",{className:o&&!t?"collapsed":void 0,style:{"--subagent-message-visible-lines":Ee},children:i.body}),o?n.jsx("button",{type:"button",className:"activity-child-message-toggle","aria-expanded":t,onClick:()=>s(u=>!u),children:t?"Show less":"Show more"}):null,n.jsxs("details",{className:"activity-child-message-details",children:[n.jsx("summary",{children:"Message details"}),n.jsx("div",{className:"activity-child-message-facts","aria-label":"Child message metadata",children:c.map(u=>n.jsxs("span",{children:[n.jsx("small",{children:u.label}),n.jsx("code",{title:u.value,children:u.value})]},u.label))})]}),i.refs?.length?n.jsx("div",{className:"activity-child-message-refs","aria-label":"Child message references",children:i.refs.map(u=>n.jsxs("span",{children:[u.kind,":",u.id," (",u.label,")"]},`${u.kind}:${u.id}`))}):null]})},e.id)}function qn({activities:e}){const t=e[0]?.subagentMessage?.direction??"received";return n.jsx("article",{className:`activity-child-message-group ${t}`,children:e.map(s=>n.jsx(ze,{activity:s},s.id))})}function Dn(e){return[{label:"Message",value:e.messageId},{label:"Kind",value:e.kind},{label:"From",value:e.fromRunId},e.roleId?{label:"Role",value:e.roleId}:null,e.modelRef?{label:"Model",value:`${e.modelRef.providerId}/${e.modelRef.modelId}`}:null,e.childSessionId?{label:"Child",value:e.childSessionId}:null,e.toRunId?{label:"To run",value:e.toRunId}:null,e.toRole?{label:"To role",value:e.toRole}:null,e.deliveryStatus?{label:"Delivery",value:e.deliveryStatus}:null,e.wakeReason?{label:"Wake",value:e.wakeReason}:null,e.createdAt?{label:"Created",value:e.createdAt}:null].filter(t=>!!t)}function Kn(e){return e.length>Ln||e.split(/\r?\n/).length>Ee}function Vn(e,t,s,i){return t==="running"?Hn(i)||e||"Working…":t==="failed"?`${s?`Failed after ${s}`:"Failed"}${e?` · ${e}`:""}`:t==="interrupted"?`${s?`Interrupted after ${s}`:"Interrupted"}${e?` · ${e}`:""}`:t==="completed"?`${s?`Worked for ${s}`:"Worked"}${e?` · ${e}`:""}`:e}function Hn(e){let t=null;for(let s=e.length-1;s>=0;s-=1){const i=e[s];if(i.kind!=="reasoning"&&(t??=i,i.state==="running"||i.state==="pending"))return z(i)}return t?z(t):null}function z(e){return e.kind==="command"?e.state==="failed"?"Command failed":ve(e.content,e.state)??(e.state==="running"||e.state==="pending"?"Running command":"Ran command"):e.label.trim()||null}function Qn(e){if(e.kind!=="command")return e.label;if(e.state==="running"||e.state==="pending")return z(e)??"Running command";const t=Zn(e.terminal?.durationMs);return e.state==="failed"?`Command failed${t?` in ${t}`:""}`:`${z(e)??"Ran command"}${t?` in ${t}`:""}`}function Yn({command:e,exitCode:t,output:s,state:i}){const a=i==="running"||i==="pending"?"Running…":t!=null?`Exit code ${t}`:i==="completed"?"Exit code 0":"Failed";return n.jsxs("section",{"aria-label":"Shell command output",className:`activity-command-terminal ${i??"completed"}`,children:[n.jsx("header",{children:"Shell"}),n.jsx("pre",{children:n.jsxs("code",{className:"shell-command-code",children:[n.jsx("span",{className:"activity-command-prompt","aria-hidden":!0,children:"$ "}),Xn(e),s?n.jsx("span",{className:"activity-command-output",children:`
4
4
  ${s.replace(/\r\n/g,`
5
5
  `).trimEnd()}`}):null]})}),n.jsx("footer",{children:a})]})}function Zn(e){if(e==null||e<0)return null;if(e<6e4)return`${Math.max(1,Math.round(e/1e3))}s`;const t=Math.floor(e/6e4),s=Math.round(e%6e4/1e3);return s>0?`${t}m ${s}s`:`${t}m`}function Xn(e){return Jn(e).map((t,s)=>n.jsx("span",{className:`shell-token ${t.kind}`,children:t.text},`${s}-${t.text}`))}function Jn(e){const t=e.match(/"[^"]*"|'[^']*'|&&|\|\||[|;&()<>]|\s+|[^\s|;&()<>]+/g)??[e];let s=!0;return t.map(i=>/^\s+$/.test(i)?{kind:"plain",text:i}:/^(?:&&|\|\||[|;&()<>])$/.test(i)?(s=i!==")"&&i!==">",{kind:"operator",text:i}):/^(['"]).*\1$/.test(i)?{kind:"string",text:i}:/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(i)?{kind:"variable",text:i}:s?(s=!1,{kind:"command",text:i}):/^-{1,2}[\w-]/.test(i)?{kind:"flag",text:i}:/^(?:\.{0,2}\/|~\/|[\w.-]+\/)/.test(i)?{kind:"path",text:i}:{kind:"plain",text:i})}function es({activeWorkspaceAppId:e,connection:t,image:s}){const i=K(s,t,e);return i?n.jsx("img",{"aria-hidden":!0,className:"activity-summary-image",decoding:"async",loading:"lazy",src:i,alt:""}):null}function ts({kind:e}){const t=ns(e);return n.jsx(t,{"aria-hidden":!0,className:`activity-summary-kind-icon ${e}`,size:14})}function ns(e){return e==="approval"||e==="control"?De:e==="edit"?Ke:e==="image"?q:e==="list"?Ve:e==="read"?y:e==="reasoning"?Ce:e==="search"?He:e==="subagent"?xe:e==="web"?G:he}function K(e,t,s){const i=e&&ss(e.path)?e.path:null,a=e?.appId??s,r=ge(t,i),l=st(t,i?null:a,i?null:e?.path);return i?r:l}function ss(e){return/^file:\/\//i.test(e)||/^\//.test(e)||/^[A-Za-z]:[\\/]/.test(e)}function is(e){return e.includes(`
6
6
  `)||e.length>160}function as({summary:e,onOpenFileInSidebar:t}){const[s,i]=d.useState(null),a=`${e.filesChanged} ${e.filesChanged===1?"file":"files"} changed`,r=e.files.reduce((l,c)=>{const o=_e(c);return{additions:l.additions+o.additions,deletions:l.deletions+o.deletions}},{additions:0,deletions:0});return n.jsxs("div",{className:"change-summary-card",children:[n.jsxs("div",{className:"change-summary-header",children:[n.jsx("span",{children:a}),n.jsxs("span",{className:"change-summary-counts",children:[n.jsxs("span",{className:"diff-addition",children:["+",r.additions]}),n.jsxs("span",{className:"diff-deletion",children:["-",r.deletions]})]})]}),n.jsx("div",{className:"change-summary-files",children:e.files.map(l=>n.jsx(rs,{file:l,onOpenFileInSidebar:t,open:s===l.path,onToggle:()=>i(c=>c===l.path?null:l.path)},l.path))})]})}function rs({file:e,onOpenFileInSidebar:t,open:s,onToggle:i}){const a=_e(e),r=Le(e.patch);return n.jsxs("div",{className:"change-summary-file",children:[n.jsxs("div",{className:"change-summary-file-trigger",children:[n.jsx("button",{type:"button",className:"change-summary-file-toggle",onClick:i,children:n.jsx("span",{children:e.path})}),n.jsxs("span",{className:"change-summary-counts",children:[n.jsxs("span",{className:"diff-addition",children:["+",a.additions]}),n.jsxs("span",{className:"diff-deletion",children:["-",a.deletions]})]}),t&&n.jsx("button",{type:"button",className:"change-summary-open-file",title:"Open in sidebar","aria-label":`Open ${e.path} in sidebar`,onClick:()=>t(e.path),children:n.jsx(B,{size:14})}),n.jsx("button",{type:"button",className:"change-summary-expand-file",title:s?"Hide patch":"Show patch","aria-label":s?`Hide ${e.path} patch`:`Show ${e.path} patch`,onClick:i,children:n.jsx(_,{className:s?"expanded":"",size:14})})]}),s&&r&&n.jsx("div",{className:"change-summary-patch-unavailable",children:"Patch is no longer available for this workspace path."}),s&&e.patch&&!r&&n.jsx("pre",{className:"change-summary-patch",children:n.jsx("code",{children:e.patch})})]})}function _e(e){if((e.status==="added"||e.status==="untracked")&&e.additions===0&&e.content)return{additions:ls(e.content),deletions:0};if(e.additions>0||e.deletions>0||!e.patch||Le(e.patch))return{additions:e.additions,deletions:e.deletions};const t=cs(e.patch);return t.additions>0||t.deletions>0?t:{additions:e.additions,deletions:e.deletions}}function ls(e){const t=e.endsWith(`
7
7
  `)?e.slice(0,-1):e;return t?t.split(`
8
8
  `).length:0}function Le(e){return/^error: Could not access /m.test(e)}function cs(e){let t=0,s=0;for(const i of e.split(`
9
- `))i.startsWith("+++")||i.startsWith("---")||(i.startsWith("+")&&(t+=1),i.startsWith("-")&&(s+=1));return{additions:t,deletions:s}}function os({run:e}){const t=e.plan,s=e.questions.find(c=>c.status==="pending")??null,i=Qe(t?.metadata),r=e.target.kind==="agent"?null:e.sourceRefs[0]??t?.sourcePlan[0]?.path??null,l=e.checkRefs.length||t?.checks.length||0;return n.jsxs("section",{className:"chat-create-receipt","aria-label":"Create or improve status",children:[n.jsxs("div",{className:"chat-create-receipt-heading",children:[n.jsx(y,{size:14}),n.jsx("span",{children:ds(e)}),n.jsx("small",{children:e.target.kind})]}),n.jsx("p",{children:us(e,t?.summary??null,s?.prompt??null)}),i||r||l?n.jsxs("div",{className:"chat-create-receipt-facts",children:[i?n.jsx("span",{title:i.detail,children:i.label}):null,r?n.jsx("span",{title:r,children:r}):null,l?n.jsxs("span",{children:[l," Evals"]}):null]}):null]})}function ds(e){const t=e.target.kind==="agent";return e.state==="awaiting_questions"?"Question ready":e.state==="awaiting_plan_approval"?"Plan ready":e.state==="applying_source"?t?"Saving Agent":"Applying source":e.state==="running_checks"?"Running Evals":e.state==="evaluating"?t?"Checking Agent":"Evaluating candidate":e.state==="awaiting_promotion"?t?"Update ready":"Candidate ready":e.state==="opening_pull_request"?"Opening review":e.state==="pull_request_open"?"Review open":e.state==="reconciling_release"?t?"Applying update":"Merging change":e.state==="released"?t?"Agent updated":"Released":e.state==="rejected"?t?"Current Agent kept":"Rejected":e.state==="ready"||e.state==="ready_local"?t?"Agent ready":"Workproduct ready":e.state==="published_hosted"?"Published":e.state==="cancelled"?"Cancelled":e.state==="blocked"?"Blocked":e.state==="failed"?"Failed":e.operation==="improve"?"Planning improvement":"Planning creation"}function us(e,t,s){return e.state==="awaiting_questions"&&s?s:t||(e.blockedReason?e.blockedReason:e.state==="ready"||e.state==="ready_local"?e.target.kind==="agent"?"The Agent and its actions are ready to use.":"The candidate and its Evals are ready.":e.state==="awaiting_promotion"?e.target.kind==="agent"?"The updated Agent passed its Evals. Apply the update or keep the current version.":"The candidate has been committed and evaluated. Merge or reject it.":e.state==="pull_request_open"&&e.releaseOutcome.pullRequest?e.target.kind==="agent"?"The Agent update review is waiting to finish or close.":"The external review is waiting for merge or closure.":e.state==="released"?e.target.kind==="agent"?"The Agent update is saved and its Evals passed.":"The change merged and the active Profile passed its post-merge Evals.":e.state==="rejected"?e.blockedReason??(e.target.kind==="agent"?"The Agent update was not applied.":"The candidate was rejected."):`Preparing work for ${e.objective}.`)}const qs=d.memo(function({activeWorkspaceAppId:t=null,animateInitialContent:s=!1,accountBaseUrl:i=null,billingOrganizationSlug:a=null,billingTeamId:r=null,connection:l=null,message:c,kvCacheSummary:o=null,onOpenBrowserLink:u,onOpenAttachmentInSidebar:f,onOpenFileInSidebar:m,onOpenProfileSettings:h,onResolveUserQuestion:x,onOpenSession:g,showFooter:$=!1,userAttachmentDisplay:C="full",workspaceRootPath:j=null}){if(c.role==="status_divider")return n.jsx(As,{message:c});if(c.role==="activity_group")return n.jsx(Pn,{activeWorkspaceAppId:t,connection:l,message:c,onOpenFileInSidebar:m,onOpenSession:g});if(c.role==="error")return c.errorKind==="opchat_quota_exceeded"?n.jsx("article",{className:"message-row assistant",children:n.jsx(ys,{accountBaseUrl:i,billingOrganizationSlug:a,billingTeamId:r,onOpenBrowserLink:u})}):n.jsx("article",{className:"message-row assistant",children:n.jsx("div",{className:"assistant-message error-message",children:c.content??""})});if(c.role==="user"){const p=c.attachments??[],V=C==="compact",Fe=p.length>0,Ue=!!(!V&&p.some(Be=>Be.kind==="image"));return n.jsx("article",{className:"message-row user",children:n.jsxs("div",{className:`user-message ${Fe?"has-attachments":""} ${Ue?"has-image-attachments":""}`,children:[p.length?n.jsx($s,{attachments:p,compact:V,connection:l,onOpenAttachment:f}):null,c.content?n.jsx(ps,{content:c.content}):null]})})}const N=Ye(c.timestamp),P=Ze(c.timestamp),k=hs(o?.cacheHitRate??null),A=c.actionRun&&ae(c.actionRun)?mn(c.actionRun):null;return n.jsxs("article",{className:"message-row assistant",children:[c.reasoningContent?n.jsx(ms,{activeWorkspaceAppId:t,animateInitialContent:s,connection:l,reasoningContent:c.reasoningContent,onOpenBrowserLink:u,onOpenFileInSidebar:m,workspaceRootPath:j}):null,c.content?n.jsx("div",{className:"assistant-message",children:n.jsx(Re,{activeWorkspaceAppId:t,animateInitialContent:s,connection:l,content:c.content,onOpenBrowserLink:u,onOpenFileInSidebar:m,workspaceRootPath:j})}):null,c.sources?.length?n.jsx(bs,{sources:c.sources,onOpenBrowserLink:u}):null,c.actionRun&&ae(c.actionRun)?n.jsxs("div",{className:`assistant-message action-run-profile-message ${c.actionRun.status}`,children:[n.jsx(me,{activeWorkspaceAppId:t,connection:l,content:c.actionRun.responseText??fn(c.actionRun),onOpenBrowserLink:u,onOpenFileInSidebar:m,workspaceRootPath:j}),A?n.jsx("div",{className:"action-run-agent-label",children:h?n.jsx("button",{type:"button",className:"action-run-agent-link",onClick:h,children:A}):n.jsx("span",{children:A})}):null]}):c.actionRun?n.jsx(hn,{actionRun:c.actionRun,onOpenBrowserLink:u,onOpenFileInSidebar:m,workspaceRootPath:j}):null,c.changeSummary&&n.jsx(as,{summary:c.changeSummary,onOpenFileInSidebar:m}),c.createImproveRun?n.jsx(os,{run:c.createImproveRun}):null,c.userQuestion?n.jsx(js,{question:c.userQuestion,onResolve:x}):null,$||o?n.jsxs("div",{className:"assistant-message-footer",children:[N&&n.jsx("time",{className:"message-timestamp",dateTime:c.timestamp,title:P,children:N}),o?n.jsxs(n.Fragment,{children:[N?n.jsx("span",{className:"message-footer-separator","aria-hidden":"true"}):null,n.jsxs("span",{className:"message-kv-cache-metric","aria-label":`KV cache reuse ${k}`,children:["KV ",k]})]}):null,n.jsx("button",{type:"button",className:"message-copy-button",title:"Copy message","aria-label":"Copy assistant message",disabled:!c.content,onClick:()=>{c.content&&ue(c.content)},children:n.jsx(fe,{size:14})})]}):null]})},gs);function hs(e){return e===null?"—":`${Math.round(e*100)}%`}const ms=d.memo(function({activeWorkspaceAppId:t,animateInitialContent:s,connection:i,reasoningContent:a,onOpenBrowserLink:r,onOpenFileInSidebar:l,workspaceRootPath:c}){const[o,u]=d.useState(!1);return n.jsxs("div",{className:"activity-group assistant-reasoning",children:[n.jsx(L,{expanded:o,icon:n.jsx(Ce,{"aria-hidden":!0,className:"activity-summary-kind-icon",size:13}),onToggle:()=>u(f=>!f),children:"Thinking"}),o?n.jsx("div",{className:"assistant-reasoning-content",children:n.jsx(Re,{activeWorkspaceAppId:t,animateInitialContent:s,connection:i,content:a,onOpenBrowserLink:r,onOpenFileInSidebar:l,workspaceRootPath:c})}):null]})},fs);function fs(e,t){return e.activeWorkspaceAppId===t.activeWorkspaceAppId&&e.animateInitialContent===t.animateInitialContent&&e.connection===t.connection&&e.reasoningContent===t.reasoningContent&&e.onOpenBrowserLink===t.onOpenBrowserLink&&e.onOpenFileInSidebar===t.onOpenFileInSidebar&&e.workspaceRootPath===t.workspaceRootPath}const ce=5;function ps({content:e}){const t=d.useMemo(()=>e.split(/\r?\n/),[e]),[s,i]=d.useState(!1),a=t.length>ce,r=a&&!s?t.slice(0,ce).join(`
10
- `):e;return n.jsxs("div",{className:`user-message-content-wrap ${a?"collapsible":""}`,children:[n.jsx("div",{className:"user-message-content",children:r}),a?n.jsxs("button",{type:"button",className:"user-message-show-more","aria-expanded":s,onClick:()=>i(l=>!l),children:[s?n.jsx(tt,{size:14}):n.jsx(_,{size:14}),n.jsx("span",{children:s?"Show less":"Show more"})]}):null]})}function gs(e,t){return e.activeWorkspaceAppId===t.activeWorkspaceAppId&&e.animateInitialContent===t.animateInitialContent&&e.accountBaseUrl===t.accountBaseUrl&&e.billingOrganizationSlug===t.billingOrganizationSlug&&e.billingTeamId===t.billingTeamId&&e.connection===t.connection&&e.kvCacheSummary===t.kvCacheSummary&&e.onOpenBrowserLink===t.onOpenBrowserLink&&e.onOpenAttachmentInSidebar===t.onOpenAttachmentInSidebar&&e.onOpenFileInSidebar===t.onOpenFileInSidebar&&e.onOpenProfileSettings===t.onOpenProfileSettings&&e.onResolveUserQuestion===t.onResolveUserQuestion&&e.onOpenSession===t.onOpenSession&&e.showFooter===t.showFooter&&e.userAttachmentDisplay===t.userAttachmentDisplay&&e.workspaceRootPath===t.workspaceRootPath&&xs(e.message,t.message)}function xs(e,t){return e===t?!0:e.id===t.id&&e.role===t.role&&e.content===t.content&&e.timestamp===t.timestamp&&e.turnId===t.turnId&&e.statusKind===t.statusKind&&e.statusState===t.statusState&&e.statusTone===t.statusTone&&e.errorKind===t.errorKind&&Ss(e.attachments,t.attachments)&&e.activities===t.activities&&e.sources===t.sources&&e.actionRun===t.actionRun&&e.changeSummary===t.changeSummary&&e.createImproveRun===t.createImproveRun&&e.userQuestion===t.userQuestion&&e.reasoningContent===t.reasoningContent}function js({question:e,onResolve:t}){const[s,i]=d.useState(""),[a,r]=d.useState(!1),l=async c=>{if(!(!t||a||e.status!=="pending")){r(!0);try{await t(e,c)}finally{r(!1)}}};return n.jsxs("section",{className:`user-question-card ${e.status}`,"aria-label":"Question from OpenPond",children:[n.jsxs("header",{className:"user-question-header",children:[n.jsx("span",{className:"user-question-icon","aria-hidden":!0,children:n.jsx(Je,{size:17})}),n.jsxs("span",{className:"user-question-heading",children:[n.jsx("span",{className:"user-question-eyebrow",children:"Question"}),n.jsx("strong",{children:e.question})]})]}),e.reason?n.jsx("p",{className:"user-question-reason",children:e.reason}):null,e.status==="pending"?n.jsxs(n.Fragment,{children:[e.options.length>0?n.jsx("div",{className:"user-question-options",children:e.options.map((c,o)=>n.jsxs("button",{disabled:a||!t,type:"button",onClick:()=>{l({questionId:e.id,action:"answer",optionId:c.id,text:c.label})},children:[n.jsx("span",{className:"user-question-option-index","aria-hidden":!0,children:o+1}),n.jsxs("span",{className:"user-question-option-copy",children:[n.jsx("span",{children:c.label}),c.description?n.jsx("small",{children:c.description}):null]})]},c.id))}):null,e.allowFreeform?n.jsxs("form",{className:"user-question-freeform",onSubmit:c=>{c.preventDefault();const o=s.trim();o&&l({questionId:e.id,action:"answer",optionId:null,text:o})},children:[n.jsx("label",{htmlFor:`question-answer-${e.id}`,children:"Or write your own answer"}),n.jsxs("span",{className:"user-question-freeform-controls",children:[n.jsx("input",{"aria-label":"Answer",disabled:a||!t,id:`question-answer-${e.id}`,onChange:c=>i(c.target.value),placeholder:"Type an answer",value:s}),n.jsx("button",{disabled:a||!t||!s.trim(),type:"submit",children:a?"Sending…":"Answer"})]})]}):null,n.jsx("button",{className:"user-question-dismiss",disabled:a||!t,type:"button",onClick:()=>{l({questionId:e.id,action:"dismiss",optionId:null,text:""})},children:"Skip for now"})]}):n.jsxs("span",{className:"user-question-resolution",children:[n.jsx(oe,{"aria-hidden":!0,size:15}),n.jsx("small",{children:e.status==="answered"?`Answered${e.answer?.text?`: ${e.answer.text}`:""}`:"Skipped"})]})]})}function bs({sources:e,onOpenBrowserLink:t}){return n.jsxs("div",{className:"assistant-sources","aria-label":"Sources",children:[n.jsxs("span",{className:"assistant-sources-label",children:[n.jsx(G,{size:13}),n.jsx("span",{children:"Sources"})]}),n.jsx("div",{className:"assistant-source-stack",children:e.map(s=>n.jsx(Cs,{source:s,onOpenBrowserLink:t},`${s.id}:${s.url}`))})]})}function Cs({source:e,onOpenBrowserLink:t}){const s=ws(e),i=[e.title,Pe(e.url)].filter(Boolean).join(" - "),a=n.jsxs(n.Fragment,{children:[n.jsx(vs,{source:e}),n.jsx("span",{children:s})]});return t?n.jsx("button",{type:"button",className:"assistant-source-pill",title:i||s,"aria-label":`Open source ${s}`,onClick:()=>t(e.url,{newTab:!0}),children:a}):n.jsx("a",{className:"assistant-source-pill",href:e.url,target:"_blank",rel:"noreferrer",title:i||s,"aria-label":`Open source ${s}`,children:a})}function vs({source:e}){const[t,s]=d.useState(!1);return!e.faviconUrl||t?n.jsx(G,{className:"assistant-source-fallback-icon",size:13}):n.jsx("img",{alt:"","aria-hidden":"true",className:"assistant-source-favicon",decoding:"async",loading:"lazy",src:e.faviconUrl,onError:()=>s(!0)})}function ws(e){return e.sourceName?.trim()||Pe(e.url)||e.title}function Pe(e){try{return new URL(e).hostname.replace(/^www\./i,"")}catch{return null}}function ys({accountBaseUrl:e,billingOrganizationSlug:t,billingTeamId:s,onOpenBrowserLink:i}){const a=Xe({accountBaseUrl:e,organizationSlug:t,teamId:s}),r=n.jsxs(n.Fragment,{children:[n.jsx(H,{size:15}),n.jsx("span",{children:"Add credits"}),n.jsx(et,{size:13})]});return n.jsxs("div",{className:"assistant-message quota-error-card",role:"alert",children:[n.jsx("div",{className:"quota-error-card-icon",children:n.jsx(H,{size:17})}),n.jsxs("div",{className:"quota-error-card-body",children:[n.jsx("strong",{children:"OpenPond Chat allowance reached"}),n.jsx("p",{children:"You have reached your OpChat token allowance for this period. Add credits or wait for the allowance to reset."}),i?n.jsx("button",{type:"button",className:"quota-error-card-action",onClick:()=>i(a,{newTab:!0}),children:r}):n.jsx("a",{className:"quota-error-card-action",href:a,target:"_blank",rel:"noreferrer",children:r})]})]})}function Ss(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const i=e[s],a=t[s];if(i.id!==a.id||i.kind!==a.kind||i.name!==a.name||i.mediaType!==a.mediaType||i.sizeBytes!==a.sizeBytes||i.lineCount!==a.lineCount||i.imagePreview?.sessionId!==a.imagePreview?.sessionId||i.imagePreview?.turnId!==a.imagePreview?.turnId||i.imagePreview?.attachmentId!==a.imagePreview?.attachmentId||i.imagePreview?.storageName!==a.imagePreview?.storageName||i.imagePreview?.contentType!==a.imagePreview?.contentType||i.filePreview?.sessionId!==a.filePreview?.sessionId||i.filePreview?.turnId!==a.filePreview?.turnId||i.filePreview?.attachmentId!==a.filePreview?.attachmentId||i.filePreview?.storageName!==a.filePreview?.storageName||i.filePreview?.contentType!==a.filePreview?.contentType)return!1}return!0}function $s({attachments:e,compact:t,connection:s,onOpenAttachment:i}){return n.jsx("div",{className:`user-message-attachments${t?" compact":""}`,"aria-label":"Attached files",children:e.map(a=>n.jsx(Ns,{attachment:a,compact:t,connection:s,onOpenAttachment:i},a.id))})}function Ns({attachment:e,compact:t,connection:s,onOpenAttachment:i}){return!t&&e.kind==="image"&&e.imagePreview?n.jsx(Rs,{attachment:e,connection:s}):n.jsx(ks,{attachment:e,onOpenAttachment:i})}function ks({attachment:e,onOpenAttachment:t}){const[s,i]=d.useState(!1),a=!!((e.filePreview||e.imagePreview)&&t),r=s?"Opening":e.lineCount!==void 0?it(e.lineCount):null,l=n.jsxs(n.Fragment,{children:[n.jsx(at,{attachment:e,size:13}),n.jsx("span",{children:e.name}),r?n.jsx("small",{children:r}):null]});return a?n.jsx("button",{"aria-label":`Open attached file ${e.name}`,className:"user-message-attachment openable",disabled:s,title:`Open ${e.name}`,type:"button",onClick:()=>{!t||s||(i(!0),t(e).finally(()=>i(!1)))},children:l}):n.jsx("span",{className:"user-message-attachment",title:e.name,children:l})}function Rs({attachment:e,connection:t}){const s=Yt(t,e.imagePreview);return n.jsxs("figure",{className:`user-message-image-attachment ${s?"ready":"loading"}`,title:e.name,children:[n.jsx("div",{className:"user-message-image-frame",children:s?n.jsx("img",{alt:e.name,decoding:"async",loading:"lazy",src:s}):n.jsx(q,{size:24})}),n.jsx("figcaption",{children:n.jsx("span",{children:e.name})})]})}const Ds=d.memo(function(){return n.jsx("article",{className:"activity-group thinking-row","aria-live":"polite",children:n.jsx(L,{running:!0,children:"Thinking…"})})});function As({message:e}){const t=e.statusTone??"info",s=e.statusState??"idle";return n.jsx("article",{className:`status-divider ${t} ${s}`,"aria-live":t==="danger"?"assertive":"polite",children:n.jsx("span",{children:e.content??""})})}export{qs as M,Ds as T,Gs as a,Ws as u};
9
+ `))i.startsWith("+++")||i.startsWith("---")||(i.startsWith("+")&&(t+=1),i.startsWith("-")&&(s+=1));return{additions:t,deletions:s}}function os({run:e}){const t=e.plan,s=e.questions.find(c=>c.status==="pending")??null,i=Qe(t?.metadata),r=e.target.kind==="agent"?null:e.sourceRefs[0]??t?.sourcePlan[0]?.path??null,l=e.checkRefs.length||t?.checks.length||0;return n.jsxs("section",{className:"chat-create-receipt","aria-label":"Create or improve status",children:[n.jsxs("div",{className:"chat-create-receipt-heading",children:[n.jsx(y,{size:14}),n.jsx("span",{children:ds(e)}),n.jsx("small",{children:e.target.kind})]}),n.jsx("p",{children:us(e,t?.summary??null,s?.prompt??null)}),i||r||l?n.jsxs("div",{className:"chat-create-receipt-facts",children:[i?n.jsx("span",{title:i.detail,children:i.label}):null,r?n.jsx("span",{title:r,children:r}):null,l?n.jsxs("span",{children:[l," Evals"]}):null]}):null]})}function ds(e){const t=e.target.kind==="agent";return e.state==="awaiting_questions"?"Question ready":e.state==="awaiting_plan_approval"?"Plan ready":e.state==="applying_source"?t?"Saving Agent":"Applying source":e.state==="running_checks"?"Running Evals":e.state==="evaluating"?t?"Checking Agent":"Evaluating candidate":e.state==="awaiting_promotion"?t?"Update ready":"Candidate ready":e.state==="opening_pull_request"?"Opening review":e.state==="pull_request_open"?"Review open":e.state==="reconciling_release"?t?"Applying update":"Merging change":e.state==="released"?t?"Agent updated":"Released":e.state==="rejected"?t?"Current Agent kept":"Rejected":e.state==="ready"||e.state==="ready_local"?t?"Agent ready":"Workproduct ready":e.state==="published_hosted"?"Published":e.state==="cancelled"?"Cancelled":e.state==="blocked"?"Blocked":e.state==="failed"?"Failed":e.operation==="improve"?"Planning improvement":"Planning creation"}function us(e,t,s){return e.state==="awaiting_questions"&&s?s:t||(e.blockedReason?e.blockedReason:e.state==="ready"||e.state==="ready_local"?e.target.kind==="agent"?"The Agent and its actions are ready to use.":"The candidate and its Evals are ready.":e.state==="awaiting_promotion"?e.target.kind==="agent"?"The updated Agent passed its Evals. Apply the update or keep the current version.":"The candidate has been committed and evaluated. Merge or reject it.":e.state==="pull_request_open"&&e.releaseOutcome.pullRequest?e.target.kind==="agent"?"The Agent update review is waiting to finish or close.":"The external review is waiting for merge or closure.":e.state==="released"?e.target.kind==="agent"?"The Agent update is saved and its Evals passed.":"The change merged and the active Profile passed its post-merge Evals.":e.state==="rejected"?e.blockedReason??(e.target.kind==="agent"?"The Agent update was not applied.":"The candidate was rejected."):`Preparing work for ${e.objective}.`)}const qs=d.memo(function({activeWorkspaceAppId:t=null,animateInitialContent:s=!1,accountBaseUrl:i=null,billingOrganizationSlug:a=null,billingTeamId:r=null,connection:l=null,message:c,kvCacheSummary:o=null,onOpenBrowserLink:u,onOpenAttachmentInSidebar:f,onOpenFileInSidebar:m,onOpenProfileSettings:h,onResolveUserQuestion:x,onOpenSession:g,showFooter:S=!1,userAttachmentDisplay:C="full",workspaceRootPath:j=null}){if(c.role==="status_divider")return n.jsx(As,{message:c});if(c.role==="activity_group")return n.jsx(Pn,{activeWorkspaceAppId:t,connection:l,message:c,onOpenFileInSidebar:m,onOpenSession:g});if(c.role==="error")return c.errorKind==="opchat_quota_exceeded"?n.jsx("article",{className:"message-row assistant",children:n.jsx(ys,{accountBaseUrl:i,billingOrganizationSlug:a,billingTeamId:r,onOpenBrowserLink:u})}):n.jsx("article",{className:"message-row assistant",children:n.jsx("div",{className:"assistant-message error-message",children:c.content??""})});if(c.role==="user"){const p=c.attachments??[],V=C==="compact",Fe=p.length>0,Ue=!!(!V&&p.some(Be=>Be.kind==="image"));return n.jsx("article",{className:"message-row user",children:n.jsxs("div",{className:`user-message ${Fe?"has-attachments":""} ${Ue?"has-image-attachments":""}`,children:[p.length?n.jsx(Ss,{attachments:p,compact:V,connection:l,onOpenAttachment:f}):null,c.content?n.jsx(ps,{content:c.content}):null]})})}const N=Ye(c.timestamp),P=Ze(c.timestamp),k=hs(o?.cacheHitRate??null),A=c.actionRun&&ae(c.actionRun)?mn(c.actionRun):null;return n.jsxs("article",{className:"message-row assistant",children:[c.reasoningContent?n.jsx(ms,{activeWorkspaceAppId:t,animateInitialContent:s,connection:l,reasoningContent:c.reasoningContent,onOpenBrowserLink:u,onOpenFileInSidebar:m,workspaceRootPath:j}):null,c.content?n.jsx("div",{className:"assistant-message",children:n.jsx(Re,{activeWorkspaceAppId:t,animateInitialContent:s,connection:l,content:c.content,onOpenBrowserLink:u,onOpenFileInSidebar:m,workspaceRootPath:j})}):null,c.sources?.length?n.jsx(bs,{sources:c.sources,onOpenBrowserLink:u}):null,c.actionRun&&ae(c.actionRun)?n.jsxs("div",{className:`assistant-message action-run-profile-message ${c.actionRun.status}`,children:[n.jsx(me,{activeWorkspaceAppId:t,connection:l,content:c.actionRun.responseText??fn(c.actionRun),onOpenBrowserLink:u,onOpenFileInSidebar:m,workspaceRootPath:j}),A?n.jsx("div",{className:"action-run-agent-label",children:h?n.jsx("button",{type:"button",className:"action-run-agent-link",onClick:h,children:A}):n.jsx("span",{children:A})}):null]}):c.actionRun?n.jsx(hn,{actionRun:c.actionRun,onOpenBrowserLink:u,onOpenFileInSidebar:m,workspaceRootPath:j}):null,c.changeSummary&&n.jsx(as,{summary:c.changeSummary,onOpenFileInSidebar:m}),c.createImproveRun?n.jsx(os,{run:c.createImproveRun}):null,c.userQuestion?n.jsx(js,{question:c.userQuestion,onResolve:x}):null,S||o?n.jsxs("div",{className:"assistant-message-footer",children:[N&&n.jsx("time",{className:"message-timestamp",dateTime:c.timestamp,title:P,children:N}),o?n.jsxs(n.Fragment,{children:[N?n.jsx("span",{className:"message-footer-separator","aria-hidden":"true"}):null,n.jsxs("span",{className:"message-kv-cache-metric","aria-label":`KV cache reuse ${k}`,children:["KV ",k]})]}):null,n.jsx("button",{type:"button",className:"message-copy-button",title:"Copy message","aria-label":"Copy assistant message",disabled:!c.content,onClick:()=>{c.content&&ue(c.content)},children:n.jsx(fe,{size:14})})]}):null]})},gs);function hs(e){return e===null?"—":`${Math.round(e*100)}%`}const ms=d.memo(function({activeWorkspaceAppId:t,animateInitialContent:s,connection:i,reasoningContent:a,onOpenBrowserLink:r,onOpenFileInSidebar:l,workspaceRootPath:c}){const[o,u]=d.useState(!1);return n.jsxs("div",{className:"activity-group assistant-reasoning",children:[n.jsx(L,{expanded:o,icon:n.jsx(Ce,{"aria-hidden":!0,className:"activity-summary-kind-icon",size:13}),onToggle:()=>u(f=>!f),children:"Thinking"}),o?n.jsx("div",{className:"assistant-reasoning-content",children:n.jsx(Re,{activeWorkspaceAppId:t,animateInitialContent:s,connection:i,content:a,onOpenBrowserLink:r,onOpenFileInSidebar:l,workspaceRootPath:c})}):null]})},fs);function fs(e,t){return e.activeWorkspaceAppId===t.activeWorkspaceAppId&&e.animateInitialContent===t.animateInitialContent&&e.connection===t.connection&&e.reasoningContent===t.reasoningContent&&e.onOpenBrowserLink===t.onOpenBrowserLink&&e.onOpenFileInSidebar===t.onOpenFileInSidebar&&e.workspaceRootPath===t.workspaceRootPath}const ce=5;function ps({content:e}){const t=d.useMemo(()=>e.split(/\r?\n/),[e]),[s,i]=d.useState(!1),a=t.length>ce,r=a&&!s?t.slice(0,ce).join(`
10
+ `):e;return n.jsxs("div",{className:`user-message-content-wrap ${a?"collapsible":""}`,children:[n.jsx("div",{className:"user-message-content",children:r}),a?n.jsxs("button",{type:"button",className:"user-message-show-more","aria-expanded":s,onClick:()=>i(l=>!l),children:[s?n.jsx(tt,{size:14}):n.jsx(_,{size:14}),n.jsx("span",{children:s?"Show less":"Show more"})]}):null]})}function gs(e,t){return e.activeWorkspaceAppId===t.activeWorkspaceAppId&&e.animateInitialContent===t.animateInitialContent&&e.accountBaseUrl===t.accountBaseUrl&&e.billingOrganizationSlug===t.billingOrganizationSlug&&e.billingTeamId===t.billingTeamId&&e.connection===t.connection&&e.kvCacheSummary===t.kvCacheSummary&&e.onOpenBrowserLink===t.onOpenBrowserLink&&e.onOpenAttachmentInSidebar===t.onOpenAttachmentInSidebar&&e.onOpenFileInSidebar===t.onOpenFileInSidebar&&e.onOpenProfileSettings===t.onOpenProfileSettings&&e.onResolveUserQuestion===t.onResolveUserQuestion&&e.onOpenSession===t.onOpenSession&&e.showFooter===t.showFooter&&e.userAttachmentDisplay===t.userAttachmentDisplay&&e.workspaceRootPath===t.workspaceRootPath&&xs(e.message,t.message)}function xs(e,t){return e===t?!0:e.id===t.id&&e.role===t.role&&e.content===t.content&&e.timestamp===t.timestamp&&e.turnId===t.turnId&&e.statusKind===t.statusKind&&e.statusState===t.statusState&&e.statusTone===t.statusTone&&e.errorKind===t.errorKind&&$s(e.attachments,t.attachments)&&e.activities===t.activities&&e.sources===t.sources&&e.actionRun===t.actionRun&&e.changeSummary===t.changeSummary&&e.createImproveRun===t.createImproveRun&&e.userQuestion===t.userQuestion&&e.reasoningContent===t.reasoningContent}function js({question:e,onResolve:t}){const[s,i]=d.useState(""),[a,r]=d.useState(!1),l=async c=>{if(!(!t||a||e.status!=="pending")){r(!0);try{await t(e,c)}finally{r(!1)}}};return n.jsxs("section",{className:`user-question-card ${e.status}`,"aria-label":"Question from OpenPond",children:[n.jsxs("header",{className:"user-question-header",children:[n.jsx("span",{className:"user-question-icon","aria-hidden":!0,children:n.jsx(Je,{size:17})}),n.jsxs("span",{className:"user-question-heading",children:[n.jsx("span",{className:"user-question-eyebrow",children:"Question"}),n.jsx("strong",{children:e.question})]})]}),e.reason?n.jsx("p",{className:"user-question-reason",children:e.reason}):null,e.status==="pending"?n.jsxs(n.Fragment,{children:[e.options.length>0?n.jsx("div",{className:"user-question-options",children:e.options.map((c,o)=>n.jsxs("button",{disabled:a||!t,type:"button",onClick:()=>{l({questionId:e.id,action:"answer",optionId:c.id,text:c.label})},children:[n.jsx("span",{className:"user-question-option-index","aria-hidden":!0,children:o+1}),n.jsxs("span",{className:"user-question-option-copy",children:[n.jsx("span",{children:c.label}),c.description?n.jsx("small",{children:c.description}):null]})]},c.id))}):null,e.allowFreeform?n.jsxs("form",{className:"user-question-freeform",onSubmit:c=>{c.preventDefault();const o=s.trim();o&&l({questionId:e.id,action:"answer",optionId:null,text:o})},children:[n.jsx("label",{htmlFor:`question-answer-${e.id}`,children:"Or write your own answer"}),n.jsxs("span",{className:"user-question-freeform-controls",children:[n.jsx("input",{"aria-label":"Answer",disabled:a||!t,id:`question-answer-${e.id}`,onChange:c=>i(c.target.value),placeholder:"Type an answer",value:s}),n.jsx("button",{disabled:a||!t||!s.trim(),type:"submit",children:a?"Sending…":"Answer"})]})]}):null,n.jsx("button",{className:"user-question-dismiss",disabled:a||!t,type:"button",onClick:()=>{l({questionId:e.id,action:"dismiss",optionId:null,text:""})},children:"Skip for now"})]}):n.jsxs("span",{className:"user-question-resolution",children:[n.jsx(oe,{"aria-hidden":!0,size:15}),n.jsx("small",{children:e.status==="answered"?`Answered${e.answer?.text?`: ${e.answer.text}`:""}`:"Skipped"})]})]})}function bs({sources:e,onOpenBrowserLink:t}){return n.jsxs("div",{className:"assistant-sources","aria-label":"Sources",children:[n.jsxs("span",{className:"assistant-sources-label",children:[n.jsx(G,{size:13}),n.jsx("span",{children:"Sources"})]}),n.jsx("div",{className:"assistant-source-stack",children:e.map(s=>n.jsx(Cs,{source:s,onOpenBrowserLink:t},`${s.id}:${s.url}`))})]})}function Cs({source:e,onOpenBrowserLink:t}){const s=ws(e),i=[e.title,Pe(e.url)].filter(Boolean).join(" - "),a=n.jsxs(n.Fragment,{children:[n.jsx(vs,{source:e}),n.jsx("span",{children:s})]});return t?n.jsx("button",{type:"button",className:"assistant-source-pill",title:i||s,"aria-label":`Open source ${s}`,onClick:()=>t(e.url,{newTab:!0}),children:a}):n.jsx("a",{className:"assistant-source-pill",href:e.url,target:"_blank",rel:"noreferrer",title:i||s,"aria-label":`Open source ${s}`,children:a})}function vs({source:e}){const[t,s]=d.useState(!1);return!e.faviconUrl||t?n.jsx(G,{className:"assistant-source-fallback-icon",size:13}):n.jsx("img",{alt:"","aria-hidden":"true",className:"assistant-source-favicon",decoding:"async",loading:"lazy",src:e.faviconUrl,onError:()=>s(!0)})}function ws(e){return e.sourceName?.trim()||Pe(e.url)||e.title}function Pe(e){try{return new URL(e).hostname.replace(/^www\./i,"")}catch{return null}}function ys({accountBaseUrl:e,billingOrganizationSlug:t,billingTeamId:s,onOpenBrowserLink:i}){const a=Xe({accountBaseUrl:e,organizationSlug:t,teamId:s}),r=n.jsxs(n.Fragment,{children:[n.jsx(H,{size:15}),n.jsx("span",{children:"Add credits"}),n.jsx(et,{size:13})]});return n.jsxs("div",{className:"assistant-message quota-error-card",role:"alert",children:[n.jsx("div",{className:"quota-error-card-icon",children:n.jsx(H,{size:17})}),n.jsxs("div",{className:"quota-error-card-body",children:[n.jsx("strong",{children:"OpenPond Chat allowance reached"}),n.jsx("p",{children:"You have reached your OpChat token allowance for this period. Add credits or wait for the allowance to reset."}),i?n.jsx("button",{type:"button",className:"quota-error-card-action",onClick:()=>i(a,{newTab:!0}),children:r}):n.jsx("a",{className:"quota-error-card-action",href:a,target:"_blank",rel:"noreferrer",children:r})]})]})}function $s(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const i=e[s],a=t[s];if(i.id!==a.id||i.kind!==a.kind||i.name!==a.name||i.mediaType!==a.mediaType||i.sizeBytes!==a.sizeBytes||i.lineCount!==a.lineCount||i.imagePreview?.sessionId!==a.imagePreview?.sessionId||i.imagePreview?.turnId!==a.imagePreview?.turnId||i.imagePreview?.attachmentId!==a.imagePreview?.attachmentId||i.imagePreview?.storageName!==a.imagePreview?.storageName||i.imagePreview?.contentType!==a.imagePreview?.contentType||i.filePreview?.sessionId!==a.filePreview?.sessionId||i.filePreview?.turnId!==a.filePreview?.turnId||i.filePreview?.attachmentId!==a.filePreview?.attachmentId||i.filePreview?.storageName!==a.filePreview?.storageName||i.filePreview?.contentType!==a.filePreview?.contentType)return!1}return!0}function Ss({attachments:e,compact:t,connection:s,onOpenAttachment:i}){return n.jsx("div",{className:`user-message-attachments${t?" compact":""}`,"aria-label":"Attached files",children:e.map(a=>n.jsx(Ns,{attachment:a,compact:t,connection:s,onOpenAttachment:i},a.id))})}function Ns({attachment:e,compact:t,connection:s,onOpenAttachment:i}){return!t&&e.kind==="image"&&e.imagePreview?n.jsx(Rs,{attachment:e,connection:s}):n.jsx(ks,{attachment:e,onOpenAttachment:i})}function ks({attachment:e,onOpenAttachment:t}){const[s,i]=d.useState(!1),a=!!((e.filePreview||e.imagePreview)&&t),r=s?"Opening":e.lineCount!==void 0?it(e.lineCount):null,l=n.jsxs(n.Fragment,{children:[n.jsx(at,{attachment:e,size:13}),n.jsx("span",{children:e.name}),r?n.jsx("small",{children:r}):null]});return a?n.jsx("button",{"aria-label":`Open attached file ${e.name}`,className:"user-message-attachment openable",disabled:s,title:`Open ${e.name}`,type:"button",onClick:()=>{!t||s||(i(!0),t(e).finally(()=>i(!1)))},children:l}):n.jsx("span",{className:"user-message-attachment",title:e.name,children:l})}function Rs({attachment:e,connection:t}){const s=Yt(t,e.imagePreview);return n.jsxs("figure",{className:`user-message-image-attachment ${s?"ready":"loading"}`,title:e.name,children:[n.jsx("div",{className:"user-message-image-frame",children:s?n.jsx("img",{alt:e.name,decoding:"async",loading:"lazy",src:s}):n.jsx(q,{size:24})}),n.jsx("figcaption",{children:n.jsx("span",{children:e.name})})]})}const Ds=d.memo(function(){return n.jsx("article",{className:"activity-group thinking-row","aria-live":"polite",children:n.jsx(L,{running:!0,children:"Thinking…"})})});function As({message:e}){const t=e.statusTone??"info",s=e.statusState??"idle";return n.jsx("article",{className:`status-divider ${t} ${s}`,"aria-live":t==="danger"?"assertive":"polite",children:n.jsx("span",{children:e.content??""})})}export{qs as M,Ds as T,Gs as a,Ws as u};
@@ -1 +1 @@
1
- import{j as e}from"./index-D-VK8mST.js";import{i as o,b8 as c,X as n}from"./App-DfiCmBv6.js";import{M as d}from"./minimize-2-DnxKN5oK.js";function x({expanded:s,skill:a,onClose:i,onResizeStart:r,onToggleExpanded:l}){const t=a.path.split("/").at(-1)??a.path;return e.jsxs("aside",{className:`workspace-diff-panel native-skill-sidebar ${s?"expanded":""}`,"aria-label":`Skill source: ${a.name}`,children:[s?null:e.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize native skill source",onPointerDown:r}),e.jsxs("div",{className:"workspace-diff-topbar native-skill-sidebar-topbar",children:[e.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Native skill files",children:e.jsxs("button",{className:"workspace-diff-tab active",type:"button",role:"tab","aria-selected":!0,children:[e.jsx(o,{size:14}),e.jsx("span",{children:t})]})}),e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsx("button",{className:"diff-icon-button",type:"button",title:s?"Dock sidebar":"Expand sidebar","aria-label":s?"Dock sidebar":"Expand sidebar",onClick:l,children:s?e.jsx(d,{size:14}):e.jsx(c,{size:14})}),e.jsx("button",{className:"diff-icon-button",type:"button",title:"Close skill source","aria-label":"Close skill source",onClick:i,children:e.jsx(n,{size:14})})]})]}),e.jsxs("div",{className:"native-skill-sidebar-body",children:[e.jsxs("header",{className:"native-skill-source-header",children:[e.jsx("h2",{children:a.name}),e.jsx("p",{children:a.description}),e.jsx("code",{children:a.path})]}),e.jsx("pre",{className:"native-skill-markdown-source","aria-label":`${a.name} Markdown source`,children:e.jsx("code",{children:a.body})})]})]})}export{x as NativeSkillSidebar};
1
+ import{j as e}from"./index-Dvq7bpBG.js";import{i as o,b8 as c,X as n}from"./App-BOkhmdHu.js";import{M as d}from"./minimize-2-DeYg7XqB.js";function x({expanded:s,skill:a,onClose:i,onResizeStart:r,onToggleExpanded:l}){const t=a.path.split("/").at(-1)??a.path;return e.jsxs("aside",{className:`workspace-diff-panel native-skill-sidebar ${s?"expanded":""}`,"aria-label":`Skill source: ${a.name}`,children:[s?null:e.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize native skill source",onPointerDown:r}),e.jsxs("div",{className:"workspace-diff-topbar native-skill-sidebar-topbar",children:[e.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Native skill files",children:e.jsxs("button",{className:"workspace-diff-tab active",type:"button",role:"tab","aria-selected":!0,children:[e.jsx(o,{size:14}),e.jsx("span",{children:t})]})}),e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsx("button",{className:"diff-icon-button",type:"button",title:s?"Dock sidebar":"Expand sidebar","aria-label":s?"Dock sidebar":"Expand sidebar",onClick:l,children:s?e.jsx(d,{size:14}):e.jsx(c,{size:14})}),e.jsx("button",{className:"diff-icon-button",type:"button",title:"Close skill source","aria-label":"Close skill source",onClick:i,children:e.jsx(n,{size:14})})]})]}),e.jsxs("div",{className:"native-skill-sidebar-body",children:[e.jsxs("header",{className:"native-skill-source-header",children:[e.jsx("h2",{children:a.name}),e.jsx("p",{children:a.description}),e.jsx("code",{children:a.path})]}),e.jsx("pre",{className:"native-skill-markdown-source","aria-label":`${a.name} Markdown source`,children:e.jsx("code",{children:a.body})})]})]})}export{x as NativeSkillSidebar};
@@ -1 +1 @@
1
- import{j as i}from"./index-D-VK8mST.js";import{bv as t}from"./App-DfiCmBv6.js";function x({value:a,onChange:o}){const c=(e,l)=>{let r;if(e.key==="Home")r=0;else if(e.key==="End")r=t.length-1;else if(e.key==="ArrowRight"||e.key==="ArrowDown")r=(l+1)%t.length;else if(e.key==="ArrowLeft"||e.key==="ArrowUp")r=(l-1+t.length)%t.length;else return;e.preventDefault();const n=t[r];if(!n)return;o(n.value),e.currentTarget.parentElement?.querySelectorAll(".new-experience-option")?.[r]?.focus()};return i.jsx("div",{className:"new-experience-switcher",role:"radiogroup","aria-label":"Choose task mode",children:t.map((e,l)=>{const r=e.value===a;return i.jsx("button",{type:"button",role:"radio","aria-checked":r,className:`new-experience-option ${r?"active":""}`,"data-experience":e.value,tabIndex:r?0:-1,onClick:()=>{r||o(e.value)},onKeyDown:n=>c(n,l),children:e.label},e.value)})})}export{x as NewExperienceSwitcher};
1
+ import{j as i}from"./index-Dvq7bpBG.js";import{bv as t}from"./App-BOkhmdHu.js";function x({value:a,onChange:o}){const c=(e,l)=>{let r;if(e.key==="Home")r=0;else if(e.key==="End")r=t.length-1;else if(e.key==="ArrowRight"||e.key==="ArrowDown")r=(l+1)%t.length;else if(e.key==="ArrowLeft"||e.key==="ArrowUp")r=(l-1+t.length)%t.length;else return;e.preventDefault();const n=t[r];if(!n)return;o(n.value),e.currentTarget.parentElement?.querySelectorAll(".new-experience-option")?.[r]?.focus()};return i.jsx("div",{className:"new-experience-switcher",role:"radiogroup","aria-label":"Choose task mode",children:t.map((e,l)=>{const r=e.value===a;return i.jsx("button",{type:"button",role:"radio","aria-checked":r,className:`new-experience-option ${r?"active":""}`,"data-experience":e.value,tabIndex:r?0:-1,onClick:()=>{r||o(e.value)},onKeyDown:n=>c(n,l),children:e.label},e.value)})})}export{x as NewExperienceSwitcher};
@@ -1 +1 @@
1
- import{j as e}from"./index-D-VK8mST.js";import{X as N,e as f}from"./App-DfiCmBv6.js";import{F as b}from"./folder-open-CnbcQIy8.js";import{F as P}from"./folder-plus-BOaLAKy4.js";function L({open:d,mode:a="local",name:r,path:s,directory:n,busy:t,onNameChange:c,onPathChange:j,onClose:p,onSubmit:g}){if(!d)return null;const l=a==="cloud",o=a==="existing-local",u=l?f:o?b:P,m=l?"New Cloud Project":o?"Use Existing Folder":"New Local Project",x=l?"Create a hosted project in OpenPond Cloud.":o?"Add an existing local project folder to Projects.":"Create a new local Git project and add it to Projects.",h=t||(o?!s.trim():!r.trim()),C=t?o?"Adding":"Creating":l?"Create Cloud Project":o?"Add project":"Create project";return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:e.jsxs("form",{className:"git-dialog new-project-dialog","aria-label":o?"Add existing project":"Create project",onSubmit:i=>{i.preventDefault(),g()},children:[e.jsx("button",{className:"git-dialog-close",disabled:t,type:"button",onClick:p,children:e.jsx(N,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(u,{size:18})}),e.jsx("h2",{children:m}),e.jsx("p",{children:x}),o?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Folder path"}),e.jsx("input",{autoFocus:!0,disabled:t,placeholder:"/home/user/project",value:s,onChange:i=>j(i.target.value)})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Project name"}),e.jsx("input",{autoFocus:!0,disabled:t,placeholder:"New project",value:r,onChange:i=>c(i.target.value)})]}),e.jsxs("div",{className:"git-dialog-row",children:[e.jsx("span",{children:"Location"}),e.jsx("strong",{className:"git-dialog-path",children:l?"OpenPond Cloud":n})]})]}),e.jsx("button",{className:"git-dialog-primary full",disabled:h,type:"submit",children:C})]})})}export{L as NewProjectDialog};
1
+ import{j as e}from"./index-Dvq7bpBG.js";import{X as N,e as f}from"./App-BOkhmdHu.js";import{F as b}from"./folder-open-vRTuLzpS.js";import{F as P}from"./folder-plus-hyqwgUnx.js";function L({open:d,mode:a="local",name:r,path:s,directory:n,busy:t,onNameChange:c,onPathChange:j,onClose:p,onSubmit:g}){if(!d)return null;const l=a==="cloud",o=a==="existing-local",u=l?f:o?b:P,m=l?"New Cloud Project":o?"Use Existing Folder":"New Local Project",x=l?"Create a hosted project in OpenPond Cloud.":o?"Add an existing local project folder to Projects.":"Create a new local Git project and add it to Projects.",h=t||(o?!s.trim():!r.trim()),C=t?o?"Adding":"Creating":l?"Create Cloud Project":o?"Add project":"Create project";return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",children:e.jsxs("form",{className:"git-dialog new-project-dialog","aria-label":o?"Add existing project":"Create project",onSubmit:i=>{i.preventDefault(),g()},children:[e.jsx("button",{className:"git-dialog-close",disabled:t,type:"button",onClick:p,children:e.jsx(N,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(u,{size:18})}),e.jsx("h2",{children:m}),e.jsx("p",{children:x}),o?e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Folder path"}),e.jsx("input",{autoFocus:!0,disabled:t,placeholder:"/home/user/project",value:s,onChange:i=>j(i.target.value)})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Project name"}),e.jsx("input",{autoFocus:!0,disabled:t,placeholder:"New project",value:r,onChange:i=>c(i.target.value)})]}),e.jsxs("div",{className:"git-dialog-row",children:[e.jsx("span",{children:"Location"}),e.jsx("strong",{className:"git-dialog-path",children:l?"OpenPond Cloud":n})]})]}),e.jsx("button",{className:"git-dialog-primary full",disabled:h,type:"submit",children:C})]})})}export{L as NewProjectDialog};
@@ -1 +1 @@
1
- import{r as i,j as e}from"./index-D-VK8mST.js";import{o as W,aK as A,aC as D,X as B,i as R}from"./App-DfiCmBv6.js";import{s as M,r as z}from"./desktop-files-BQj1J-ob.js";import{C as K,F as X}from"./chat-file-links-CqfMdhHQ.js";import{F as q,I as H,a as Y,b as V,c as G}from"./MainPane-k1iII9e9.js";import{F as J}from"./folder-open-CnbcQIy8.js";import"./cloud-upload-CUVFzURz.js";import"./arrow-up-right-C7VWgGQP.js";import"./square-B2roZTxf.js";const Q="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Z="application/vnd.openxmlformats-officedocument.presentationml.presentation",tt="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";function x(t){const s=t.contentType.toLowerCase(),n=t.title.toLowerCase();return s===Q||n.endsWith(".docx")?{label:"Document",type:"document"}:s==="application/pdf"||n.endsWith(".pdf")?{label:"PDF",type:"pdf"}:s===Z||n.endsWith(".pptx")?{label:"Presentation",type:"presentation"}:s===tt||s==="text/csv"||s==="text/tab-separated-values"||n.endsWith(".xlsx")||n.endsWith(".csv")||n.endsWith(".tsv")?{label:"Table",type:"table"}:s==="text/html"||n.endsWith(".html")?{label:"HTML",type:"html"}:s==="application/json"||s==="text/markdown"||s==="text/plain"?{label:"Text",type:"text"}:s.startsWith("image/")?{label:"Image",type:"image"}:s.startsWith("audio/")?{label:"Audio",type:"audio"}:s.startsWith("video/")?{label:"Video",type:"video"}:{label:"File",type:"file"}}function et(t){return[...t].sort((s,n)=>P(n.createdAt)-P(s.createdAt)||n.revision-s.revision)}function P(t){const s=new Date(t).getTime();return Number.isNaN(s)?0:s}const st=15e3,f=new Map;function ot(t){const s=i.useMemo(()=>t?_(t):null,[t]),n=s?L(s):null,[a,r]=i.useState(n??[]),[j,h]=i.useState(!!t&&!n),[b,d]=i.useState(null);return i.useEffect(()=>{let p=!1;if(!t||!s){r([]),h(!1),d(null);return}const m=L(s);return r(m??[]),h(!m),d(null),nt(t).then(l=>{p||r(l)}).catch(l=>{p||d(rt(l))}).finally(()=>{p||h(!1)}),()=>{p=!0}},[s,t]),{error:b,loading:j,outputs:a}}function L(t){const s=f.get(t);return s&&s.refreshedAt>0?s.outputs:null}function nt(t){const s=_(t),n=f.get(s);if(n?.request)return n.request;if(n&&n.refreshedAt>0&&Date.now()-n.refreshedAt<st)return Promise.resolve(n.outputs);const a=W.workOutputs(t).then(r=>et(r.outputs)).then(r=>(f.set(s,{outputs:r,refreshedAt:Date.now(),request:null}),r)).catch(r=>{throw n?f.set(s,{...n,request:null}):f.delete(s),r});return f.set(s,{outputs:n?.outputs??[],refreshedAt:n?.refreshedAt??0,request:a}),a}function _(t){return`${t.serverUrl}\0${t.token}`}function rt(t){return t instanceof Error?t.message:"Could not load Work outputs."}const v="all",at=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"});function Tt({connection:t,onViewChat:s}){const{error:n,loading:a,outputs:r}=ot(t),[j,h]=i.useState(v),[b,d]=i.useState(null),[p,m]=i.useState(null),[l,T]=i.useState(null);i.useEffect(()=>()=>{l?.objectUrl&&URL.revokeObjectURL(l.objectUrl)},[l?.objectUrl]);const k=i.useMemo(()=>Array.from(new Set(r.map(o=>x(o).label))).sort((o,u)=>o.localeCompare(u)),[r]),y=k.includes(j)?j:v,C=i.useMemo(()=>y===v?r:r.filter(o=>x(o).label===y),[y,r]);async function I(o){if(!t)return;const u=S(o);m(u),d(null);try{const c=await W.workspaceTool(t,o.sourceTaskId,{action:"work_output_read",source:"ui_button",args:{outputId:o.id,revision:o.revision}});if(!c.ok)throw new Error(c.output);const F=pt(c.data),O=typeof F.contentsBase64=="string"?F.contentsBase64:"";if(!O)throw new Error("The output did not include file data.");const N=new File([dt(O)],o.title,{type:o.contentType}),U=x(o),E=U.type==="text"||U.type==="html";l?.objectUrl&&URL.revokeObjectURL(l.objectUrl),T({file:N,objectUrl:E?null:URL.createObjectURL(N),output:o,text:E?await N.text():null})}catch(c){d(ft(c))}finally{m(null)}}async function w(o){if(o.location.kind!=="local")return;const u=await M(o.location.path,o.title);!u.ok&&!u.canceled&&d("Could not save a copy of the Work output.")}return e.jsxs("section",{"aria-label":"Outputs",className:`outputs-view${l?" detail-open":""}`,children:[e.jsx("div",{className:"outputs-scroll",children:e.jsxs("div",{className:"outputs-content",children:[r.length>0?e.jsx("header",{className:"outputs-header",children:e.jsx("label",{className:"outputs-filter",children:e.jsxs("select",{"aria-label":"Filter files by file type",onChange:o=>h(o.target.value),value:y,children:[e.jsx("option",{value:v,children:"All file types"}),k.map(o=>e.jsx("option",{value:o,children:o},o))]})})}):null,n||b?e.jsx("p",{className:"outputs-error",children:b??n}):null,t?a&&r.length===0?e.jsxs("div",{className:"outputs-loading",role:"status",children:[e.jsx(A,{className:"outputs-spin",size:16}),e.jsx("span",{children:"Loading files"})]}):r.length===0?e.jsx(g,{children:"Files created in Work will appear here."}):C.length===0?e.jsx(g,{children:"No files match this file type."}):e.jsx("div",{className:"outputs-grid","data-testid":"desktop-output-cards",children:C.map(o=>{const u=x(o),c=S(o);return e.jsxs("article",{className:"output-card",children:[e.jsxs("button",{"aria-label":`Preview ${o.title}`,className:"output-card-main",disabled:p===c,onClick:()=>{I(o)},type:"button",children:[e.jsx("span",{className:"output-card-icon",children:e.jsx($,{type:u.type})}),e.jsxs("span",{className:"output-card-copy",children:[e.jsx("strong",{children:o.title}),e.jsxs("small",{children:[u.label," · ",ut(o.sizeBytes)]}),e.jsxs("small",{children:["Revision ",o.revision," ·"," ",e.jsx("time",{dateTime:o.createdAt,children:ct(o.createdAt)})]})]}),p===c?e.jsx(A,{className:"outputs-spin",size:15}):null]}),e.jsxs("div",{className:"output-card-actions",children:[o.location.kind==="local"?e.jsx("button",{"aria-label":`Download ${o.title}`,className:"output-download-button",onClick:()=>{w(o)},title:"Download",type:"button",children:e.jsx(D,{"aria-hidden":"true",size:14})}):null,e.jsx("button",{onClick:()=>s(o.sourceTaskId),type:"button",children:"View chat"})]})]},c)})}):e.jsx(g,{children:"Connect to the local OpenPond server to view outputs."})]})}),l?e.jsx(lt,{onClose:()=>T(null),onSave:()=>{w(l.output)},onViewChat:()=>s(l.output.sourceTaskId),preview:l}):null]})}function lt({onClose:t,onSave:s,onViewChat:n,preview:a}){const r=x(a.output);return e.jsxs("aside",{"aria-label":`${a.output.title} preview`,className:"output-detail",children:[e.jsxs("header",{className:"output-detail-header",children:[e.jsxs("div",{children:[e.jsx("h2",{children:a.output.title}),e.jsxs("p",{children:[r.label," · Revision ",a.output.revision]})]}),e.jsx("button",{"aria-label":"Close output preview",onClick:t,type:"button",children:e.jsx(B,{size:16})})]}),e.jsx("div",{className:"output-preview-surface",children:a.text!==null?r.type==="html"?e.jsx("iframe",{sandbox:"",srcDoc:a.text,title:a.output.title}):e.jsx("pre",{children:a.text}):r.type==="image"&&a.objectUrl?e.jsx("img",{alt:a.output.title,src:a.objectUrl}):r.type==="pdf"&&a.objectUrl?e.jsx("iframe",{src:a.objectUrl,title:a.output.title}):r.type==="audio"&&a.objectUrl?e.jsx("audio",{controls:!0,src:a.objectUrl}):r.type==="video"&&a.objectUrl?e.jsx("video",{controls:!0,src:a.objectUrl}):e.jsxs("div",{className:"output-native-preview",children:[e.jsx($,{type:r.type}),e.jsx("p",{children:"This file type uses its native application for detailed review."})]})}),e.jsxs("div",{className:"output-detail-actions",children:[a.output.location.kind==="local"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{z(a.output.location.kind==="local"?a.output.location.path:"")},type:"button",children:[e.jsx(J,{size:14}),"Reveal"]}),e.jsx("button",{"aria-label":`Download ${a.output.title}`,className:"output-download-button",onClick:s,title:"Download",type:"button",children:e.jsx(D,{"aria-hidden":"true",size:14})})]}):null,e.jsx("button",{onClick:n,type:"button",children:"View chat"})]})]})}function $({type:t}){const s=it(t);return e.jsx(s,{"aria-hidden":"true",size:18})}function it(t){return t==="audio"?q:t==="html"||t==="text"?K:t==="image"?H:t==="presentation"?Y:t==="table"?V:t==="video"?G:t==="file"?X:R}function g({children:t}){return e.jsx("p",{className:"outputs-empty",children:t})}function S(t){return`${t.sourceTaskId}:${t.id}:${t.revision}`}function ut(t){return t<1e3?`${t} B`:t<1e6?`${(t/1e3).toFixed(1)} KB`:`${(t/1e6).toFixed(1)} MB`}function ct(t){const s=new Date(t);return Number.isNaN(s.getTime())?"Unknown date":at.format(s)}function dt(t){const s=window.atob(t),n=new ArrayBuffer(s.length),a=new Uint8Array(n);for(let r=0;r<s.length;r+=1)a[r]=s.charCodeAt(r);return n}function pt(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function ft(t){return t instanceof Error?t.message:"Could not load Work outputs."}export{Tt as OutputsPage};
1
+ import{r as i,j as e}from"./index-Dvq7bpBG.js";import{o as D,aL as A,aD as W,X as B,i as R}from"./App-BOkhmdHu.js";import{s as M,r as z}from"./desktop-files-BQj1J-ob.js";import{C as K,F as X}from"./chat-file-links-Bned0MT7.js";import{F as q,I as H,a as Y,b as V,c as G}from"./MainPane-BbknUzp3.js";import{F as J}from"./folder-open-vRTuLzpS.js";import"./cloud-upload-CsrrwS-b.js";import"./arrow-up-right-4nAzMtjW.js";import"./square-LY3oz82L.js";const Q="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Z="application/vnd.openxmlformats-officedocument.presentationml.presentation",tt="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";function x(t){const s=t.contentType.toLowerCase(),n=t.title.toLowerCase();return s===Q||n.endsWith(".docx")?{label:"Document",type:"document"}:s==="application/pdf"||n.endsWith(".pdf")?{label:"PDF",type:"pdf"}:s===Z||n.endsWith(".pptx")?{label:"Presentation",type:"presentation"}:s===tt||s==="text/csv"||s==="text/tab-separated-values"||n.endsWith(".xlsx")||n.endsWith(".csv")||n.endsWith(".tsv")?{label:"Table",type:"table"}:s==="text/html"||n.endsWith(".html")?{label:"HTML",type:"html"}:s==="application/json"||s==="text/markdown"||s==="text/plain"?{label:"Text",type:"text"}:s.startsWith("image/")?{label:"Image",type:"image"}:s.startsWith("audio/")?{label:"Audio",type:"audio"}:s.startsWith("video/")?{label:"Video",type:"video"}:{label:"File",type:"file"}}function et(t){return[...t].sort((s,n)=>P(n.createdAt)-P(s.createdAt)||n.revision-s.revision)}function P(t){const s=new Date(t).getTime();return Number.isNaN(s)?0:s}const st=15e3,f=new Map;function ot(t){const s=i.useMemo(()=>t?_(t):null,[t]),n=s?L(s):null,[a,r]=i.useState(n??[]),[j,h]=i.useState(!!t&&!n),[b,d]=i.useState(null);return i.useEffect(()=>{let p=!1;if(!t||!s){r([]),h(!1),d(null);return}const m=L(s);return r(m??[]),h(!m),d(null),nt(t).then(l=>{p||r(l)}).catch(l=>{p||d(rt(l))}).finally(()=>{p||h(!1)}),()=>{p=!0}},[s,t]),{error:b,loading:j,outputs:a}}function L(t){const s=f.get(t);return s&&s.refreshedAt>0?s.outputs:null}function nt(t){const s=_(t),n=f.get(s);if(n?.request)return n.request;if(n&&n.refreshedAt>0&&Date.now()-n.refreshedAt<st)return Promise.resolve(n.outputs);const a=D.workOutputs(t).then(r=>et(r.outputs)).then(r=>(f.set(s,{outputs:r,refreshedAt:Date.now(),request:null}),r)).catch(r=>{throw n?f.set(s,{...n,request:null}):f.delete(s),r});return f.set(s,{outputs:n?.outputs??[],refreshedAt:n?.refreshedAt??0,request:a}),a}function _(t){return`${t.serverUrl}\0${t.token}`}function rt(t){return t instanceof Error?t.message:"Could not load Work outputs."}const v="all",at=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"});function Tt({connection:t,onViewChat:s}){const{error:n,loading:a,outputs:r}=ot(t),[j,h]=i.useState(v),[b,d]=i.useState(null),[p,m]=i.useState(null),[l,T]=i.useState(null);i.useEffect(()=>()=>{l?.objectUrl&&URL.revokeObjectURL(l.objectUrl)},[l?.objectUrl]);const k=i.useMemo(()=>Array.from(new Set(r.map(o=>x(o).label))).sort((o,u)=>o.localeCompare(u)),[r]),y=k.includes(j)?j:v,w=i.useMemo(()=>y===v?r:r.filter(o=>x(o).label===y),[y,r]);async function I(o){if(!t)return;const u=S(o);m(u),d(null);try{const c=await D.workspaceTool(t,o.sourceTaskId,{action:"work_output_read",source:"ui_button",args:{outputId:o.id,revision:o.revision}});if(!c.ok)throw new Error(c.output);const F=pt(c.data),O=typeof F.contentsBase64=="string"?F.contentsBase64:"";if(!O)throw new Error("The output did not include file data.");const N=new File([dt(O)],o.title,{type:o.contentType}),U=x(o),E=U.type==="text"||U.type==="html";l?.objectUrl&&URL.revokeObjectURL(l.objectUrl),T({file:N,objectUrl:E?null:URL.createObjectURL(N),output:o,text:E?await N.text():null})}catch(c){d(ft(c))}finally{m(null)}}async function C(o){if(o.location.kind!=="local")return;const u=await M(o.location.path,o.title);!u.ok&&!u.canceled&&d("Could not save a copy of the Work output.")}return e.jsxs("section",{"aria-label":"Outputs",className:`outputs-view${l?" detail-open":""}`,children:[e.jsx("div",{className:"outputs-scroll",children:e.jsxs("div",{className:"outputs-content",children:[r.length>0?e.jsx("header",{className:"outputs-header",children:e.jsx("label",{className:"outputs-filter",children:e.jsxs("select",{"aria-label":"Filter files by file type",onChange:o=>h(o.target.value),value:y,children:[e.jsx("option",{value:v,children:"All file types"}),k.map(o=>e.jsx("option",{value:o,children:o},o))]})})}):null,n||b?e.jsx("p",{className:"outputs-error",children:b??n}):null,t?a&&r.length===0?e.jsxs("div",{className:"outputs-loading",role:"status",children:[e.jsx(A,{className:"outputs-spin",size:16}),e.jsx("span",{children:"Loading files"})]}):r.length===0?e.jsx(g,{children:"Files created in Work will appear here."}):w.length===0?e.jsx(g,{children:"No files match this file type."}):e.jsx("div",{className:"outputs-grid","data-testid":"desktop-output-cards",children:w.map(o=>{const u=x(o),c=S(o);return e.jsxs("article",{className:"output-card",children:[e.jsxs("button",{"aria-label":`Preview ${o.title}`,className:"output-card-main",disabled:p===c,onClick:()=>{I(o)},type:"button",children:[e.jsx("span",{className:"output-card-icon",children:e.jsx($,{type:u.type})}),e.jsxs("span",{className:"output-card-copy",children:[e.jsx("strong",{children:o.title}),e.jsxs("small",{children:[u.label," · ",ut(o.sizeBytes)]}),e.jsxs("small",{children:["Revision ",o.revision," ·"," ",e.jsx("time",{dateTime:o.createdAt,children:ct(o.createdAt)})]})]}),p===c?e.jsx(A,{className:"outputs-spin",size:15}):null]}),e.jsxs("div",{className:"output-card-actions",children:[o.location.kind==="local"?e.jsx("button",{"aria-label":`Download ${o.title}`,className:"output-download-button",onClick:()=>{C(o)},title:"Download",type:"button",children:e.jsx(W,{"aria-hidden":"true",size:14})}):null,e.jsx("button",{onClick:()=>s(o.sourceTaskId),type:"button",children:"View chat"})]})]},c)})}):e.jsx(g,{children:"Connect to the local OpenPond server to view outputs."})]})}),l?e.jsx(lt,{onClose:()=>T(null),onSave:()=>{C(l.output)},onViewChat:()=>s(l.output.sourceTaskId),preview:l}):null]})}function lt({onClose:t,onSave:s,onViewChat:n,preview:a}){const r=x(a.output);return e.jsxs("aside",{"aria-label":`${a.output.title} preview`,className:"output-detail",children:[e.jsxs("header",{className:"output-detail-header",children:[e.jsxs("div",{children:[e.jsx("h2",{children:a.output.title}),e.jsxs("p",{children:[r.label," · Revision ",a.output.revision]})]}),e.jsx("button",{"aria-label":"Close output preview",onClick:t,type:"button",children:e.jsx(B,{size:16})})]}),e.jsx("div",{className:"output-preview-surface",children:a.text!==null?r.type==="html"?e.jsx("iframe",{sandbox:"",srcDoc:a.text,title:a.output.title}):e.jsx("pre",{children:a.text}):r.type==="image"&&a.objectUrl?e.jsx("img",{alt:a.output.title,src:a.objectUrl}):r.type==="pdf"&&a.objectUrl?e.jsx("iframe",{src:a.objectUrl,title:a.output.title}):r.type==="audio"&&a.objectUrl?e.jsx("audio",{controls:!0,src:a.objectUrl}):r.type==="video"&&a.objectUrl?e.jsx("video",{controls:!0,src:a.objectUrl}):e.jsxs("div",{className:"output-native-preview",children:[e.jsx($,{type:r.type}),e.jsx("p",{children:"This file type uses its native application for detailed review."})]})}),e.jsxs("div",{className:"output-detail-actions",children:[a.output.location.kind==="local"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{z(a.output.location.kind==="local"?a.output.location.path:"")},type:"button",children:[e.jsx(J,{size:14}),"Reveal"]}),e.jsx("button",{"aria-label":`Download ${a.output.title}`,className:"output-download-button",onClick:s,title:"Download",type:"button",children:e.jsx(W,{"aria-hidden":"true",size:14})})]}):null,e.jsx("button",{onClick:n,type:"button",children:"View chat"})]})]})}function $({type:t}){const s=it(t);return e.jsx(s,{"aria-hidden":"true",size:18})}function it(t){return t==="audio"?q:t==="html"||t==="text"?K:t==="image"?H:t==="presentation"?Y:t==="table"?V:t==="video"?G:t==="file"?X:R}function g({children:t}){return e.jsx("p",{className:"outputs-empty",children:t})}function S(t){return`${t.sourceTaskId}:${t.id}:${t.revision}`}function ut(t){return t<1e3?`${t} B`:t<1e6?`${(t/1e3).toFixed(1)} KB`:`${(t/1e6).toFixed(1)} MB`}function ct(t){const s=new Date(t);return Number.isNaN(s.getTime())?"Unknown date":at.format(s)}function dt(t){const s=window.atob(t),n=new ArrayBuffer(s.length),a=new Uint8Array(n);for(let r=0;r<s.length;r+=1)a[r]=s.charCodeAt(r);return n}function pt(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function ft(t){return t instanceof Error?t.message:"Could not load Work outputs."}export{Tt as OutputsPage};
@@ -1 +1 @@
1
- import{j as e,r as j}from"./index-D-VK8mST.js";import{c1 as ee,o as U,A as te,b3 as W,ai as F,bb as _,ak as O,e as B,aI as M,ao as A}from"./App-DfiCmBv6.js";import{C as H}from"./cloud-upload-CUVFzURz.js";function V(t,n){const r=t.project.sourceLabel?.trim()??"";if(t.project.sourceType==="github_repo"&&r){if(/^https?:\/\//i.test(r))return r;if(/^[^/\s]+\/[^/\s]+$/.test(r))return`https://github.com/${r}`}return ee({accountBaseUrl:n,organizationSlug:t.project.organizationSlug,projectSlug:t.project.slug})}function re(t,n){return t.kind==="cloud"?V(t,n):t.project.linkedSandboxProject?.sourceRepoUrl??null}function L(t){return t.replace(/^https?:\/\//i,"").replace(/\/$/,"")}async function S(t){const n=window.openpond?.browser;if(n){const r=await n.openExternal({conversationId:"projects",url:t});if(!r.ok)throw new Error(r.error??"Unable to open project URL.");return}window.open(t,"_blank","noopener,noreferrer")}function ne({loading:t,workspace:n,linked:r,unavailable:s}){if(t)return e.jsx(d,{children:"Loading environments…"});if(!r)return e.jsx(d,{children:"Upload this local project to create cloud development environments."});if(s)return e.jsx(d,{error:!0,children:"Unable to load environments."});if(!n?.environments.length)return e.jsx(d,{children:"No development environment has been created for this project yet."});const o=ce(n);return e.jsx(G,{headings:["Environment","Status","Branch","Default","Updated"],children:n.environments.map(({sandbox:c,runtime:i})=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:de(c.metadata,c.id)})}),e.jsx("td",{children:e.jsx($,{status:c.state})}),e.jsx("td",{children:e.jsx("code",{children:i?.baseBranch??c.repoRef??"Not available"})}),e.jsx("td",{children:c.id===o?"Preferred":"—"}),e.jsx("td",{children:I(c.updatedAt)})]},c.id))})}function se({loading:t,workspace:n,linked:r,unavailable:s}){return t?e.jsx(d,{children:"Loading deployments…"}):r?s?e.jsx(d,{error:!0,children:"Unable to load deployments."}):n?.errors.deployments?e.jsx(d,{error:!0,children:"Unable to load deployments."}):n?.website?n.deployments.length?e.jsx(G,{headings:["Deployment","Status","Commit","Build","Created by","Created"],children:n.deployments.map(o=>e.jsx(ae,{deployment:o},o.release.id))}):e.jsx(d,{children:"No deployments yet."}):e.jsx(d,{children:"Set up Website before creating a deployment."}):e.jsx(d,{children:"Upload this local project before creating deployments."})}function ie({loading:t,workspace:n,linked:r,unavailable:s}){const[o,c]=j.useState(null);return t?e.jsx(d,{children:"Loading requests…"}):r?s?e.jsx(d,{error:!0,children:"Unable to load requests."}):n?.errors.requests?e.jsx(d,{error:!0,children:"Unable to load requests."}):n?.website?n.requests.length?e.jsx("div",{className:"project-detail-table-frame",children:e.jsxs("table",{className:"project-detail-table project-request-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Request"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Runtime"}),e.jsx("th",{children:"Started"}),e.jsx("th",{children:"Duration"})]})}),n.requests.map(i=>{const p=o===i.id;return e.jsxs("tbody",{children:[e.jsxs("tr",{"aria-expanded":p,className:"project-request-row",onClick:()=>c(u=>u===i.id?null:i.id),children:[e.jsxs("td",{children:[e.jsx("code",{children:i.method})," ",je(i.path)]}),e.jsx("td",{children:e.jsx($,{status:String(i.responseStatus),tone:i.outcome==="failure"?"error":"success"})}),e.jsx("td",{children:i.coldStart===null?"Unknown":i.coldStart?"Cold":"Warm"}),e.jsx("td",{children:I(i.startedAt)}),e.jsx("td",{children:K(i.totalDurationMs)})]}),p?e.jsx(le,{trace:i}):null]},i.id)})]})}):e.jsx(d,{children:"No requests yet."}):e.jsx(d,{children:"Set up Website to receive requests."}):e.jsx(d,{children:"Upload this local project and set up Website to receive requests."})}function oe({loading:t,workspace:n,linked:r,unavailable:s}){if(t)return e.jsx(d,{children:"Loading website…"});if(!r)return e.jsx(d,{children:"Upload this local project before setting up Website."});if(s)return e.jsx(d,{error:!0,children:"Unable to load the website."});if(n?.errors.website)return e.jsx(d,{error:!0,children:"Unable to load the website."});const o=n?.website??null,c=o?.settings.platformDomain?`https://${o.settings.platformDomain}`:null,i=o?.releases.find(u=>u.id===o.settings.activeReleaseId)?.sourceCommitSha??null,p=[["Public URL",c?e.jsx("a",{href:c,onClick:u=>{u.preventDefault(),S(c)},children:L(c)}):"Not assigned"],["Live release",o?.settings.activeReleaseId?"Active":"Not published"],["Source",i?J(i):"Not available"],["Account database",ue(n)],["Availability",o?.settings.runtimePolicy?.availabilityMode==="always_on"?"Always on":"On demand"]];return e.jsxs("div",{className:"project-detail-table-frame",children:[e.jsxs("table",{className:"project-detail-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Setting"}),e.jsx("th",{children:"Value"})]})}),e.jsx("tbody",{children:p.map(([u,l])=>e.jsxs("tr",{children:[e.jsx("td",{children:u}),e.jsx("td",{children:l})]},u))})]}),o?null:e.jsx("div",{className:"project-detail-table-note",children:"Website has not been set up for this project."})]})}function G({headings:t,children:n}){return e.jsx("div",{className:"project-detail-table-frame",children:e.jsxs("table",{className:"project-detail-table",children:[e.jsx("thead",{children:e.jsx("tr",{children:t.map(r=>e.jsx("th",{children:r},r))})}),e.jsx("tbody",{children:n})]})})}function d({children:t,error:n=!1}){return e.jsx("div",{className:`project-detail-empty${n?" error":""}`,children:t})}function $({status:t,tone:n}){return e.jsx("span",{className:`project-detail-status${n?` ${n}`:""}`,children:t.replaceAll("_"," ")})}function ae({deployment:t}){const{build:n,release:r}=t;return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsxs("strong",{children:["v",r.version]})}),e.jsx("td",{children:e.jsx($,{status:r.status,tone:r.status==="failed"?"error":r.status==="active"||r.status==="ready"?"success":void 0})}),e.jsx("td",{children:e.jsx("code",{children:r.sourceCommitSha?J(r.sourceCommitSha):"Not available"})}),e.jsx("td",{children:n?`${n.status.replaceAll("_"," ")} · ${n.currentStage.replaceAll("_"," ")}`:"Not started"}),e.jsx("td",{children:t.creatorName??"Unknown"}),e.jsx("td",{children:I(r.createdAt)})]})}function le({trace:t}){return e.jsx("tr",{className:"project-request-detail",children:e.jsxs("td",{colSpan:5,children:[e.jsx("dl",{children:t.stages.map((n,r)=>e.jsxs("div",{children:[e.jsxs("dt",{children:[n.name.replaceAll("_"," "),n.errorCode?` · ${n.errorCode}`:""]}),e.jsx("dd",{children:K(n.durationMs)})]},`${n.name}:${r}`))}),t.errorCode?e.jsx("p",{children:t.errorCode}):null]})})}function ce(t){const n=t.project.metadata.preferredDevelopmentSandboxId;return typeof n=="string"&&n.trim()?n:null}function de(t,n){for(const r of["name","label","environmentName"]){const s=t[r];if(typeof s=="string"&&s.trim())return s}return n.length>18?n.slice(0,18):n}function ue(t){return t?.website?t.errors.database?"Unavailable":t.database?.status==="ready"?`Connected · ${t.database.provider}`:t.database?.status==="provisioning"?"Connecting…":"Not connected":"Set up the website first"}function je(t){const n="/ingress",r=t.indexOf(n);return r===-1?t:`/api${t.slice(r+n.length)||"/"}`}function J(t){return t.length>12?t.slice(0,12):t}function K(t){return t<1e3?`${Math.round(t)} ms`:`${(t/1e3).toFixed(t<1e4?2:1)} s`}function I(t){const n=Date.parse(t);return Number.isFinite(n)?new Date(n).toLocaleString():t}function he({accountBaseUrl:t,connection:n,project:r,taskCount:s,teamName:o,onBack:c,onNewTask:i,onTogglePinned:p,onUploadLocalProject:u}){const[l,h]=j.useState("source"),[m,a]=j.useState(null),[b,D]=j.useState(null),[v,q]=j.useState(!1),[R,z]=j.useState([]),[f,k]=j.useState(!1),[T,E]=j.useState(null),x=fe(r);j.useEffect(()=>{h("source")},[r.id]),j.useEffect(()=>{let w=!0;if(D(null),a(null),q(!1),z([]),E(null),!n)return k(!1),()=>{w=!1};k(!0);const X=x?pe(n,x):Promise.resolve(null),Y=r.kind==="local"?U.localProjectActions(n,r.project.id):Promise.resolve(null);return Promise.allSettled([X,Y]).then(([y,g])=>{if(!w)return;y.status==="fulfilled"&&y.value&&(a(y.value.project),D(y.value.workspace),q(y.value.workspaceUnavailable)),g.status==="fulfilled"&&g.value&&z(g.value.actions.map(ve));const N=[y,g].filter(Z=>Z.status==="rejected");N.length>0&&N.length===+!!x+ +(r.kind==="local")&&E(N[0]?.reason instanceof Error?N[0].reason.message:"Project details could not be loaded."),k(!1)}),()=>{w=!1}},[n,x?.projectId,x?.teamId,r]);const P=j.useMemo(()=>ge(ye(m),R),[m,R]),C=re(r,t),Q=be({hostedProject:m,project:r,repositoryUrl:C,taskCount:s,teamName:o});return e.jsxs("section",{"aria-label":`${r.project.name} project`,className:"project-detail-view",children:[e.jsxs("header",{className:"project-detail-header",children:[e.jsxs("div",{className:"project-detail-heading",children:[e.jsxs("button",{className:"project-detail-back",onClick:c,type:"button",children:[e.jsx(te,{"aria-hidden":"true",size:15}),e.jsx("span",{children:"Projects"})]}),e.jsx("h1",{children:r.project.name})]}),e.jsxs("div",{className:"project-detail-actions",children:[r.kind==="local"?e.jsxs("button",{onClick:()=>u(r),type:"button",children:[e.jsx(H,{"aria-hidden":"true",size:14}),e.jsx("span",{children:"Upload"})]}):null,C?e.jsxs("button",{onClick:()=>{S(C)},type:"button",children:[e.jsx(W,{"aria-hidden":"true",size:14}),e.jsx("span",{children:"Open repository"})]}):null,e.jsxs("button",{onClick:()=>i(r),type:"button",children:[e.jsx(F,{"aria-hidden":"true",size:14}),e.jsx("span",{children:"New task"})]}),e.jsx("button",{"aria-label":`${r.pinned?"Unpin":"Pin"} ${r.project.name}`,onClick:()=>p(r),title:r.pinned?"Unpin project":"Pin project",type:"button",children:r.pinned?e.jsx(_,{"aria-hidden":"true",size:14}):e.jsx(O,{"aria-hidden":"true",size:14})})]})]}),e.jsxs("div",{"aria-label":"Project detail",className:"project-detail-tabs",role:"tablist",children:[e.jsx("button",{"aria-selected":l==="source",onClick:()=>h("source"),role:"tab",type:"button",children:"Source"}),e.jsxs("button",{"aria-selected":l==="actions",onClick:()=>h("actions"),role:"tab",type:"button",children:["Project Actions",P.length>0?e.jsx("span",{children:P.length}):null]}),e.jsx("button",{"aria-selected":l==="environments",onClick:()=>h("environments"),role:"tab",type:"button",children:"Environments"}),e.jsx("button",{"aria-selected":l==="deployments",onClick:()=>h("deployments"),role:"tab",type:"button",children:"Deployments"}),e.jsx("button",{"aria-selected":l==="requests",onClick:()=>h("requests"),role:"tab",type:"button",children:"Requests"}),e.jsx("button",{"aria-selected":l==="website",onClick:()=>h("website"),role:"tab",type:"button",children:"Website"})]}),T?e.jsx("div",{className:"project-detail-error",role:"alert",children:T}):null,l==="source"?e.jsx(me,{loading:f,rows:Q}):l==="actions"?e.jsx(xe,{actions:P,loading:f}):l==="environments"?e.jsx(ne,{linked:!!x,loading:f,unavailable:v,workspace:b}):l==="deployments"?e.jsx(se,{linked:!!x,loading:f,unavailable:v,workspace:b}):l==="requests"?e.jsx(ie,{linked:!!x,loading:f,unavailable:v,workspace:b}):e.jsx(oe,{linked:!!x,loading:f,unavailable:v,workspace:b})]})}async function pe(t,n){try{const r=await U.getSandboxProjectWorkspace(t,n.projectId,{teamId:n.teamId});return{project:r.project,workspace:r,workspaceUnavailable:!1}}catch{return{project:(await U.getSandboxProject(t,n.projectId,{teamId:n.teamId})).project,workspace:null,workspaceUnavailable:!0}}}function me({loading:t,rows:n}){return e.jsx("div",{className:"project-detail-table-frame",children:e.jsxs("table",{className:"project-detail-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Setting"}),e.jsx("th",{children:"Value"})]})}),e.jsx("tbody",{children:n.map(([r,s])=>e.jsxs("tr",{children:[e.jsx("td",{children:r}),e.jsx("td",{children:t&&r==="Latest commit"?"Loading…":s})]},r))})]})})}function xe({actions:t,loading:n}){return n?e.jsx("div",{className:"project-detail-empty",children:"Loading Project Actions…"}):t.length===0?e.jsx("div",{className:"project-detail-empty",children:"No Project Actions are registered from this source."}):e.jsx("div",{className:"project-detail-table-frame",children:e.jsxs("table",{className:"project-detail-table actions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Action"}),e.jsx("th",{children:"Description"}),e.jsx("th",{children:"Source"})]})}),e.jsx("tbody",{children:t.map(r=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:r.id})}),e.jsx("td",{children:r.description??"No description"}),e.jsx("td",{children:r.source==="hosted"?"Hosted project":"Local source"})]},`${r.source}:${r.id}`))})]})})}function be(t){const{hostedProject:n,project:r,repositoryUrl:s,taskCount:o,teamName:c}=t,i=r.kind==="local"?r.project.linkedSandboxProject:null,p=n?.gitBranch??n?.defaultBranch??(r.kind==="cloud"?r.project.defaultBranch:i?.defaultBranch)??"Not set",u=n?Ne(n):i?.lastUploadedCommit??null,l=n?.sandboxManifestSyncedAt??(r.kind==="cloud"?r.project.syncedAt:i?.syncedAt)??null;return[["Repository",s?e.jsx("a",{href:s,onClick:h=>{h.preventDefault(),S(s)},children:L(s)}):r.kind==="local"?r.project.path:"Not available"],["Branch",p],["Latest commit",u?Se(u):"Not available"],["Last synced",l?ke(l):"Not available"],["Team",c??(r.kind==="cloud"?r.project.organizationName:null)??"Local only"],["Tasks",String(o)]]}function fe(t){if(t.kind==="cloud")return{projectId:t.project.id,teamId:t.project.teamId};const n=t.project.linkedSandboxProject;return n?{projectId:n.projectId,teamId:n.teamId}:null}function ye(t){const n=t?.sandboxActionRegistry?.actions;return Array.isArray(n)?n.flatMap(r=>{if(!r||typeof r!="object"||Array.isArray(r))return[];const s=r,o=typeof(s.id??s.name)=="string"?String(s.id??s.name).trim():"";return o?[{id:o,description:typeof s.description=="string"?s.description:null,source:"hosted"}]:[]}):[]}function ve(t){return{id:t.id,description:t.description??t.label??t.name??null,source:"local"}}function ge(t,n){const r=new Map;for(const s of[...t,...n])r.has(s.id)||r.set(s.id,s);return Array.from(r.values()).sort((s,o)=>s.id.localeCompare(o.id))}function Ne(t){return[t.sourceConfig.commitSha,t.sourceConfig.sourceCommitSha,t.metadata.commitSha,t.metadata.sourceCommitSha,t.templateRemoteSha].find(r=>typeof r=="string"&&!!r.trim())??null}function Se(t){return t.length>12?t.slice(0,12):t}function ke(t){const n=Date.parse(t);return Number.isFinite(n)?new Date(n).toLocaleString():t}const Pe=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"});function Ie({accountBaseUrl:t,connection:n,projects:r,taskCountByProjectId:s,teamName:o,onNewCloudProject:c,onNewTask:i,onTogglePinned:p,onUploadLocalProject:u}){const[l,h]=j.useState(null),m=j.useMemo(()=>r.find(a=>a.id===l)??null,[r,l]);return j.useEffect(()=>{l&&!m&&h(null)},[m,l]),m?e.jsx(he,{accountBaseUrl:t,connection:n,onBack:()=>h(null),onNewTask:i,onTogglePinned:p,onUploadLocalProject:u,project:m,taskCount:s[m.id]??0,teamName:o}):e.jsxs("section",{"aria-label":"Projects",className:"projects-page",children:[e.jsxs("header",{className:"projects-page-header",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Projects"}),e.jsxs("p",{children:["Local projects on this device and hosted projects for ",o??"your active team","."]})]}),e.jsx("div",{className:"projects-cloud-actions",children:e.jsxs("button",{className:"projects-cloud-button",onClick:c,type:"button",children:[e.jsx(B,{"aria-hidden":"true",size:15}),e.jsx("span",{children:"New cloud project"})]})})]}),r.length===0?e.jsxs("div",{className:"projects-empty",children:[e.jsx(M,{"aria-hidden":"true",size:24}),e.jsx("h2",{children:"No projects yet"}),e.jsx("p",{children:"Create a hosted project for this team."})]}):e.jsx("div",{className:"projects-table-frame",children:e.jsxs("table",{className:"projects-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Project"}),e.jsx("th",{scope:"col",children:"Location"}),e.jsx("th",{scope:"col",children:"Tasks"}),e.jsx("th",{scope:"col",children:"Updated"}),e.jsx("th",{"aria-label":"Project actions",scope:"col"})]})}),e.jsx("tbody",{children:r.map(a=>{const b=a.project.updatedAt;return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsxs("button",{className:"projects-name-button",onClick:()=>h(a.id),type:"button",children:[e.jsx("span",{className:`projects-kind-icon ${Ce(a)}`,children:A(a)?e.jsx(M,{"aria-hidden":"true",size:16}):e.jsx(B,{"aria-hidden":"true",size:16})}),e.jsx("span",{className:"projects-name-copy",children:e.jsx("strong",{children:a.project.name})})]})}),e.jsx("td",{children:A(a)?e.jsxs("div",{className:"projects-location-cell",children:[e.jsx("span",{className:"projects-location",title:a.project.path,children:a.project.path}),e.jsxs("button",{className:"projects-upload-button",onClick:()=>u(a),title:`Upload ${a.project.name} to the active team`,type:"button",children:[e.jsx(H,{"aria-hidden":"true",size:13}),e.jsx("span",{children:"Upload"})]})]}):e.jsx(we,{accountBaseUrl:t,project:a})}),e.jsx("td",{children:s[a.id]??0}),e.jsx("td",{children:b?e.jsx("time",{dateTime:b,children:Ue(b)}):e.jsx("span",{className:"projects-table-muted",children:"—"})}),e.jsx("td",{children:e.jsxs("div",{className:"projects-row-actions",children:[e.jsx("button",{"aria-label":`Start a new task in ${a.project.name}`,onClick:()=>i(a),title:"New task",type:"button",children:e.jsx(F,{"aria-hidden":"true",size:15})}),e.jsx("button",{"aria-label":`${a.pinned?"Unpin":"Pin"} ${a.project.name}`,onClick:()=>p(a),title:a.pinned?"Unpin project":"Pin project",type:"button",children:a.pinned?e.jsx(_,{"aria-hidden":"true",size:15}):e.jsx(O,{"aria-hidden":"true",size:15})})]})})]},a.id)})})]})})]})}function Ce(t){return A(t)?t.project.linkedSandboxProject&&t.cloudLinkTrusted?"linked":"desktop":"cloud"}function we({accountBaseUrl:t,project:n}){const r=V(n,t);return r?e.jsxs("a",{className:"projects-location-link",href:r,onClick:s=>{s.preventDefault(),S(r)},title:r,children:[e.jsx("span",{children:L(r)}),e.jsx(W,{"aria-hidden":"true",size:12})]}):e.jsx("span",{className:"projects-table-muted",children:"Repository unavailable"})}function Ue(t){const n=Date.parse(t);return Number.isFinite(n)?Pe.format(n):t}export{Ie as ProjectsPage};
1
+ import{j as e,r as j}from"./index-Dvq7bpBG.js";import{c1 as ee,o as U,A as te,ay as W,ai as F,bb as _,ak as O,e as B,aJ as M,ao as A}from"./App-BOkhmdHu.js";import{C as H}from"./cloud-upload-CsrrwS-b.js";function V(t,n){const r=t.project.sourceLabel?.trim()??"";if(t.project.sourceType==="github_repo"&&r){if(/^https?:\/\//i.test(r))return r;if(/^[^/\s]+\/[^/\s]+$/.test(r))return`https://github.com/${r}`}return ee({accountBaseUrl:n,organizationSlug:t.project.organizationSlug,projectSlug:t.project.slug})}function re(t,n){return t.kind==="cloud"?V(t,n):t.project.linkedSandboxProject?.sourceRepoUrl??null}function L(t){return t.replace(/^https?:\/\//i,"").replace(/\/$/,"")}async function S(t){const n=window.openpond?.browser;if(n){const r=await n.openExternal({conversationId:"projects",url:t});if(!r.ok)throw new Error(r.error??"Unable to open project URL.");return}window.open(t,"_blank","noopener,noreferrer")}function ne({loading:t,workspace:n,linked:r,unavailable:s}){if(t)return e.jsx(d,{children:"Loading environments…"});if(!r)return e.jsx(d,{children:"Upload this local project to create cloud development environments."});if(s)return e.jsx(d,{error:!0,children:"Unable to load environments."});if(!n?.environments.length)return e.jsx(d,{children:"No development environment has been created for this project yet."});const o=ce(n);return e.jsx(G,{headings:["Environment","Status","Branch","Default","Updated"],children:n.environments.map(({sandbox:c,runtime:i})=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:de(c.metadata,c.id)})}),e.jsx("td",{children:e.jsx($,{status:c.state})}),e.jsx("td",{children:e.jsx("code",{children:i?.baseBranch??c.repoRef??"Not available"})}),e.jsx("td",{children:c.id===o?"Preferred":"—"}),e.jsx("td",{children:I(c.updatedAt)})]},c.id))})}function se({loading:t,workspace:n,linked:r,unavailable:s}){return t?e.jsx(d,{children:"Loading deployments…"}):r?s?e.jsx(d,{error:!0,children:"Unable to load deployments."}):n?.errors.deployments?e.jsx(d,{error:!0,children:"Unable to load deployments."}):n?.website?n.deployments.length?e.jsx(G,{headings:["Deployment","Status","Commit","Build","Created by","Created"],children:n.deployments.map(o=>e.jsx(ae,{deployment:o},o.release.id))}):e.jsx(d,{children:"No deployments yet."}):e.jsx(d,{children:"Set up Website before creating a deployment."}):e.jsx(d,{children:"Upload this local project before creating deployments."})}function ie({loading:t,workspace:n,linked:r,unavailable:s}){const[o,c]=j.useState(null);return t?e.jsx(d,{children:"Loading requests…"}):r?s?e.jsx(d,{error:!0,children:"Unable to load requests."}):n?.errors.requests?e.jsx(d,{error:!0,children:"Unable to load requests."}):n?.website?n.requests.length?e.jsx("div",{className:"project-detail-table-frame",children:e.jsxs("table",{className:"project-detail-table project-request-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Request"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Runtime"}),e.jsx("th",{children:"Started"}),e.jsx("th",{children:"Duration"})]})}),n.requests.map(i=>{const p=o===i.id;return e.jsxs("tbody",{children:[e.jsxs("tr",{"aria-expanded":p,className:"project-request-row",onClick:()=>c(u=>u===i.id?null:i.id),children:[e.jsxs("td",{children:[e.jsx("code",{children:i.method})," ",je(i.path)]}),e.jsx("td",{children:e.jsx($,{status:String(i.responseStatus),tone:i.outcome==="failure"?"error":"success"})}),e.jsx("td",{children:i.coldStart===null?"Unknown":i.coldStart?"Cold":"Warm"}),e.jsx("td",{children:I(i.startedAt)}),e.jsx("td",{children:K(i.totalDurationMs)})]}),p?e.jsx(le,{trace:i}):null]},i.id)})]})}):e.jsx(d,{children:"No requests yet."}):e.jsx(d,{children:"Set up Website to receive requests."}):e.jsx(d,{children:"Upload this local project and set up Website to receive requests."})}function oe({loading:t,workspace:n,linked:r,unavailable:s}){if(t)return e.jsx(d,{children:"Loading website…"});if(!r)return e.jsx(d,{children:"Upload this local project before setting up Website."});if(s)return e.jsx(d,{error:!0,children:"Unable to load the website."});if(n?.errors.website)return e.jsx(d,{error:!0,children:"Unable to load the website."});const o=n?.website??null,c=o?.settings.platformDomain?`https://${o.settings.platformDomain}`:null,i=o?.releases.find(u=>u.id===o.settings.activeReleaseId)?.sourceCommitSha??null,p=[["Public URL",c?e.jsx("a",{href:c,onClick:u=>{u.preventDefault(),S(c)},children:L(c)}):"Not assigned"],["Live release",o?.settings.activeReleaseId?"Active":"Not published"],["Source",i?J(i):"Not available"],["Account database",ue(n)],["Availability",o?.settings.runtimePolicy?.availabilityMode==="always_on"?"Always on":"On demand"]];return e.jsxs("div",{className:"project-detail-table-frame",children:[e.jsxs("table",{className:"project-detail-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Setting"}),e.jsx("th",{children:"Value"})]})}),e.jsx("tbody",{children:p.map(([u,l])=>e.jsxs("tr",{children:[e.jsx("td",{children:u}),e.jsx("td",{children:l})]},u))})]}),o?null:e.jsx("div",{className:"project-detail-table-note",children:"Website has not been set up for this project."})]})}function G({headings:t,children:n}){return e.jsx("div",{className:"project-detail-table-frame",children:e.jsxs("table",{className:"project-detail-table",children:[e.jsx("thead",{children:e.jsx("tr",{children:t.map(r=>e.jsx("th",{children:r},r))})}),e.jsx("tbody",{children:n})]})})}function d({children:t,error:n=!1}){return e.jsx("div",{className:`project-detail-empty${n?" error":""}`,children:t})}function $({status:t,tone:n}){return e.jsx("span",{className:`project-detail-status${n?` ${n}`:""}`,children:t.replaceAll("_"," ")})}function ae({deployment:t}){const{build:n,release:r}=t;return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsxs("strong",{children:["v",r.version]})}),e.jsx("td",{children:e.jsx($,{status:r.status,tone:r.status==="failed"?"error":r.status==="active"||r.status==="ready"?"success":void 0})}),e.jsx("td",{children:e.jsx("code",{children:r.sourceCommitSha?J(r.sourceCommitSha):"Not available"})}),e.jsx("td",{children:n?`${n.status.replaceAll("_"," ")} · ${n.currentStage.replaceAll("_"," ")}`:"Not started"}),e.jsx("td",{children:t.creatorName??"Unknown"}),e.jsx("td",{children:I(r.createdAt)})]})}function le({trace:t}){return e.jsx("tr",{className:"project-request-detail",children:e.jsxs("td",{colSpan:5,children:[e.jsx("dl",{children:t.stages.map((n,r)=>e.jsxs("div",{children:[e.jsxs("dt",{children:[n.name.replaceAll("_"," "),n.errorCode?` · ${n.errorCode}`:""]}),e.jsx("dd",{children:K(n.durationMs)})]},`${n.name}:${r}`))}),t.errorCode?e.jsx("p",{children:t.errorCode}):null]})})}function ce(t){const n=t.project.metadata.preferredDevelopmentSandboxId;return typeof n=="string"&&n.trim()?n:null}function de(t,n){for(const r of["name","label","environmentName"]){const s=t[r];if(typeof s=="string"&&s.trim())return s}return n.length>18?n.slice(0,18):n}function ue(t){return t?.website?t.errors.database?"Unavailable":t.database?.status==="ready"?`Connected · ${t.database.provider}`:t.database?.status==="provisioning"?"Connecting…":"Not connected":"Set up the website first"}function je(t){const n="/ingress",r=t.indexOf(n);return r===-1?t:`/api${t.slice(r+n.length)||"/"}`}function J(t){return t.length>12?t.slice(0,12):t}function K(t){return t<1e3?`${Math.round(t)} ms`:`${(t/1e3).toFixed(t<1e4?2:1)} s`}function I(t){const n=Date.parse(t);return Number.isFinite(n)?new Date(n).toLocaleString():t}function he({accountBaseUrl:t,connection:n,project:r,taskCount:s,teamName:o,onBack:c,onNewTask:i,onTogglePinned:p,onUploadLocalProject:u}){const[l,h]=j.useState("source"),[m,a]=j.useState(null),[b,D]=j.useState(null),[v,q]=j.useState(!1),[R,z]=j.useState([]),[f,k]=j.useState(!1),[T,E]=j.useState(null),x=fe(r);j.useEffect(()=>{h("source")},[r.id]),j.useEffect(()=>{let w=!0;if(D(null),a(null),q(!1),z([]),E(null),!n)return k(!1),()=>{w=!1};k(!0);const X=x?pe(n,x):Promise.resolve(null),Y=r.kind==="local"?U.localProjectActions(n,r.project.id):Promise.resolve(null);return Promise.allSettled([X,Y]).then(([y,g])=>{if(!w)return;y.status==="fulfilled"&&y.value&&(a(y.value.project),D(y.value.workspace),q(y.value.workspaceUnavailable)),g.status==="fulfilled"&&g.value&&z(g.value.actions.map(ve));const N=[y,g].filter(Z=>Z.status==="rejected");N.length>0&&N.length===+!!x+ +(r.kind==="local")&&E(N[0]?.reason instanceof Error?N[0].reason.message:"Project details could not be loaded."),k(!1)}),()=>{w=!1}},[n,x?.projectId,x?.teamId,r]);const P=j.useMemo(()=>ge(ye(m),R),[m,R]),C=re(r,t),Q=be({hostedProject:m,project:r,repositoryUrl:C,taskCount:s,teamName:o});return e.jsxs("section",{"aria-label":`${r.project.name} project`,className:"project-detail-view",children:[e.jsxs("header",{className:"project-detail-header",children:[e.jsxs("div",{className:"project-detail-heading",children:[e.jsxs("button",{className:"project-detail-back",onClick:c,type:"button",children:[e.jsx(te,{"aria-hidden":"true",size:15}),e.jsx("span",{children:"Projects"})]}),e.jsx("h1",{children:r.project.name})]}),e.jsxs("div",{className:"project-detail-actions",children:[r.kind==="local"?e.jsxs("button",{onClick:()=>u(r),type:"button",children:[e.jsx(H,{"aria-hidden":"true",size:14}),e.jsx("span",{children:"Upload"})]}):null,C?e.jsxs("button",{onClick:()=>{S(C)},type:"button",children:[e.jsx(W,{"aria-hidden":"true",size:14}),e.jsx("span",{children:"Open repository"})]}):null,e.jsxs("button",{onClick:()=>i(r),type:"button",children:[e.jsx(F,{"aria-hidden":"true",size:14}),e.jsx("span",{children:"New task"})]}),e.jsx("button",{"aria-label":`${r.pinned?"Unpin":"Pin"} ${r.project.name}`,onClick:()=>p(r),title:r.pinned?"Unpin project":"Pin project",type:"button",children:r.pinned?e.jsx(_,{"aria-hidden":"true",size:14}):e.jsx(O,{"aria-hidden":"true",size:14})})]})]}),e.jsxs("div",{"aria-label":"Project detail",className:"project-detail-tabs",role:"tablist",children:[e.jsx("button",{"aria-selected":l==="source",onClick:()=>h("source"),role:"tab",type:"button",children:"Source"}),e.jsxs("button",{"aria-selected":l==="actions",onClick:()=>h("actions"),role:"tab",type:"button",children:["Project Actions",P.length>0?e.jsx("span",{children:P.length}):null]}),e.jsx("button",{"aria-selected":l==="environments",onClick:()=>h("environments"),role:"tab",type:"button",children:"Environments"}),e.jsx("button",{"aria-selected":l==="deployments",onClick:()=>h("deployments"),role:"tab",type:"button",children:"Deployments"}),e.jsx("button",{"aria-selected":l==="requests",onClick:()=>h("requests"),role:"tab",type:"button",children:"Requests"}),e.jsx("button",{"aria-selected":l==="website",onClick:()=>h("website"),role:"tab",type:"button",children:"Website"})]}),T?e.jsx("div",{className:"project-detail-error",role:"alert",children:T}):null,l==="source"?e.jsx(me,{loading:f,rows:Q}):l==="actions"?e.jsx(xe,{actions:P,loading:f}):l==="environments"?e.jsx(ne,{linked:!!x,loading:f,unavailable:v,workspace:b}):l==="deployments"?e.jsx(se,{linked:!!x,loading:f,unavailable:v,workspace:b}):l==="requests"?e.jsx(ie,{linked:!!x,loading:f,unavailable:v,workspace:b}):e.jsx(oe,{linked:!!x,loading:f,unavailable:v,workspace:b})]})}async function pe(t,n){try{const r=await U.getSandboxProjectWorkspace(t,n.projectId,{teamId:n.teamId});return{project:r.project,workspace:r,workspaceUnavailable:!1}}catch{return{project:(await U.getSandboxProject(t,n.projectId,{teamId:n.teamId})).project,workspace:null,workspaceUnavailable:!0}}}function me({loading:t,rows:n}){return e.jsx("div",{className:"project-detail-table-frame",children:e.jsxs("table",{className:"project-detail-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Setting"}),e.jsx("th",{children:"Value"})]})}),e.jsx("tbody",{children:n.map(([r,s])=>e.jsxs("tr",{children:[e.jsx("td",{children:r}),e.jsx("td",{children:t&&r==="Latest commit"?"Loading…":s})]},r))})]})})}function xe({actions:t,loading:n}){return n?e.jsx("div",{className:"project-detail-empty",children:"Loading Project Actions…"}):t.length===0?e.jsx("div",{className:"project-detail-empty",children:"No Project Actions are registered from this source."}):e.jsx("div",{className:"project-detail-table-frame",children:e.jsxs("table",{className:"project-detail-table actions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Action"}),e.jsx("th",{children:"Description"}),e.jsx("th",{children:"Source"})]})}),e.jsx("tbody",{children:t.map(r=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:r.id})}),e.jsx("td",{children:r.description??"No description"}),e.jsx("td",{children:r.source==="hosted"?"Hosted project":"Local source"})]},`${r.source}:${r.id}`))})]})})}function be(t){const{hostedProject:n,project:r,repositoryUrl:s,taskCount:o,teamName:c}=t,i=r.kind==="local"?r.project.linkedSandboxProject:null,p=n?.gitBranch??n?.defaultBranch??(r.kind==="cloud"?r.project.defaultBranch:i?.defaultBranch)??"Not set",u=n?Ne(n):i?.lastUploadedCommit??null,l=n?.sandboxManifestSyncedAt??(r.kind==="cloud"?r.project.syncedAt:i?.syncedAt)??null;return[["Repository",s?e.jsx("a",{href:s,onClick:h=>{h.preventDefault(),S(s)},children:L(s)}):r.kind==="local"?r.project.path:"Not available"],["Branch",p],["Latest commit",u?Se(u):"Not available"],["Last synced",l?ke(l):"Not available"],["Team",c??(r.kind==="cloud"?r.project.organizationName:null)??"Local only"],["Tasks",String(o)]]}function fe(t){if(t.kind==="cloud")return{projectId:t.project.id,teamId:t.project.teamId};const n=t.project.linkedSandboxProject;return n?{projectId:n.projectId,teamId:n.teamId}:null}function ye(t){const n=t?.sandboxActionRegistry?.actions;return Array.isArray(n)?n.flatMap(r=>{if(!r||typeof r!="object"||Array.isArray(r))return[];const s=r,o=typeof(s.id??s.name)=="string"?String(s.id??s.name).trim():"";return o?[{id:o,description:typeof s.description=="string"?s.description:null,source:"hosted"}]:[]}):[]}function ve(t){return{id:t.id,description:t.description??t.label??t.name??null,source:"local"}}function ge(t,n){const r=new Map;for(const s of[...t,...n])r.has(s.id)||r.set(s.id,s);return Array.from(r.values()).sort((s,o)=>s.id.localeCompare(o.id))}function Ne(t){return[t.sourceConfig.commitSha,t.sourceConfig.sourceCommitSha,t.metadata.commitSha,t.metadata.sourceCommitSha,t.templateRemoteSha].find(r=>typeof r=="string"&&!!r.trim())??null}function Se(t){return t.length>12?t.slice(0,12):t}function ke(t){const n=Date.parse(t);return Number.isFinite(n)?new Date(n).toLocaleString():t}const Pe=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"});function Ie({accountBaseUrl:t,connection:n,projects:r,taskCountByProjectId:s,teamName:o,onNewCloudProject:c,onNewTask:i,onTogglePinned:p,onUploadLocalProject:u}){const[l,h]=j.useState(null),m=j.useMemo(()=>r.find(a=>a.id===l)??null,[r,l]);return j.useEffect(()=>{l&&!m&&h(null)},[m,l]),m?e.jsx(he,{accountBaseUrl:t,connection:n,onBack:()=>h(null),onNewTask:i,onTogglePinned:p,onUploadLocalProject:u,project:m,taskCount:s[m.id]??0,teamName:o}):e.jsxs("section",{"aria-label":"Projects",className:"projects-page",children:[e.jsxs("header",{className:"projects-page-header",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Projects"}),e.jsxs("p",{children:["Local projects on this device and hosted projects for ",o??"your active team","."]})]}),e.jsx("div",{className:"projects-cloud-actions",children:e.jsxs("button",{className:"projects-cloud-button",onClick:c,type:"button",children:[e.jsx(B,{"aria-hidden":"true",size:15}),e.jsx("span",{children:"New cloud project"})]})})]}),r.length===0?e.jsxs("div",{className:"projects-empty",children:[e.jsx(M,{"aria-hidden":"true",size:24}),e.jsx("h2",{children:"No projects yet"}),e.jsx("p",{children:"Create a hosted project for this team."})]}):e.jsx("div",{className:"projects-table-frame",children:e.jsxs("table",{className:"projects-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Project"}),e.jsx("th",{scope:"col",children:"Location"}),e.jsx("th",{scope:"col",children:"Tasks"}),e.jsx("th",{scope:"col",children:"Updated"}),e.jsx("th",{"aria-label":"Project actions",scope:"col"})]})}),e.jsx("tbody",{children:r.map(a=>{const b=a.project.updatedAt;return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsxs("button",{className:"projects-name-button",onClick:()=>h(a.id),type:"button",children:[e.jsx("span",{className:`projects-kind-icon ${Ce(a)}`,children:A(a)?e.jsx(M,{"aria-hidden":"true",size:16}):e.jsx(B,{"aria-hidden":"true",size:16})}),e.jsx("span",{className:"projects-name-copy",children:e.jsx("strong",{children:a.project.name})})]})}),e.jsx("td",{children:A(a)?e.jsxs("div",{className:"projects-location-cell",children:[e.jsx("span",{className:"projects-location",title:a.project.path,children:a.project.path}),e.jsxs("button",{className:"projects-upload-button",onClick:()=>u(a),title:`Upload ${a.project.name} to the active team`,type:"button",children:[e.jsx(H,{"aria-hidden":"true",size:13}),e.jsx("span",{children:"Upload"})]})]}):e.jsx(we,{accountBaseUrl:t,project:a})}),e.jsx("td",{children:s[a.id]??0}),e.jsx("td",{children:b?e.jsx("time",{dateTime:b,children:Ue(b)}):e.jsx("span",{className:"projects-table-muted",children:"—"})}),e.jsx("td",{children:e.jsxs("div",{className:"projects-row-actions",children:[e.jsx("button",{"aria-label":`Start a new task in ${a.project.name}`,onClick:()=>i(a),title:"New task",type:"button",children:e.jsx(F,{"aria-hidden":"true",size:15})}),e.jsx("button",{"aria-label":`${a.pinned?"Unpin":"Pin"} ${a.project.name}`,onClick:()=>p(a),title:a.pinned?"Unpin project":"Pin project",type:"button",children:a.pinned?e.jsx(_,{"aria-hidden":"true",size:15}):e.jsx(O,{"aria-hidden":"true",size:15})})]})})]},a.id)})})]})})]})}function Ce(t){return A(t)?t.project.linkedSandboxProject&&t.cloudLinkTrusted?"linked":"desktop":"cloud"}function we({accountBaseUrl:t,project:n}){const r=V(n,t);return r?e.jsxs("a",{className:"projects-location-link",href:r,onClick:s=>{s.preventDefault(),S(r)},title:r,children:[e.jsx("span",{children:L(r)}),e.jsx(W,{"aria-hidden":"true",size:12})]}):e.jsx("span",{className:"projects-table-muted",children:"Repository unavailable"})}function Ue(t){const n=Date.parse(t);return Number.isFinite(n)?Pe.format(n):t}export{Ie as ProjectsPage};