openpond 0.0.51 → 0.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{app-layer-DCUTQ4TM.js → app-layer-T26MAAGI.js} +2 -2
- package/dist/chunks/{app-server-runtime-Q3IGU5YB.js → app-server-runtime-2P2727X6.js} +6 -6
- package/dist/chunks/{apps-JDRCDAPE.js → apps-7KLTYKHN.js} +2 -2
- package/dist/chunks/{chunk-LYEXNSCO.js → chunk-3UPQUD6Y.js} +2 -2
- package/dist/chunks/{chunk-3PYU3XCS.js → chunk-55KT7K5P.js} +1 -2
- package/dist/chunks/{chunk-PFNX5XOT.js → chunk-6QWTEC2D.js} +1 -1
- package/dist/chunks/{chunk-J4LLKY6E.js → chunk-C4DAHPVI.js} +1 -1
- package/dist/chunks/{chunk-IGSEFSMA.js → chunk-EIRW6Z6S.js} +1 -1
- package/dist/chunks/{chunk-V3HADQL5.js → chunk-FFD2YSZR.js} +1 -1
- package/dist/chunks/{chunk-R4PRXXTC.js → chunk-JSRCXDIL.js} +32 -32
- package/dist/chunks/{chunk-UDTHREHB.js → chunk-KNKZSVGO.js} +81 -8
- package/dist/chunks/{chunk-CSN3DLWJ.js → chunk-M2OSF2YN.js} +1 -1
- package/dist/chunks/{chunk-35OYRVVH.js → chunk-US7DOPAH.js} +19 -4
- package/dist/chunks/{cli-2FTM4SXH.js → cli-Z2CULBCU.js} +5 -5
- package/dist/chunks/{core-commands-5BRR7TU4.js → core-commands-SND555SC.js} +3 -3
- package/dist/chunks/{desktop-test-EQ2BGZOM.js → desktop-test-WSWXNSFS.js} +2 -2
- package/dist/chunks/{extension-V3NZ7MU7.js → extension-3IKF6YQE.js} +1 -1
- package/dist/chunks/{help-WJBMX37U.js → help-DHGNXUA4.js} +1 -1
- package/dist/chunks/{opchat-W7DSKNNB.js → opchat-XYKT5KKO.js} +2 -2
- package/dist/chunks/{organizations-RHOF5H4Z.js → organizations-HKVC4CSA.js} +4 -4
- package/dist/chunks/{profile-B62ZWPTQ.js → profile-PLWXQHKF.js} +2 -2
- package/dist/chunks/{project-agent-QA25HHDV.js → project-agent-JNSP56KG.js} +2 -2
- package/dist/chunks/{sandbox-command-JFEVPU4X.js → sandbox-command-Z6LNNSSL.js} +2 -2
- package/dist/chunks/{sandbox-template-GEWTAWAR.js → sandbox-template-FVW2UTI4.js} +3 -3
- package/dist/chunks/{src-P2BL3KCV.js → src-2TP42H76.js} +3 -3
- package/dist/chunks/{src-JOTV67WO.js → src-R5VKB33T.js} +387 -599
- package/dist/chunks/{teams-bot-ODSMRNE4.js → teams-bot-FNPT4Q2B.js} +2 -2
- package/dist/chunks/{workspaces-7YHBJG5P.js → workspaces-YLNB6DS7.js} +2 -2
- package/dist/cli.js +13 -13
- package/dist/web/assets/{AppDialog-DylZeiI-.js → AppDialog-BEKS_Ixr.js} +1 -1
- package/dist/web/assets/{AppsView-Bz6C0a1u.js → AppsView-CbuT2sT2.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-xXFxZP2-.js → BrowserSidebar-DgqVeW5u.js} +1 -1
- package/dist/web/assets/{CommandMenu-C9k5VdaR.js → CommandMenu-CQcaEB76.js} +1 -1
- package/dist/web/assets/{CommunityView-DcJlUNgd.js → CommunityView-CYX6iFcg.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-Yt3irJVo.js → ComposerCreateImproveStrip-DY4SQbL4.js} +1 -1
- package/dist/web/assets/{GetStartedView-BhD0Ij7c.js → GetStartedView-DnxeZaBB.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-B-OoSJYT.js → LabModelVersionDetailPage-DYTfYGWv.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-dqdSTmHG.js → LabSkillSidebar-BpD-kjP_.js} +1 -1
- package/dist/web/assets/{LabsRoute-BMPI4vB8.js → LabsRoute-DVC7eZCs.js} +3 -3
- package/dist/web/assets/{MainChatThread-B0ajKiNL.js → MainChatThread-DTiX_8MC.js} +2 -2
- package/dist/web/assets/{MainPane-COs4xUGo.js → MainPane-CNoHJkXy.js} +3 -3
- package/dist/web/assets/{MarkdownText-CzZ60aWs.js → MarkdownText-_JhfBcQL.js} +1 -1
- package/dist/web/assets/{Messages-DGrK4iIj.js → Messages-Bo0-Uvcz.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-BkpgGLSO.js → NativeSkillSidebar-CHQ87FW2.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-BOdCdNcG.js → NewProjectDialog-B-1KuU5u.js} +1 -1
- package/dist/web/assets/{OutputsPage-CSBWIFdi.js → OutputsPage-BSimpEpA.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-PZR6NYJj.js → RightChatPanelStack-B8ZOyuFO.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-WXLnwju_.js → ScheduledWorkPage-Blwy1G8r.js} +1 -1
- package/dist/web/assets/{SettingsView-CQJoEx-y.js → SettingsView-CTLTakyn.js} +3 -3
- package/dist/web/assets/{TeamChatView-BRnuD-lV.js → TeamChatView-dN3fUCbZ.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-B5m8j4_C.js → TerminalOverlay-CPVGeO7U.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-CA1rt7XZ.js → TrainingCreationPanel-ettNNJBP.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-C0p3GP1n.js → TrainingDraftPanel-DUJBuII1.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CpIKj4p-.js → UsageSettingsSection-BOZR3JE_.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-BXk8mdZB.js → WorkspaceDiffPanel-99MjzMkW.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-BO60uNVj.js → WorkspaceEnvironmentMenu-C3s3mTyu.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-hWBfhgaP.js → WorkspaceGitDialogs-BvurXjNP.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-ULPyacH8.js → WorkspaceMonacoEditor-BCXg9mBQ.js} +3 -3
- package/dist/web/assets/{arrow-up-right-CkfCgokz.js → arrow-up-right-DRIT5z3q.js} +1 -1
- package/dist/web/assets/{chevron-up-B5URpgIH.js → chevron-up-Hglu-Zx3.js} +1 -1
- package/dist/web/assets/{circle-alert-CAvjRdlQ.js → circle-alert-Crh3Zr2m.js} +1 -1
- package/dist/web/assets/{cloud-upload-DeQEwz1o.js → cloud-upload-mSm9KIL4.js} +1 -1
- package/dist/web/assets/{cssMode-B4V5a3OX.js → cssMode-CkQ4x6JA.js} +1 -1
- package/dist/web/assets/{folder-DgS_U9Lq.js → folder-DMeODEQJ.js} +1 -1
- package/dist/web/assets/{folder-git-2-BTtbxKWf.js → folder-git-2-B8TV5i0V.js} +1 -1
- package/dist/web/assets/{folder-open-CqjIkaDK.js → folder-open-DXaun_C3.js} +1 -1
- package/dist/web/assets/{folder-plus-CsS0KPW5.js → folder-plus-CUbTwu82.js} +1 -1
- package/dist/web/assets/{git-branch-BN2ijBYt.js → git-branch-CUlgF0kK.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-CVsl4u1O.js → git-commit-horizontal-DAQfyhbS.js} +1 -1
- package/dist/web/assets/{htmlMode-DRksGWJA.js → htmlMode-BfyAplZo.js} +1 -1
- package/dist/web/assets/index-Blindd8c.js +1 -0
- package/dist/web/assets/{index-Cxq5q-6B.js → index-CDJX5ZxL.js} +3 -3
- package/dist/web/assets/{info-DwVXRQli.js → info-Ll3PkeGE.js} +1 -1
- package/dist/web/assets/{jsonMode-eJvgtAy-.js → jsonMode-C9Vibh0P.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-DCk7zUI-.js → lspLanguageFeatures-CFoA9--Z.js} +1 -1
- package/dist/web/assets/{monaco.contribution-B02C5mDa.js → monaco.contribution-C2q-tDuk.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DWVguH46.js → monaco.contribution-C8tRjUqy.js} +2 -2
- package/dist/web/assets/{monaco.contribution-WGT1eYvk.js → monaco.contribution-Co4ZPnCC.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CPnN-lZN.js → monaco.contribution-vWDjhuCI.js} +2 -2
- package/dist/web/assets/{play-DGCzapdE.js → play-lC5KpmRD.js} +1 -1
- package/dist/web/assets/{python-DRPzruv8.js → python-I5xkyvMs.js} +1 -1
- package/dist/web/assets/{refresh-cw-BKF4NhDI.js → refresh-cw-8a_wz4tX.js} +1 -1
- package/dist/web/assets/{save-DQXtfx_4.js → save-Dj9ex3Ce.js} +1 -1
- package/dist/web/assets/{square-Dp5eGICS.js → square-DfEM9XgY.js} +1 -1
- package/dist/web/assets/{square-pen-j-mZ_UkO.js → square-pen-CgX3HoJ6.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-wDmA5YPb.js → toggleHighContrast-BkNzz1Bg.js} +1 -1
- package/dist/web/assets/{tsMode-DELTv39m.js → tsMode-CNwaV0ZJ.js} +1 -1
- package/dist/web/assets/{upload-_rNli8wK.js → upload-Co5zYY9Z.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-DRVUfTbv.js → useLocalAgentSchedules-QY4_XS2F.js} +1 -1
- package/dist/web/assets/{wifi-off-uKPwd8A7.js → wifi-off-CFzyn7Tf.js} +1 -1
- package/dist/web/assets/{workers-CXbluSB3.js → workers-DqFxl1zu.js} +1 -1
- package/dist/web/assets/{yaml-BMqi-3ui.js → yaml-Bbm66uDK.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-SKvMOpII.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as L,r as p,j as a,C as oe,P as ce,n as Z,aE as ue,X as de,aW as I,aX as j,aY as he,aR as T}from"./index-
|
|
1
|
+
import{c as L,r as p,j as a,C as oe,P as ce,n as Z,aE as ue,X as de,aW as I,aX as j,aY as he,aR as T}from"./index-CDJX5ZxL.js";const fe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],kn=L("arrow-right",fe);const pe=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],wn=L("bot",pe);const me=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],vn=L("clipboard",me);const ge=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],yn=L("code-xml",ge);const ke=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],bn=L("file",ke);const we=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],xn=L("minimize-2",we);const ve=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],In=L("pause",ve);const ye=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],jn=L("trash-2",ye);const be=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Ln=L("workflow",be);function Pn({value:e,options:r,disabled:n,compact:t,className:s,icon:i,placement:l="bottom",label:c,tooltip:o,searchable:u=!1,onChange:m}){const[f,v]=p.useState(!1),[w,k]=p.useState(""),d=p.useRef(null),b=r.find(h=>h.value===e)??r[0],g=w.trim().toLowerCase(),y=g?r.filter(h=>[h.label,h.shortLabel,h.description].some(x=>x?.toLowerCase().includes(g))):r;return p.useEffect(()=>{if(!f){k("");return}function h(P){d.current?.contains(P.target)||v(!1)}function x(P){P.key==="Escape"&&v(!1)}return document.addEventListener("pointerdown",h),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",x)}},[f]),a.jsxs("div",{className:`dropdown-select ${s??""} ${t?"compact":""} ${l==="top"?"open-up":""}`,"data-tooltip":o,ref:d,children:[a.jsxs("button",{type:"button",className:`dropdown-trigger ${f?"active":""}`,disabled:n,"aria-label":c,"aria-haspopup":"menu","aria-expanded":f,onClick:()=>v(h=>!h),children:[i,a.jsx("span",{children:b?.shortLabel??b?.label??e}),a.jsx(oe,{size:14})]}),f&&a.jsxs("div",{className:"dropdown-menu",role:"menu",children:[u?a.jsxs("label",{className:"dropdown-search",onClick:h=>h.stopPropagation(),children:[a.jsxs("span",{className:"sr-only",children:["Search ",c]}),a.jsx("input",{autoFocus:!0,placeholder:`Search ${c.toLowerCase()}`,value:w,onChange:h=>k(h.target.value)})]}):null,y.map(h=>a.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h.value===e,disabled:h.disabled,className:[h.value===e?"selected":"",h.separatorBefore?"separator-before":"",h.icon?"with-icon":""].filter(Boolean).join(" "),onClick:()=>{h.disabled||(m(h.value),k(""),v(!1))},children:[a.jsxs("span",{children:[h.icon==="plus"?a.jsx(ce,{size:13}):null,a.jsx("span",{children:h.label})]}),h.description&&a.jsx("small",{children:h.description})]},h.value)),y.length?null:a.jsx("div",{className:"dropdown-empty",children:"No matches"})]})]})}const U=new Map,xe=15e3;function Y(e,r,n){const t=G(e),[s,i]=p.useState(()=>t.getUrl(r,n));return p.useEffect(()=>{let l=!1;return i(t.getUrl(r,n)),t.loadUrl(r,n).then(c=>{l||i(c)}),()=>{l=!0}},[r,n,t]),s}function G(e){const[,r]=p.useState(0),n=p.useCallback((i,l)=>!e||!i||!l?null:B(D(e,i,l)),[e]),t=p.useCallback(async(i,l)=>{if(!e||!i||!l)return null;const c=D(e,i,l),o=B(c);if(o)return o;const u=U.get(c);if(u?.state==="loading")return u.promise;const m=Z.signWorkspaceImageUrl(e,{appId:i,path:l}).then(f=>(U.set(c,{state:"ready",url:f.url,expiresAt:f.expiresAt}),r(v=>v+1),f.url)).catch(()=>(U.delete(c),r(f=>f+1),null));return U.set(c,{state:"loading",promise:m}),m},[e]),s=p.useCallback((i,l)=>{t(i,l)},[t]);return p.useMemo(()=>({ensureUrl:s,getUrl:n,loadUrl:t}),[s,n,t])}function B(e){const r=U.get(e);return r?.state!=="ready"?null:r.expiresAt<=Date.now()+xe?(U.delete(e),null):r.url}function D(e,r,n){return`${e.serverUrl}\0${e.token}\0${r}\0${n}`}function Ie({open:e,src:r,title:n,onClose:t}){const[s,i]=p.useState(!1);if(p.useEffect(()=>{if(!e)return;const o=u=>{u.key==="Escape"&&t()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,e]),p.useEffect(()=>{i(!1)},[r]),!e||!r)return null;const l=(()=>{const o=n.split("/").pop()?.trim();if(o&&/\.[A-Za-z0-9]+$/.test(o))return o;try{const m=new URL(r,window.location.href).pathname.split("/").pop()?.trim();if(m&&/\.[A-Za-z0-9]+$/.test(m))return m}catch{}return"image.png"})(),c=()=>{const o=document.createElement("a");o.href=r,o.download=l,o.rel="noopener",document.body.appendChild(o),o.click(),o.remove()};return a.jsx("div",{className:"image-lightbox-backdrop",role:"presentation",onMouseDown:o=>{o.target===o.currentTarget&&t()},children:a.jsxs("section",{"aria-label":n?`Image preview: ${n}`:"Image preview","aria-modal":"true",className:"image-lightbox-dialog",role:"dialog",children:[a.jsxs("header",{className:"image-lightbox-header",children:[a.jsx("span",{title:n,children:n}),a.jsxs("div",{className:"image-lightbox-actions",children:[a.jsx("button",{type:"button","aria-label":"Download image",title:"Download",onClick:c,children:a.jsx(ue,{size:16})}),a.jsx("button",{type:"button","aria-label":"Close image preview",title:"Close",onClick:t,children:a.jsx(de,{size:16})})]})]}),a.jsx("div",{className:"image-lightbox-frame",children:s?a.jsx("div",{className:"image-lightbox-error",children:"Image preview unavailable"}):a.jsx("img",{alt:n||"Image preview",decoding:"async",draggable:!1,src:r,onError:()=>i(!0)})})]})})}const je=new Set(["bash","c","cc","cjs","cpp","css","csv","env","gif","go","graphql","h","hpp","html","ico","java","jpeg","jpg","js","json","jsx","lock","lockb","md","mdx","m4v","mjs","mov","mp4","png","py","rs","scss","sh","sql","svg","toml","ts","tsx","txt","webp","webm","yaml","yml","zsh"]),Le=new Set(["AGENTS.md","Dockerfile","LICENSE","Makefile","README"]),O=String.raw`[A-Za-z0-9_.@+-]+`,Pe=new RegExp(String.raw`^(?:(?:\.{1,2}|~)?[\\/]|[A-Za-z]:[\\/])?(?:${O}[\\/])+${O}(?::\d+(?::\d+)?)?`),Me=new RegExp(String.raw`^${O}(?::\d+(?::\d+)?)?`),Ue=/^(?:workspace|sandbox):file:[^\s<>()]+/;function Mn({projectTargetDetail:e,projectTargetValue:r,workspaceRepoPath:n,workspaceTargetValue:t}){const s=n?.trim();return s||(t!=="local"||!r.startsWith("local:")?null:e.trim()||null)}function Ee(e,r,n={}){if(!Se(e[r-1]))return null;const t=e.slice(r),s=Ue.exec(t),i=s?null:Pe.exec(t),l=s||i?null:Me.exec(t),c=Q((s??i??l)?.[0]??"");if(!c)return null;const o=C(c,n);return o?{...o,end:r+c.length}:null}function C(e,r={}){const n=Q(e.trim().replace(/^['"`]+|['"`]+$/g,""));if(!n||/^https?:\/\//i.test(n))return null;const s=$e(Ne(n)).replace(/:\d+(?::\d+)?$/,"");return Re(s)?{displayPath:n,path:Ce(s,r.workspaceRootPath)}:null}function Ne(e){const r=/^(workspace|sandbox):file:(.*)$/i.exec(e);if(!r)return e;const n=r[1]?.toLowerCase();let t=r[2]??"";return n==="sandbox"&&(t=t.replace(/^\/workspace\/app\//,"").replace(/^\/workspace\//,"")),t}function $e(e){if(!/^file:\/\//i.test(e))return e;try{return decodeURIComponent(new URL(e).pathname)}catch{return e.replace(/^file:\/\//i,"")}}function Ce(e,r){let n=e.replace(/\\/g,"/").replace(/^\.\/+/,"");const t=r?.trim().replace(/\\/g,"/").replace(/\/+$/,"");if(!t)return n;n.startsWith(`${t}/`)&&(n=n.slice(t.length+1));const s=t.split("/").filter(Boolean).at(-1);return s&&n.startsWith(`${s}/`)&&(n=n.slice(s.length+1)),n}function Re(e){const r=e.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??e;if(Le.has(r)||r.startsWith(".")&&r.length>1)return!0;const n=r.includes(".")?r.split(".").at(-1)?.toLowerCase():null;return!!(n&&je.has(n))}function Se(e){return!e||/[\s([{<"'`]/.test(e)}function Q(e){return e.replace(/[.,;!?]+$/,"").replace(/[\])}]+$/,"")}const E=new Map,_e=15e3;function J(e,r){const n=ee(e),[t,s]=p.useState(()=>n.getUrl(r));return p.useEffect(()=>{let i=!1;return s(n.getUrl(r)),n.loadUrl(r).then(l=>{i||s(l)}),()=>{i=!0}},[r,n]),t}function ee(e){const[,r]=p.useState(0),n=p.useCallback(s=>!e||!s?null:q(X(e,s)),[e]),t=p.useCallback(async s=>{if(!e||!s)return null;const i=X(e,s),l=q(i);if(l)return l;const c=E.get(i);if(c?.state==="loading")return c.promise;const o=Z.signLocalImageUrl(e,{path:s}).then(u=>(E.set(i,{state:"ready",url:u.url,expiresAt:u.expiresAt}),r(m=>m+1),u.url)).catch(()=>(E.delete(i),r(u=>u+1),null));return E.set(i,{state:"loading",promise:o}),o},[e]);return p.useMemo(()=>({getUrl:n,loadUrl:t}),[n,t])}function q(e){const r=E.get(e);return r?.state!=="ready"?null:r.expiresAt<=Date.now()+_e?(E.delete(e),null):r.url}function X(e,r){return`${e.serverUrl}\0${e.token}\0${r}`}function ne(e){const r=e.replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),n=[];let t=[],s=[],i=[],l=!1,c,o=null,u,m=0;function f(){t.length!==0&&(n.push({type:"paragraph",content:t.join(`
|
|
4
4
|
`).trim()}),t=[])}function v(){s.length!==0&&(n.push({type:"blockquote",content:s.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as _,r as d,n as re,j as n,bX as M,bY as Te,a2 as _e,F as k,C as z,S as le,aW as ze,Y as Ee,bU as Pe,an as Le,$ as F,bb as Ue,bZ as Fe,b_ as Be,aR as Oe,b$ as Ge,c0 as W,b1 as We}from"./index-Cxq5q-6B.js";import{C as De}from"./chevron-up-B5URpgIH.js";import{I as B,f as qe,e as Ke}from"./MainPane-COs4xUGo.js";import{d as Ve,b as ce,W as He,n as Qe,I as oe,e as de,u as Ye,r as ue,B as he}from"./MarkdownText-CzZ60aWs.js";import{A as U}from"./arrow-up-right-CkfCgokz.js";import{G as Xe}from"./git-branch-BN2ijBYt.js";import{C as Ze}from"./circle-alert-CAvjRdlQ.js";import{F as Je}from"./folder-open-CqjIkaDK.js";import{P as et}from"./play-DGCzapdE.js";import{S as tt}from"./square-pen-j-mZ_UkO.js";const nt=[["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"}]],st=_("circle-dashed",nt);const it=[["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"}]],at=_("copy",it);const rt=[["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"}]],lt=_("lightbulb",rt);const ct=[["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"}]],ot=_("circle-x",ct);function dt(e){const t=xt(e);if(t)return t;const s=gt();let i="";const a=[],r=[],l=[];for(const h of e){if(!i&&h.label&&(i=h.label),It(r,h.label),Tt(l,h),h.kind==="command"&&h.content){bt(s,vt(h.content));continue}jt(s,h)||Mt(a,h.label)}const c=[...yt(s),...r,...l],o=s.runCount>0?At(s.runCount):"",u=Pt(a),f=(e.length===1&&e[0]?.kind==="command"&&e[0].content&&r.length===0&&l.length===0?me(e[0].content,"completed"):null)||Rt(c,o)||u||i||"Ran command";return{kind:kt(s,o),text:f}}function me(e,t="completed"){const s=xe(e);if(s.length===0)return null;const i=t==="running"||t==="pending";if(s.some(be))return i?"Running shell command":"Ran shell command";const a=fe(s);if(!a)return null;const[r,l]=a;if(r==="cat"){const o=v(l);return o.length===0?i?"Reading standard input":"Read standard input":`${i?"Reading":"Read"} ${y(o)}`}if(r==="sed")return pt(Ut([r,...l]),i);if(r==="rg")return Ft([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"?v(l):[];return o.length===0?i?"Listing files":"Listed files":`${i?"Listing":"Listed"} files in ${y(o)}`}if(["head","tail","nl","wc","awk","jq"].includes(r)){const o=ge(r,l);return o.length===0?i?`Running ${r}`:`Ran ${r}`:`${i?"Reading":"Read"} ${y(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 ut(l,i);if(ft(r))return ht(r,l,i);if(pe(r))return mt(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 ut(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 ht(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 mt(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 ft(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 pt(e,t){return!e||!t?e:e.startsWith("Read ")?`Reading ${e.slice(5)}`:e.startsWith("Run ")?`Running ${e.slice(4)}`:e}function gt(){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 xt(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?D(s,"received"):null,i>0?D(i,"sent"):null].filter(r=>!!r);return{kind:"subagent",text:I(O(a))}}function D(e,t){return e===1?`child message ${t}`:`${e} child messages ${t}`}function bt(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 jt(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 St(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 vt(e){const t=xe(e);if(t.length===0||t.some(be))return{countedAsRun:!0};const s=fe(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(Ct(i,a)||pe(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=ge(i,a);return r.length>0?{countedAsRun:!1,readFiles:r}:{countedAsRun:!0}}function fe(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 Ct(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 pe(e){return["eslint","jest","playwright","prettier","tsc","vitest"].includes(e)}function ge(e,t){if(e==="cat"||e==="nl"||e==="head"||e==="tail"||e==="wc")return L(v(t));if(e==="sed"){const s=t.findIndex(i=>i!=="-n"&&!i.startsWith("--"));return L(s>=0?v(t.slice(s+1)):[])}return e==="awk"||e==="jq"?L(v(t.slice(1))):[]}function L(e){return e.filter(t=>!(!t||t==="."||t==="-"||/^\d+$/.test(t)))}function yt(e){const t=[],s=wt(e);s&&t.push(s),e.editCount>0&&t.push("made edits");const i=e.readFiles.size||e.readFileCount;return i>0&&t.push(K("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(K("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(...$t(e)),t}function $t(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 wt(e){const t=Nt(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 St(e,t,s){const i=t.openSession?.sessionId??(t.content.trim()||t.id),a=e.subagentStatuses.get(i);(!a||q(s)>q(a))&&e.subagentStatuses.set(i,s)}function Nt(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 q(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 kt(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 At(e){return e===1?"ran a command":`ran ${e} commands`}function K(e,t,s){return t===1?`${e} a ${s}`:`${e} ${t} ${s}s`}function Rt(e,t){return e.length===0?t?I(t):"":I(O(t?[...e,t]:e))}function Mt(e,t){const s=t.trim();s&&(e.includes(s)||e.push(s))}function It(e,t){const s=_t(t);!s||e.includes(s)||e.push(s)}function Tt(e,t){const s=t.receipt;if(!s)return;const i=`${s.status} receipt ${Et(s.id)} ${zt(s.totalUsd)}`;e.includes(i)||e.push(i)}function _t(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 zt(e){const t=e.trim();return t.startsWith("$")?t:`$${t}`}function Et(e){const t=e.trim();return t.length<=14?t:`${t.slice(0,6)}...${t.slice(-4)}`}function Pt(e){return e.length===0?"":I(O(e.map(Lt)))}function Lt(e){return e&&`${e[0].toLowerCase()}${e.slice(1)}`}function O(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 I(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function Ut(e){const t=e.findIndex((r,l)=>l>0&&r!=="-n"&&!r.startsWith("--")),s=t>=0?e[t]??"":"",i=t>=0?v(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 ${y(i)}`:`Read ${c}`}return i.length>0?`Read ${y(i)} with sed`:"Run sed"}function Ft(e,t=!1){const s=e.slice(1);if(s.includes("--files")){const l=v(s.filter(c=>c!=="--files"));return l.length>0?`${t?"Listing":"Listed"} files matching ${y(l)}`:t?"Listing files":"Listed files"}const i=v(s),a=i[0],r=i.slice(1);return a?r.length>0?`${t?"Searching":"Searched"} for ${V(a)} in ${y(r)}`:`${t?"Searching":"Searched"} for ${V(a)}`:t?"Searching files":"Searched files"}function xe(e){return(e.match(/"([^"\\]|\\.)*"|'[^']*'|[^\s]+/g)??[]).map(s=>Bt(s)).filter(Boolean)}function Bt(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function be(e){return["|","&&","||",";",">",">>","<","(",")"].includes(e)}function v(e){const t=[];for(let s=0;s<e.length;s+=1){const i=e[s];if(!i.startsWith("-")){t.push(i);continue}Ot(i)&&s+1<e.length&&(s+=1)}return t}function Ot(e){return["-e","-f","-g","--glob","--type","-t","--context","-C","-A","-B","-m","-n","-c"].includes(e)}function y(e){return e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e[0]} and ${e.length-1} more`}function V(e){return`"${e}"`}function Gt(e,t){return new Set(e.filter(s=>!t.has(s.id)).map(s=>s.id))}function js(e,t){const s=d.useRef({scopeKey:t,ids:new Set(e.map(r=>r.id)),initialized:e.length>0}),i=s.current.scopeKey===t,a=i&&s.current.initialized?Gt(e,s.current.ids):new Set;return d.useLayoutEffect(()=>{s.current={scopeKey:t,ids:new Set(e.map(r=>r.id)),initialized:i&&s.current.initialized?!0:e.length>0}},[e,i,t]),a}const S=new Map,Wt=15e3;function Dt(e,t){const s=qt(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 qt(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:H(Q(e,a)),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;const r=Q(e,a),l=H(r);if(l)return l;const c=S.get(r);if(c?.state==="loading")return c.promise;const o=re.signChatAttachmentImageUrl(e,a).then(u=>(S.set(r,{state:"ready",url:u.url,expiresAt:u.expiresAt}),t(m=>m+1),u.url)).catch(()=>(S.delete(r),t(u=>u+1),null));return S.set(r,{state:"loading",promise:o}),o},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function H(e){const t=S.get(e);return t?.state!=="ready"?null:t.expiresAt<=Date.now()+Wt?(S.delete(e),null):t.url}function Q(e,t){return[e.serverUrl,e.token,t.sessionId,t.turnId,t.attachmentId,t.storageName,t.contentType].join("\0")}const Kt=64,Vt=120,Ht=210,Qt=360,Yt=40,Xt=120,Zt=600,Jt=64,Y=16;function en(e,t,s=0){if(e<=0)return{characterCount:0,remainder:0};const i=e>Zt?Qt:e>Xt?Ht:e>Yt?Vt:Kt,a=s+Math.min(Math.max(t,0),Jt)*i/1e3,r=Math.min(e,Math.floor(a));return{characterCount:r,remainder:a-r}}function je(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 X(){return typeof window<"u"&&typeof window.matchMedia=="function"&&typeof document<"u"&&document.visibilityState==="visible"&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}function tn(e,t,s){return t&&s?je("",e,1):e}function nn(e,t=!1){const[s,i]=d.useState(()=>tn(e,t,X())),a=d.useRef(s),r=d.useRef(e),l=d.useRef(null),c=d.useRef(null),o=d.useRef(0);return d.useEffect(()=>{if(r.current=e,!X()||!e.startsWith(a.current)){l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=e,i(e);return}if(a.current.length===e.length||l.current!==null)return;const u=()=>{const m=a.current,f=r.current,h=performance.now();if(!f.startsWith(m)){a.current=f,i(f),l.current=null,c.current=null,o.current=0;return}const x=f.length-m.length;if(x===0){l.current=null,c.current=null,o.current=0;return}const $=c.current===null?16:h-c.current,j=en(x,$,o.current);if(c.current=h,o.current=j.remainder,j.characterCount>0){const p=je(m,f,j.characterCount);a.current=p,i(p)}l.current=window.setTimeout(u,Y)};l.current=window.setTimeout(u,Y)},[e]),d.useEffect(()=>{const u=()=>{document.visibilityState!=="visible"&&(l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=r.current,i(r.current))};return document.addEventListener("visibilitychange",u),()=>{document.removeEventListener("visibilitychange",u),l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[]),s}function sn({animateInitialContent:e=!1,content:t,...s}){const i=nn(t,e),a=Ve(i,i.length===t.length);return n.jsx(ce,{...s,content:a})}function an({actionRun:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i=null}){const a=on(e.status),r=dn(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(cn,{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 Z(e){return e.implementationType==="openpond-profile-action"}function rn(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&&!Te(e.title)?M({actionId:e.actionName,label:e.title}):M({actionId:e.actionName})}function ln(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 cn({refItem:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i}){const a=s?Qe(e.target,{workspaceRootPath:i}):null,r=un(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(U,{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(U,{size:13})})]})}function on(e){return e==="completed"?_e:e==="failed"?ot:st}function dn(e){const t=[];return e.implementationType&&t.push({label:"Type",value:e.implementationType,icon:n.jsx(He,{size:12})}),e.runId&&t.push({label:"Run",value:e.runId,icon:n.jsx(k,{size:12})}),e.sandboxId&&t.push({label:"Sandbox",value:e.sandboxId,icon:n.jsx(k,{size:12})}),e.sourceRef&&t.push({label:"Source",value:e.sourceRef,icon:n.jsx(Xe,{size:12})}),e.manifestHash&&t.push({label:"Manifest",value:e.manifestHash,icon:n.jsx(k,{size:12})}),t}function un(e){return/^https?:\/\//i.test(e)}const N=new Map,hn=15e3;function mn(e,t){const s=fn(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 fn(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:J(ee(e,a)),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;const r=ee(e,a),l=J(r);if(l)return l;const c=N.get(r);if(c?.state==="loading")return c.promise;const o=re.signLocalVideoUrl(e,{path:a}).then(u=>(N.set(r,{state:"ready",url:u.url,expiresAt:u.expiresAt}),t(m=>m+1),u.url)).catch(()=>(N.delete(r),t(u=>u+1),null));return N.set(r,{state:"loading",promise:o}),o},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function J(e){const t=N.get(e);return t?.state!=="ready"?null:t.expiresAt<=Date.now()+hn?(N.delete(e),null):t.url}function ee(e,t){return`${e.serverUrl}\0${e.token}\0${t}`}function pn(e,t){return{toolCount:e.reduce((i,a)=>i+(te(a)?0:1),0),toolsExpanded:t,visibleActivities:t?e.filter(i=>!te(i)):[]}}function te(e){return e.kind==="reasoning"}function gn(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 xn=4;function bn({onOpenSession:e,onShowAll:t,sessions:s}){const i=s.slice(0,xn),a=Math.max(0,s.length-i.length),r=s.map(Ce).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(ve,{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 ve({className:e="",onOpenSession:t,openSession:s}){const i=$e(s.roleId),a=Cn(s.status),r=`Open ${Ce(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(jn,{roleId:i})})}function jn({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 vn(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 Ce(e){const t=`${ye(e.roleId)} subagent`,s=e.status?.replace(/_/g," ").trim();return s?`${t} (${s})`:t}function ye(e){return $e(e).split(/[-_]+/).filter(Boolean).map(s=>s.slice(0,1).toUpperCase()+s.slice(1)).join(" ")||"Subagent"}function $e(e){const t=e?.trim().toLowerCase()||"subagent";return/^[a-z][a-z0-9_-]*$/.test(t)?t:"subagent"}function Cn(e){const t=e?.trim().toLowerCase()||"unknown";return/^[a-z][a-z0-9_-]*$/.test(t)?t:"unknown"}const we=5,yn=280;function $n({activeWorkspaceAppId:e,connection:t,message:s,onOpenFileInSidebar:i,onOpenSession:a}){const r=s.activities??[],[l,c]=d.useState(!1),[o,u]=d.useState(null),m=d.useId(),f=d.useMemo(()=>dt(r),[r]),h=d.useMemo(()=>pn(r,l),[r,l]),x=r.find(g=>g.imagePreview)?.imagePreview??null,$=s.deliverables??[],j=G(o,t,e),p=s.traceState==="running",A=s.traceState==="failed"||s.traceState==="interrupted",E=gn(s.traceStartedAt,s.traceCompletedAt),w=In(f.text,s.traceState,E,r),C=vn(r);return r.length>0&&r.every(g=>g.subagentMessage)?n.jsx(An,{activities:r}):n.jsxs("article",{className:`activity-group work-trace ${p?"running":"settled"}`,children:[n.jsxs("div",{className:"activity-summary-row",children:[h.toolCount>0?n.jsxs("button",{type:"button","aria-controls":m,"aria-expanded":h.toolsExpanded,className:`activity-summary ${A?"danger":""} ${p?"working":""}`,onClick:()=>c(g=>!g),children:[x?n.jsx(se,{activeWorkspaceAppId:e,connection:t,image:x}):n.jsx(ie,{kind:f.kind}),n.jsx(ne,{summary:w}),n.jsx(z,{className:`activity-summary-toggle ${h.toolsExpanded?"expanded":""}`,size:14})]}):n.jsxs("div",{className:`activity-summary static ${A?"danger":""} ${p?"working":""}`,children:[x?n.jsx(se,{activeWorkspaceAppId:e,connection:t,image:x}):n.jsx(ie,{kind:f.kind}),n.jsx(ne,{summary:w})]}),C.length>0&&a?n.jsx(bn,{onOpenSession:a,onShowAll:()=>c(!0),sessions:C}):null]}),$.length>0?n.jsx(Sn,{artifacts:$,connection:t,onOpenFileInSidebar:i}):null,h.visibleActivities.length>0?n.jsx("div",{className:"work-trace-flow",id:m,children:h.visibleActivities.map(g=>n.jsx(wn,{activeWorkspaceAppId:e,activity:g,connection:t,onOpenImage:u,onOpenSession:a},g.id))}):null,n.jsx(oe,{open:!!j,src:j,title:o?.path??"",onClose:()=>u(null)})]})}function wn({activeWorkspaceAppId:e,activity:t,connection:s,onOpenImage:i,onOpenSession:a}){const[r,l]=d.useState(!1),c=d.useId(),o=G(t.imagePreview??null,s,e);return t.subagentMessage?n.jsx(Ne,{activity:t}):n.jsxs("div",{className:`activity-tool-row ${t.controlKind==="turn_aborted"?"danger":""}`,children:[n.jsxs("button",{type:"button","aria-controls":c,"aria-expanded":r,className:"activity-tool-summary",onClick:()=>l(u=>!u),children:[t.kind==="command"?n.jsx(le,{"aria-hidden":!0,className:"activity-tool-kind-icon",size:12}):null,n.jsx("span",{children:_n(t)}),n.jsx(z,{className:`activity-tool-toggle ${r?"expanded":""}`,size:13})]}),r?n.jsxs("div",{className:"activity-tool-details",id:c,children:[t.kind==="command"&&t.content?n.jsx(zn,{command:t.content,exitCode:t.terminal?.exitCode,output:t.detail,state:t.state}):t.content?Bn(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{c as _,r as d,n as re,j as n,bX as M,bY as Te,a2 as _e,F as k,C as z,S as le,aW as ze,Y as Ee,bU as Pe,an as Le,$ as F,bb as Ue,bZ as Fe,b_ as Be,aR as Oe,b$ as Ge,c0 as W,b1 as We}from"./index-CDJX5ZxL.js";import{C as De}from"./chevron-up-Hglu-Zx3.js";import{I as B,f as qe,e as Ke}from"./MainPane-CNoHJkXy.js";import{d as Ve,b as ce,W as He,n as Qe,I as oe,e as de,u as Ye,r as ue,B as he}from"./MarkdownText-_JhfBcQL.js";import{A as U}from"./arrow-up-right-DRIT5z3q.js";import{G as Xe}from"./git-branch-CUlgF0kK.js";import{C as Ze}from"./circle-alert-Crh3Zr2m.js";import{F as Je}from"./folder-open-DXaun_C3.js";import{P as et}from"./play-lC5KpmRD.js";import{S as tt}from"./square-pen-CgX3HoJ6.js";const nt=[["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"}]],st=_("circle-dashed",nt);const it=[["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"}]],at=_("copy",it);const rt=[["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"}]],lt=_("lightbulb",rt);const ct=[["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"}]],ot=_("circle-x",ct);function dt(e){const t=xt(e);if(t)return t;const s=gt();let i="";const a=[],r=[],l=[];for(const h of e){if(!i&&h.label&&(i=h.label),It(r,h.label),Tt(l,h),h.kind==="command"&&h.content){bt(s,vt(h.content));continue}jt(s,h)||Mt(a,h.label)}const c=[...yt(s),...r,...l],o=s.runCount>0?At(s.runCount):"",u=Pt(a),f=(e.length===1&&e[0]?.kind==="command"&&e[0].content&&r.length===0&&l.length===0?me(e[0].content,"completed"):null)||Rt(c,o)||u||i||"Ran command";return{kind:kt(s,o),text:f}}function me(e,t="completed"){const s=xe(e);if(s.length===0)return null;const i=t==="running"||t==="pending";if(s.some(be))return i?"Running shell command":"Ran shell command";const a=fe(s);if(!a)return null;const[r,l]=a;if(r==="cat"){const o=v(l);return o.length===0?i?"Reading standard input":"Read standard input":`${i?"Reading":"Read"} ${y(o)}`}if(r==="sed")return pt(Ut([r,...l]),i);if(r==="rg")return Ft([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"?v(l):[];return o.length===0?i?"Listing files":"Listed files":`${i?"Listing":"Listed"} files in ${y(o)}`}if(["head","tail","nl","wc","awk","jq"].includes(r)){const o=ge(r,l);return o.length===0?i?`Running ${r}`:`Ran ${r}`:`${i?"Reading":"Read"} ${y(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 ut(l,i);if(ft(r))return ht(r,l,i);if(pe(r))return mt(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 ut(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 ht(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 mt(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 ft(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 pt(e,t){return!e||!t?e:e.startsWith("Read ")?`Reading ${e.slice(5)}`:e.startsWith("Run ")?`Running ${e.slice(4)}`:e}function gt(){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 xt(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?D(s,"received"):null,i>0?D(i,"sent"):null].filter(r=>!!r);return{kind:"subagent",text:I(O(a))}}function D(e,t){return e===1?`child message ${t}`:`${e} child messages ${t}`}function bt(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 jt(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 St(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 vt(e){const t=xe(e);if(t.length===0||t.some(be))return{countedAsRun:!0};const s=fe(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(Ct(i,a)||pe(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=ge(i,a);return r.length>0?{countedAsRun:!1,readFiles:r}:{countedAsRun:!0}}function fe(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 Ct(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 pe(e){return["eslint","jest","playwright","prettier","tsc","vitest"].includes(e)}function ge(e,t){if(e==="cat"||e==="nl"||e==="head"||e==="tail"||e==="wc")return L(v(t));if(e==="sed"){const s=t.findIndex(i=>i!=="-n"&&!i.startsWith("--"));return L(s>=0?v(t.slice(s+1)):[])}return e==="awk"||e==="jq"?L(v(t.slice(1))):[]}function L(e){return e.filter(t=>!(!t||t==="."||t==="-"||/^\d+$/.test(t)))}function yt(e){const t=[],s=wt(e);s&&t.push(s),e.editCount>0&&t.push("made edits");const i=e.readFiles.size||e.readFileCount;return i>0&&t.push(K("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(K("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(...$t(e)),t}function $t(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 wt(e){const t=Nt(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 St(e,t,s){const i=t.openSession?.sessionId??(t.content.trim()||t.id),a=e.subagentStatuses.get(i);(!a||q(s)>q(a))&&e.subagentStatuses.set(i,s)}function Nt(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 q(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 kt(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 At(e){return e===1?"ran a command":`ran ${e} commands`}function K(e,t,s){return t===1?`${e} a ${s}`:`${e} ${t} ${s}s`}function Rt(e,t){return e.length===0?t?I(t):"":I(O(t?[...e,t]:e))}function Mt(e,t){const s=t.trim();s&&(e.includes(s)||e.push(s))}function It(e,t){const s=_t(t);!s||e.includes(s)||e.push(s)}function Tt(e,t){const s=t.receipt;if(!s)return;const i=`${s.status} receipt ${Et(s.id)} ${zt(s.totalUsd)}`;e.includes(i)||e.push(i)}function _t(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 zt(e){const t=e.trim();return t.startsWith("$")?t:`$${t}`}function Et(e){const t=e.trim();return t.length<=14?t:`${t.slice(0,6)}...${t.slice(-4)}`}function Pt(e){return e.length===0?"":I(O(e.map(Lt)))}function Lt(e){return e&&`${e[0].toLowerCase()}${e.slice(1)}`}function O(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 I(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function Ut(e){const t=e.findIndex((r,l)=>l>0&&r!=="-n"&&!r.startsWith("--")),s=t>=0?e[t]??"":"",i=t>=0?v(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 ${y(i)}`:`Read ${c}`}return i.length>0?`Read ${y(i)} with sed`:"Run sed"}function Ft(e,t=!1){const s=e.slice(1);if(s.includes("--files")){const l=v(s.filter(c=>c!=="--files"));return l.length>0?`${t?"Listing":"Listed"} files matching ${y(l)}`:t?"Listing files":"Listed files"}const i=v(s),a=i[0],r=i.slice(1);return a?r.length>0?`${t?"Searching":"Searched"} for ${V(a)} in ${y(r)}`:`${t?"Searching":"Searched"} for ${V(a)}`:t?"Searching files":"Searched files"}function xe(e){return(e.match(/"([^"\\]|\\.)*"|'[^']*'|[^\s]+/g)??[]).map(s=>Bt(s)).filter(Boolean)}function Bt(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function be(e){return["|","&&","||",";",">",">>","<","(",")"].includes(e)}function v(e){const t=[];for(let s=0;s<e.length;s+=1){const i=e[s];if(!i.startsWith("-")){t.push(i);continue}Ot(i)&&s+1<e.length&&(s+=1)}return t}function Ot(e){return["-e","-f","-g","--glob","--type","-t","--context","-C","-A","-B","-m","-n","-c"].includes(e)}function y(e){return e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e[0]} and ${e.length-1} more`}function V(e){return`"${e}"`}function Gt(e,t){return new Set(e.filter(s=>!t.has(s.id)).map(s=>s.id))}function js(e,t){const s=d.useRef({scopeKey:t,ids:new Set(e.map(r=>r.id)),initialized:e.length>0}),i=s.current.scopeKey===t,a=i&&s.current.initialized?Gt(e,s.current.ids):new Set;return d.useLayoutEffect(()=>{s.current={scopeKey:t,ids:new Set(e.map(r=>r.id)),initialized:i&&s.current.initialized?!0:e.length>0}},[e,i,t]),a}const S=new Map,Wt=15e3;function Dt(e,t){const s=qt(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 qt(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:H(Q(e,a)),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;const r=Q(e,a),l=H(r);if(l)return l;const c=S.get(r);if(c?.state==="loading")return c.promise;const o=re.signChatAttachmentImageUrl(e,a).then(u=>(S.set(r,{state:"ready",url:u.url,expiresAt:u.expiresAt}),t(m=>m+1),u.url)).catch(()=>(S.delete(r),t(u=>u+1),null));return S.set(r,{state:"loading",promise:o}),o},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function H(e){const t=S.get(e);return t?.state!=="ready"?null:t.expiresAt<=Date.now()+Wt?(S.delete(e),null):t.url}function Q(e,t){return[e.serverUrl,e.token,t.sessionId,t.turnId,t.attachmentId,t.storageName,t.contentType].join("\0")}const Kt=64,Vt=120,Ht=210,Qt=360,Yt=40,Xt=120,Zt=600,Jt=64,Y=16;function en(e,t,s=0){if(e<=0)return{characterCount:0,remainder:0};const i=e>Zt?Qt:e>Xt?Ht:e>Yt?Vt:Kt,a=s+Math.min(Math.max(t,0),Jt)*i/1e3,r=Math.min(e,Math.floor(a));return{characterCount:r,remainder:a-r}}function je(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 X(){return typeof window<"u"&&typeof window.matchMedia=="function"&&typeof document<"u"&&document.visibilityState==="visible"&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}function tn(e,t,s){return t&&s?je("",e,1):e}function nn(e,t=!1){const[s,i]=d.useState(()=>tn(e,t,X())),a=d.useRef(s),r=d.useRef(e),l=d.useRef(null),c=d.useRef(null),o=d.useRef(0);return d.useEffect(()=>{if(r.current=e,!X()||!e.startsWith(a.current)){l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=e,i(e);return}if(a.current.length===e.length||l.current!==null)return;const u=()=>{const m=a.current,f=r.current,h=performance.now();if(!f.startsWith(m)){a.current=f,i(f),l.current=null,c.current=null,o.current=0;return}const x=f.length-m.length;if(x===0){l.current=null,c.current=null,o.current=0;return}const $=c.current===null?16:h-c.current,j=en(x,$,o.current);if(c.current=h,o.current=j.remainder,j.characterCount>0){const p=je(m,f,j.characterCount);a.current=p,i(p)}l.current=window.setTimeout(u,Y)};l.current=window.setTimeout(u,Y)},[e]),d.useEffect(()=>{const u=()=>{document.visibilityState!=="visible"&&(l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=r.current,i(r.current))};return document.addEventListener("visibilitychange",u),()=>{document.removeEventListener("visibilitychange",u),l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[]),s}function sn({animateInitialContent:e=!1,content:t,...s}){const i=nn(t,e),a=Ve(i,i.length===t.length);return n.jsx(ce,{...s,content:a})}function an({actionRun:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i=null}){const a=on(e.status),r=dn(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(cn,{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 Z(e){return e.implementationType==="openpond-profile-action"}function rn(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&&!Te(e.title)?M({actionId:e.actionName,label:e.title}):M({actionId:e.actionName})}function ln(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 cn({refItem:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i}){const a=s?Qe(e.target,{workspaceRootPath:i}):null,r=un(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(U,{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(U,{size:13})})]})}function on(e){return e==="completed"?_e:e==="failed"?ot:st}function dn(e){const t=[];return e.implementationType&&t.push({label:"Type",value:e.implementationType,icon:n.jsx(He,{size:12})}),e.runId&&t.push({label:"Run",value:e.runId,icon:n.jsx(k,{size:12})}),e.sandboxId&&t.push({label:"Sandbox",value:e.sandboxId,icon:n.jsx(k,{size:12})}),e.sourceRef&&t.push({label:"Source",value:e.sourceRef,icon:n.jsx(Xe,{size:12})}),e.manifestHash&&t.push({label:"Manifest",value:e.manifestHash,icon:n.jsx(k,{size:12})}),t}function un(e){return/^https?:\/\//i.test(e)}const N=new Map,hn=15e3;function mn(e,t){const s=fn(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 fn(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:J(ee(e,a)),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;const r=ee(e,a),l=J(r);if(l)return l;const c=N.get(r);if(c?.state==="loading")return c.promise;const o=re.signLocalVideoUrl(e,{path:a}).then(u=>(N.set(r,{state:"ready",url:u.url,expiresAt:u.expiresAt}),t(m=>m+1),u.url)).catch(()=>(N.delete(r),t(u=>u+1),null));return N.set(r,{state:"loading",promise:o}),o},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function J(e){const t=N.get(e);return t?.state!=="ready"?null:t.expiresAt<=Date.now()+hn?(N.delete(e),null):t.url}function ee(e,t){return`${e.serverUrl}\0${e.token}\0${t}`}function pn(e,t){return{toolCount:e.reduce((i,a)=>i+(te(a)?0:1),0),toolsExpanded:t,visibleActivities:t?e.filter(i=>!te(i)):[]}}function te(e){return e.kind==="reasoning"}function gn(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 xn=4;function bn({onOpenSession:e,onShowAll:t,sessions:s}){const i=s.slice(0,xn),a=Math.max(0,s.length-i.length),r=s.map(Ce).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(ve,{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 ve({className:e="",onOpenSession:t,openSession:s}){const i=$e(s.roleId),a=Cn(s.status),r=`Open ${Ce(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(jn,{roleId:i})})}function jn({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 vn(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 Ce(e){const t=`${ye(e.roleId)} subagent`,s=e.status?.replace(/_/g," ").trim();return s?`${t} (${s})`:t}function ye(e){return $e(e).split(/[-_]+/).filter(Boolean).map(s=>s.slice(0,1).toUpperCase()+s.slice(1)).join(" ")||"Subagent"}function $e(e){const t=e?.trim().toLowerCase()||"subagent";return/^[a-z][a-z0-9_-]*$/.test(t)?t:"subagent"}function Cn(e){const t=e?.trim().toLowerCase()||"unknown";return/^[a-z][a-z0-9_-]*$/.test(t)?t:"unknown"}const we=5,yn=280;function $n({activeWorkspaceAppId:e,connection:t,message:s,onOpenFileInSidebar:i,onOpenSession:a}){const r=s.activities??[],[l,c]=d.useState(!1),[o,u]=d.useState(null),m=d.useId(),f=d.useMemo(()=>dt(r),[r]),h=d.useMemo(()=>pn(r,l),[r,l]),x=r.find(g=>g.imagePreview)?.imagePreview??null,$=s.deliverables??[],j=G(o,t,e),p=s.traceState==="running",A=s.traceState==="failed"||s.traceState==="interrupted",E=gn(s.traceStartedAt,s.traceCompletedAt),w=In(f.text,s.traceState,E,r),C=vn(r);return r.length>0&&r.every(g=>g.subagentMessage)?n.jsx(An,{activities:r}):n.jsxs("article",{className:`activity-group work-trace ${p?"running":"settled"}`,children:[n.jsxs("div",{className:"activity-summary-row",children:[h.toolCount>0?n.jsxs("button",{type:"button","aria-controls":m,"aria-expanded":h.toolsExpanded,className:`activity-summary ${A?"danger":""} ${p?"working":""}`,onClick:()=>c(g=>!g),children:[x?n.jsx(se,{activeWorkspaceAppId:e,connection:t,image:x}):n.jsx(ie,{kind:f.kind}),n.jsx(ne,{summary:w}),n.jsx(z,{className:`activity-summary-toggle ${h.toolsExpanded?"expanded":""}`,size:14})]}):n.jsxs("div",{className:`activity-summary static ${A?"danger":""} ${p?"working":""}`,children:[x?n.jsx(se,{activeWorkspaceAppId:e,connection:t,image:x}):n.jsx(ie,{kind:f.kind}),n.jsx(ne,{summary:w})]}),C.length>0&&a?n.jsx(bn,{onOpenSession:a,onShowAll:()=>c(!0),sessions:C}):null]}),$.length>0?n.jsx(Sn,{artifacts:$,connection:t,onOpenFileInSidebar:i}):null,h.visibleActivities.length>0?n.jsx("div",{className:"work-trace-flow",id:m,children:h.visibleActivities.map(g=>n.jsx(wn,{activeWorkspaceAppId:e,activity:g,connection:t,onOpenImage:u,onOpenSession:a},g.id))}):null,n.jsx(oe,{open:!!j,src:j,title:o?.path??"",onClose:()=>u(null)})]})}function wn({activeWorkspaceAppId:e,activity:t,connection:s,onOpenImage:i,onOpenSession:a}){const[r,l]=d.useState(!1),c=d.useId(),o=G(t.imagePreview??null,s,e);return t.subagentMessage?n.jsx(Ne,{activity:t}):n.jsxs("div",{className:`activity-tool-row ${t.controlKind==="turn_aborted"?"danger":""}`,children:[n.jsxs("button",{type:"button","aria-controls":c,"aria-expanded":r,className:"activity-tool-summary",onClick:()=>l(u=>!u),children:[t.kind==="command"?n.jsx(le,{"aria-hidden":!0,className:"activity-tool-kind-icon",size:12}):null,n.jsx("span",{children:_n(t)}),n.jsx(z,{className:`activity-tool-toggle ${r?"expanded":""}`,size:13})]}),r?n.jsxs("div",{className:"activity-tool-details",id:c,children:[t.kind==="command"&&t.content?n.jsx(zn,{command:t.content,exitCode:t.terminal?.exitCode,output:t.detail,state:t.state}):t.content?Bn(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,`
|
|
2
2
|
`).trimEnd()}):null,t.meta?n.jsx("small",{className:"activity-detail-meta",children:t.meta}):null,t.imagePreview&&o?n.jsx("button",{type:"button",className:"activity-image-preview",title:`Open ${t.imagePreview.path}`,onClick:()=>i(t.imagePreview??null),children:n.jsx("img",{alt:ze(t.imagePreview.path),decoding:"async",loading:"lazy",src:o})}):null,t.openSession&&a?n.jsx(ve,{className:"activity-subagent-detail-avatar",openSession:t.openSession,onOpenSession:a}):null]}):null]})}function Sn({artifacts:e,connection:t,onOpenFileInSidebar:s}){return n.jsx("div",{className:"activity-artifact-list",children:e.map(i=>i.contentType.startsWith("video/")?n.jsx(kn,{artifact:i,connection:t,onOpenFileInSidebar:s},i.path):i.contentType.startsWith("image/")?n.jsx(Nn,{artifact:i,connection:t},i.path):n.jsxs("button",{type:"button",className:"activity-artifact",title:`Show ${i.path} in its folder`,onClick:()=>{ue(i.path)},children:[n.jsx(k,{"aria-hidden":!0,size:14}),n.jsxs("span",{children:[n.jsx("strong",{children:i.title}),n.jsx("code",{children:i.path})]}),n.jsx("small",{children:i.sizeBytes==null?i.contentType:Se(i.sizeBytes)})]},i.path))})}function Nn({artifact:e,connection:t}){const[s,i]=d.useState(!1),a=de(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(B,{"aria-hidden":!0,size:20})}),n.jsx("strong",{children:e.title}),n.jsx(oe,{open:s&&!!a,src:a,title:e.title,onClose:()=>i(!1)})]})}function kn({artifact:e,connection:t,onOpenFileInSidebar:s}){const i=d.useRef(null),[a,r]=d.useState(!1),l=mn(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(et,{"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:()=>{ue(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:Se(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(Ee,{"aria-hidden":!0,size:13}),"Open in sidebar"]}):null]})]})}function Se(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 Ne({activity:e}){const[t,s]=d.useState(!1),i=e.subagentMessage;if(!i)return null;const a=`${ye(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=Rn(i),o=Mn(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(he,{"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":we},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 An({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(Ne,{activity:s},s.id))})}function Rn(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 Mn(e){return e.length>yn||e.split(/\r?\n/).length>we}function ne({summary:e}){return n.jsx("span",{className:"activity-summary-text",children:n.jsx("span",{children:e})})}function In(e,t,s,i){return t==="running"?Tn(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 Tn(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 T(i)}return t?T(t):null}function T(e){return e.kind==="command"?e.state==="failed"?"Command failed":me(e.content,e.state)??(e.state==="running"||e.state==="pending"?"Running command":"Ran command"):e.label.trim()||null}function _n(e){if(e.kind!=="command")return e.label;if(e.state==="running"||e.state==="pending")return T(e)??"Running command";const t=En(e.terminal?.durationMs);return e.state==="failed"?`Command failed${t?` in ${t}`:""}`:`${T(e)??"Ran command"}${t?` in ${t}`:""}`}function zn({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:"$ "}),Pn(e),s?n.jsx("span",{className:"activity-command-output",children:`
|
|
3
3
|
${s.replace(/\r\n/g,`
|
|
4
4
|
`).trimEnd()}`}):null]})}),n.jsx("footer",{children:a})]})}function En(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 Pn(e){return Ln(e).map((t,s)=>n.jsx("span",{className:`shell-token ${t.kind}`,children:t.text},`${s}-${t.text}`))}function Ln(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 se({activeWorkspaceAppId:e,connection:t,image:s}){const i=G(s,t,e);return i?n.jsx("img",{"aria-hidden":!0,className:"activity-summary-image",decoding:"async",loading:"lazy",src:i,alt:""}):null}function ie({kind:e}){const t=Un(e);return n.jsx(t,{"aria-hidden":!0,className:`activity-summary-kind-icon ${e}`,size:14})}function Un(e){return e==="approval"||e==="control"?Ze:e==="edit"?tt:e==="image"?B:e==="list"?Pe:e==="read"?k:e==="reasoning"?lt:e==="search"?Le:e==="subagent"?he:e==="web"?F:le}function G(e,t,s){const i=e&&Fn(e.path)?e.path:null,a=e?.appId??s,r=de(t,i),l=Ye(t,i?null:a,i?null:e?.path);return i?r:l}function Fn(e){return/^file:\/\//i.test(e)||/^\//.test(e)||/^[A-Za-z]:[\\/]/.test(e)}function Bn(e){return e.includes(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,F as o,Z as c,X as n}from"./index-
|
|
1
|
+
import{j as e,F as o,Z as c,X as n}from"./index-CDJX5ZxL.js";import{M as d}from"./MarkdownText-_JhfBcQL.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 e,X as N,d as b}from"./index-
|
|
1
|
+
import{j as e,X as N,d as b}from"./index-CDJX5ZxL.js";import{F as f}from"./folder-open-DXaun_C3.js";import{F as P}from"./folder-plus-CUbTwu82.js";function A({open:d,mode:a="local",name:s,path:r,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?b:o?f:P,x=l?"New Cloud Project":o?"Use Existing Folder":"New Local Project",m=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?!r.trim():!s.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:x}),e.jsx("p",{children:m}),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:r,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:s,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{A as NewProjectDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,n as W,j as e,aL as A,aE as D,X as B,F as R}from"./index-
|
|
1
|
+
import{r as i,n as W,j as e,aL as A,aE as D,X as B,F as R}from"./index-CDJX5ZxL.js";import{s as M,r as z,C as K,F as X}from"./MarkdownText-_JhfBcQL.js";import{F as q,I as H,P as Y,a as V,b as G}from"./MainPane-CNoHJkXy.js";import{F as J}from"./folder-open-DXaun_C3.js";import"./cloud-upload-mSm9KIL4.js";import"./folder-DMeODEQJ.js";import"./arrow-up-right-DRIT5z3q.js";import"./square-DfEM9XgY.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(),o=t.title.toLowerCase();return s===Q||o.endsWith(".docx")?{label:"Document",type:"document"}:s==="application/pdf"||o.endsWith(".pdf")?{label:"PDF",type:"pdf"}:s===Z||o.endsWith(".pptx")?{label:"Presentation",type:"presentation"}:s===tt||s==="text/csv"||s==="text/tab-separated-values"||o.endsWith(".xlsx")||o.endsWith(".csv")||o.endsWith(".tsv")?{label:"Table",type:"table"}:s==="text/html"||o.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,o)=>P(o.createdAt)-P(s.createdAt)||o.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 nt(t){const s=i.useMemo(()=>t?_(t):null,[t]),o=s?L(s):null,[a,r]=i.useState(o??[]),[j,h]=i.useState(!!t&&!o),[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),ot(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 ot(t){const s=_(t),o=f.get(s);if(o?.request)return o.request;if(o&&o.refreshedAt>0&&Date.now()-o.refreshedAt<st)return Promise.resolve(o.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 o?f.set(s,{...o,request:null}):f.delete(s),r});return f.set(s,{outputs:o?.outputs??[],refreshedAt:o?.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 gt({connection:t,onViewChat:s}){const{error:o,loading:a,outputs:r}=nt(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(n=>x(n).label))).sort((n,u)=>n.localeCompare(u)),[r]),y=k.includes(j)?j:v,w=i.useMemo(()=>y===v?r:r.filter(n=>x(n).label===y),[y,r]);async function I(n){if(!t)return;const u=S(n);m(u),d(null);try{const c=await W.workspaceTool(t,n.sourceTaskId,{action:"work_output_read",source:"ui_button",args:{outputId:n.id,revision:n.revision}});if(!c.ok)throw new Error(c.output);const F=pt(c.data),U=typeof F.contentsBase64=="string"?F.contentsBase64:"";if(!U)throw new Error("The output did not include file data.");const N=new File([dt(U)],n.title,{type:n.contentType}),E=x(n),O=E.type==="text"||E.type==="html";l?.objectUrl&&URL.revokeObjectURL(l.objectUrl),T({file:N,objectUrl:O?null:URL.createObjectURL(N),output:n,text:O?await N.text():null})}catch(c){d(ft(c))}finally{m(null)}}async function C(n){if(n.location.kind!=="local")return;const u=await M(n.location.path,n.title);!u.ok&&!u.canceled&&d("Could not save a copy of the Work output.")}return e.jsxs("section",{"aria-label":"My files",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:n=>h(n.target.value),value:y,children:[e.jsx("option",{value:v,children:"All file types"}),k.map(n=>e.jsx("option",{value:n,children:n},n))]})})}):null,o||b?e.jsx("p",{className:"outputs-error",children:b??o}):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(n=>{const u=x(n),c=S(n);return e.jsxs("article",{className:"output-card",children:[e.jsxs("button",{"aria-label":`Preview ${n.title}`,className:"output-card-main",disabled:p===c,onClick:()=>{I(n)},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:n.title}),e.jsxs("small",{children:[u.label," · ",ut(n.sizeBytes)]}),e.jsxs("small",{children:["Revision ",n.revision," ·"," ",e.jsx("time",{dateTime:n.createdAt,children:ct(n.createdAt)})]})]}),p===c?e.jsx(A,{className:"outputs-spin",size:15}):null]}),e.jsxs("div",{className:"output-card-actions",children:[n.location.kind==="local"?e.jsx("button",{"aria-label":`Download ${n.title}`,className:"output-download-button",onClick:()=>{C(n)},title:"Download",type:"button",children:e.jsx(D,{"aria-hidden":"true",size:14})}):null,e.jsx("button",{onClick:()=>s(n.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:o,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:o,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),o=new ArrayBuffer(s.length),a=new Uint8Array(o);for(let r=0;r<s.length;r+=1)a[r]=s.charCodeAt(r);return o}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{gt as OutputsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,al as ke,j as s,bW as ve,a9 as we,aa as xe,ae as Re,ab as ye,X as je,P as Pe,a0 as Ae}from"./index-Cxq5q-6B.js";import{F as ue}from"./folder-open-CqjIkaDK.js";import{u as Ce,T as Te,M as Ie}from"./Messages-DGrK4iIj.js";import{s as Me,c as Ne,A as De,d as Ee}from"./MainPane-COs4xUGo.js";import"./chevron-up-B5URpgIH.js";import"./MarkdownText-CzZ60aWs.js";import"./arrow-up-right-CkfCgokz.js";import"./git-branch-BN2ijBYt.js";import"./circle-alert-CAvjRdlQ.js";import"./play-DGCzapdE.js";import"./square-pen-j-mZ_UkO.js";import"./cloud-upload-DeQEwz1o.js";import"./folder-DgS_U9Lq.js";import"./square-Dp5eGICS.js";function Se({panel:e,actionCatalog:w,createImproveActions:x,initialScrollState:p,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:R,connection:y,connectedAppMentions:F,mentionApps:B,codexPersonalSkills:L,profileSkills:$,profileTarget:j,projectTarget:O,providerSettings:H,accountBaseUrl:q,billingOrganizationSlug:z,billingTeamId:K,showToast:V,workspaceTarget:W,onCodexPermissionModeChange:U,onCodexReasoningEffortChange:Q,onOpenPondCommandAccessModeChange:P,onModelChange:X,onOpenAttachmentInSidebar:_,onOpenFileInSidebar:G,onOpenProfileSettings:J,onOpenSession:Y,onProviderChange:Z,onProviderSetupOpen:ee,onPromptChange:te,onProfileTargetChange:se,onScrollStateChange:ie,onProjectTargetChange:oe,onResolveApproval:re,onShowBrowserPanel:A,onStop:ne,onSubmit:g,onWorkspaceTargetChange:ae}){const b=r.useRef(null),l=r.useRef(p?.stickyToBottom??!0),C=r.useRef(!1),k=e.running&&!e.pendingApproval&&Me(e.messages),ce=r.useMemo(()=>e.createImproveRun?{...x,run:e.createImproveRun}:null,[x,e.createImproveRun]),T=r.useMemo(()=>Ne(e.messages,{showThinkingIndicator:k}),[e.messages,k]),h=Ce(e.messages,e.sessionId??`draft:${e.id}`),u=e.messages.at(-1),de=[e.id,e.sessionId??"draft",T.length,u?.id??"",u?.content?.length??0,u?.timestamp??"",k?"thinking":""].join(":");r.useLayoutEffect(()=>{const i=b.current;if(i){if(!C.current){C.current=!0,i.scrollTop=p?.stickyToBottom?i.scrollHeight:p?.scrollTop??0;return}l.current&&(i.scrollTop=i.scrollHeight)}},[de,p]),r.useLayoutEffect(()=>{const i=b.current;if(!i||typeof MutationObserver>"u")return;l.current&&(i.scrollTop=i.scrollHeight);const c=new MutationObserver(()=>{l.current&&(i.scrollTop=i.scrollHeight)});return c.observe(i,{childList:!0,characterData:!0,subtree:!0}),()=>c.disconnect()},[e.id]);const I=r.useCallback((i,c)=>{const m=e.sessionId??`side-chat:${e.id}`;ke({conversationId:m,href:i,explicitFile:c?.explicitFile,newTab:c?.newTab}).then(a=>{a&&A()})},[A,e.id,e.sessionId]),M=r.useCallback(async(i,c)=>{const m=c.action==="answer"?c.text:"Dismiss this question";if(!await g([],null,null,{displayPrompt:m,promptOverride:m,turnMetadata:{userQuestionResolution:c}}))throw new Error("The question response could not be sent.")},[g]);return s.jsxs("section",{className:`right-chat-pane ${e.pendingApproval?"has-approval":""}`,id:`right-chat-panel-${e.id}`,role:"tabpanel","aria-labelledby":`right-chat-tab-${e.id}`,children:[s.jsx("div",{className:"chat-thread right-chat-thread",ref:b,onScroll:i=>{const c=i.currentTarget;l.current=c.scrollHeight-c.scrollTop-c.clientHeight<=72,ie({scrollTop:c.scrollTop,stickyToBottom:l.current})},children:T.map(i=>i.type==="thinking"?s.jsx(Te,{},i.id):s.jsx(Ie,{activeWorkspaceAppId:e.activeWorkspaceAppId,accountBaseUrl:q,billingOrganizationSlug:z,billingTeamId:K,connection:y,animateInitialContent:i.message.role==="assistant"&&h.has(i.message.id),message:i.message,onOpenBrowserLink:I,onOpenAttachmentInSidebar:_,onOpenFileInSidebar:G,onOpenProfileSettings:J,onResolveUserQuestion:M,onOpenSession:Y,userAttachmentDisplay:e.provider==="codex"?"compact":"full",workspaceRootPath:e.workspaceRootPath,showFooter:i.showFooter},i.id))}),s.jsxs("div",{className:`composer-stack dock right-chat-composer ${e.pendingApproval?"has-approval":""}`,children:[s.jsx(De,{approval:e.pendingApproval,onResolve:re}),s.jsx(Ee,{mode:"dock",prompt:e.prompt,mentionApps:B,connectedAppMentions:F,profileSkills:e.provider==="codex"?L:$,profileTarget:e.provider==="codex"?null:j,selectedMentionAppId:null,contextWindowStatus:e.contextWindowStatus,goalRuntime:e.goalRuntime,createImproveRuntime:ce,busy:e.running,running:e.running,submissionScopeKey:e.sessionId??e.id,steerAutoDispatchBlocked:e.steerAutoDispatchBlocked,steerAutoDispatchReady:e.steerAutoDispatchReady,showProjectFooter:!1,connection:y,providerSettings:H,provider:e.provider,model:e.model,projectTarget:O,actionCatalog:w,workspaceTarget:W,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:e.provider==="codex"?R:e.session?.openPondCommandAccessMode??R,onProviderChange:Z,onProviderSetupOpen:ee,onProjectTargetChange:oe,onWorkspaceTargetChange:ae,onModelChange:X,onCodexPermissionModeChange:U,onCodexReasoningEffortChange:Q,onOpenPondCommandAccessModeChange:P,onPromptChange:te,onProfileTargetChange:se,onMentionAppSelect:void 0,showToast:V,onSubmit:g,onStop:ne})]})]})}function _e({panels:e,actionCatalog:w=[],createImproveActions:x,busy:p,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:R,connection:y,connectedAppMentions:F,mentionApps:B,codexPersonalSkills:L,profileSkills:$=[],profileLibrary:j={lastUsed:null,profiles:[]},extensionCatalog:O,projectTarget:H,providerSettings:q,accountBaseUrl:z,billingOrganizationSlug:K,billingTeamId:V,showToast:W,workspaceTarget:U,onAddChat:Q,onActivatePanel:P,onClosePanel:X,onCodexPermissionModeChange:_,onCodexReasoningEffortChange:G,onOpenPondCommandAccessModeChange:J,onModelChange:Y,onOpenAttachmentInSidebar:Z,onOpenFileInSidebar:ee,onOpenProfileSettings:te,onOpenSession:se,onProviderChange:ie,onProviderSetupOpen:oe,onPromptChange:re,onProfileTargetChange:A,onScrollStateChange:ne,onProjectTargetChange:g,onResolveApproval:ae,onResizeStart:b,onSelectFiles:l,onShowBrowserPanel:C,onStop:k,onSubmit:ce,onWorkspaceTargetChange:T}){const[h,u]=r.useState(!1),[de,I]=r.useState(()=>ve(e)?.id??null),M=r.useRef(null),i=r.useRef(new Map),c=r.useRef(new Set(e.map(t=>t.id))),m=r.useRef(new Map(e.map(t=>[t.id,t.activationVersion]))),a=e.find(t=>t.id===de)??e.at(-1)??null,fe=a?.session?.currentProfile??j.lastUsed,N=we(j,fe),he=N?xe(N,O):$,me=N?[...w.filter(t=>!Re(t)),...ye(N)]:w;r.useEffect(()=>{const t=c.current,d=m.current;let n=null,f=null;for(const o of e)t.has(o.id)||(n=o),t.has(o.id)&&o.activationVersion>(d.get(o.id)??0)&&(f=o);c.current=new Set(e.map(o=>o.id)),m.current=new Map(e.map(o=>[o.id,o.activationVersion])),I(o=>f?f.id:n?n.id:o&&e.some(D=>D.id===o)?o:e.at(-1)?.id??null)},[e]),r.useEffect(()=>{if(!h)return;function t(n){M.current?.contains(n.target)||u(!1)}function d(n){n.key==="Escape"&&u(!1)}return document.addEventListener("pointerdown",t),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",t),document.removeEventListener("keydown",d)}},[h]);const v=r.useCallback((t,d=!1)=>{I(t),P(t),d&&window.requestAnimationFrame(()=>i.current.get(t)?.focus())},[P]),le=r.useCallback((t=!1)=>{l(),t&&window.requestAnimationFrame(()=>{document.getElementById("right-sidebar-files-tab")?.focus()})},[l]),pe=r.useCallback((t,d)=>{const n=e.findIndex(be=>be.id===d);if(n<0)return;const f=n+1;let o=null;if(t.key==="ArrowRight"&&(o=(f+1)%(e.length+1)),t.key==="ArrowLeft"&&(o=(f-1+e.length+1)%(e.length+1)),t.key==="Home"&&(o=0),t.key==="End"&&(o=e.length),o===null)return;if(t.preventDefault(),o===0){le(!0);return}const D=e[o-1];D&&v(D.id,!0)},[e,le,v]),ge=r.useCallback(t=>{if(!["ArrowRight","ArrowLeft","Home","End"].includes(t.key)||(t.preventDefault(),t.key==="Home"))return;const d=t.key==="ArrowLeft"||t.key==="End"?e.at(-1):e[0];d&&v(d.id,!0)},[e,v]);return s.jsxs("aside",{className:"workspace-diff-panel right-chat-panel-stack","aria-label":"Side chats",children:[s.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize side chat panel",onPointerDown:b}),s.jsx("div",{className:"workspace-diff-topbar right-chat-topbar",children:s.jsxs("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",children:[s.jsxs("button",{type:"button",className:"workspace-diff-tab",role:"tab",id:"right-sidebar-files-tab","aria-controls":"right-sidebar-files-panel","aria-selected":!1,tabIndex:-1,onClick:()=>le(!1),onKeyDown:ge,children:[s.jsx(ue,{size:14}),s.jsx("span",{children:"Files"})]}),e.map(t=>{const d=t.id===a?.id;return s.jsxs("div",{className:`workspace-diff-tab right-chat-tab ${d?"active":""}`,children:[s.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab",id:`right-chat-tab-${t.id}`,"aria-controls":`right-chat-panel-${t.id}`,"aria-selected":d,tabIndex:d?0:-1,title:t.title,ref:n=>{n?i.current.set(t.id,n):i.current.delete(t.id)},onClick:()=>v(t.id),onKeyDown:n=>pe(n,t.id),children:[t.running?s.jsx("span",{className:"right-chat-status-dot","aria-label":"Running"}):null,s.jsx("span",{children:t.title})]}),s.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${t.title}`,"aria-label":`Close ${t.title}`,onClick:n=>{n.stopPropagation(),X(t.id)},children:s.jsx(je,{size:12})})]},t.id)}),s.jsxs("div",{className:"workspace-diff-add-anchor",ref:M,children:[s.jsx("button",{type:"button",className:`workspace-diff-add-tab ${h?"active":""}`,title:"Add to right sidebar","aria-label":"Add to right sidebar","aria-haspopup":"menu","aria-expanded":h,onClick:()=>u(t=>!t),children:s.jsx(Pe,{size:15})}),h?s.jsxs("div",{className:"workspace-diff-add-menu right-chat-add-popover",role:"menu",children:[s.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{u(!1),Q()},children:[s.jsx(Ae,{size:13}),s.jsx("span",{children:"New task"})]}),s.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{u(!1),l()},children:[s.jsx(ue,{size:13}),s.jsx("span",{children:"Files"})]})]}):null]})]})}),s.jsx("div",{className:"right-chat-stack-body panes-1",children:a?s.jsx(Se,{busy:p,createImproveActions:x,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:R,connection:y,connectedAppMentions:F,actionCatalog:me,mentionApps:B,codexPersonalSkills:L,profileSkills:he,profileTarget:null,panel:a,initialScrollState:{scrollTop:a.scrollTop,stickyToBottom:a.stickyToBottom},projectTarget:H,providerSettings:q,accountBaseUrl:z,billingOrganizationSlug:K,billingTeamId:V,showToast:W,workspaceTarget:U,onCodexPermissionModeChange:_,onCodexReasoningEffortChange:G,onOpenPondCommandAccessModeChange:t=>J(t,a.session),onModelChange:t=>Y(a.id,t),onOpenAttachmentInSidebar:Z,onOpenFileInSidebar:ee,onOpenProfileSettings:te,onOpenSession:se,onProviderChange:t=>ie(a.id,t),onProviderSetupOpen:oe,onPromptChange:t=>re(a.id,t),onProfileTargetChange:t=>A(a.sessionId,t),onScrollStateChange:t=>ne(a.id,t),onProjectTargetChange:g,onResolveApproval:ae,onShowBrowserPanel:C,onStop:()=>k(a.sessionId),onSubmit:(t,d,n,f)=>ce(a.id,t,d,n,f),onWorkspaceTargetChange:T},a.id):null})]})}export{_e as RightChatPanelStack};
|
|
1
|
+
import{r,al as ke,j as s,bW as ve,a9 as we,aa as xe,ae as Re,ab as ye,X as je,P as Pe,a0 as Ae}from"./index-CDJX5ZxL.js";import{F as ue}from"./folder-open-DXaun_C3.js";import{u as Ce,T as Te,M as Ie}from"./Messages-Bo0-Uvcz.js";import{s as Me,c as Ne,A as De,d as Ee}from"./MainPane-CNoHJkXy.js";import"./chevron-up-Hglu-Zx3.js";import"./MarkdownText-_JhfBcQL.js";import"./arrow-up-right-DRIT5z3q.js";import"./git-branch-CUlgF0kK.js";import"./circle-alert-Crh3Zr2m.js";import"./play-lC5KpmRD.js";import"./square-pen-CgX3HoJ6.js";import"./cloud-upload-mSm9KIL4.js";import"./folder-DMeODEQJ.js";import"./square-DfEM9XgY.js";function Se({panel:e,actionCatalog:w,createImproveActions:x,initialScrollState:p,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:R,connection:y,connectedAppMentions:F,mentionApps:B,codexPersonalSkills:L,profileSkills:$,profileTarget:j,projectTarget:O,providerSettings:H,accountBaseUrl:q,billingOrganizationSlug:z,billingTeamId:K,showToast:V,workspaceTarget:W,onCodexPermissionModeChange:U,onCodexReasoningEffortChange:Q,onOpenPondCommandAccessModeChange:P,onModelChange:X,onOpenAttachmentInSidebar:_,onOpenFileInSidebar:G,onOpenProfileSettings:J,onOpenSession:Y,onProviderChange:Z,onProviderSetupOpen:ee,onPromptChange:te,onProfileTargetChange:se,onScrollStateChange:ie,onProjectTargetChange:oe,onResolveApproval:re,onShowBrowserPanel:A,onStop:ne,onSubmit:g,onWorkspaceTargetChange:ae}){const b=r.useRef(null),l=r.useRef(p?.stickyToBottom??!0),C=r.useRef(!1),k=e.running&&!e.pendingApproval&&Me(e.messages),ce=r.useMemo(()=>e.createImproveRun?{...x,run:e.createImproveRun}:null,[x,e.createImproveRun]),T=r.useMemo(()=>Ne(e.messages,{showThinkingIndicator:k}),[e.messages,k]),h=Ce(e.messages,e.sessionId??`draft:${e.id}`),u=e.messages.at(-1),de=[e.id,e.sessionId??"draft",T.length,u?.id??"",u?.content?.length??0,u?.timestamp??"",k?"thinking":""].join(":");r.useLayoutEffect(()=>{const i=b.current;if(i){if(!C.current){C.current=!0,i.scrollTop=p?.stickyToBottom?i.scrollHeight:p?.scrollTop??0;return}l.current&&(i.scrollTop=i.scrollHeight)}},[de,p]),r.useLayoutEffect(()=>{const i=b.current;if(!i||typeof MutationObserver>"u")return;l.current&&(i.scrollTop=i.scrollHeight);const c=new MutationObserver(()=>{l.current&&(i.scrollTop=i.scrollHeight)});return c.observe(i,{childList:!0,characterData:!0,subtree:!0}),()=>c.disconnect()},[e.id]);const I=r.useCallback((i,c)=>{const m=e.sessionId??`side-chat:${e.id}`;ke({conversationId:m,href:i,explicitFile:c?.explicitFile,newTab:c?.newTab}).then(a=>{a&&A()})},[A,e.id,e.sessionId]),M=r.useCallback(async(i,c)=>{const m=c.action==="answer"?c.text:"Dismiss this question";if(!await g([],null,null,{displayPrompt:m,promptOverride:m,turnMetadata:{userQuestionResolution:c}}))throw new Error("The question response could not be sent.")},[g]);return s.jsxs("section",{className:`right-chat-pane ${e.pendingApproval?"has-approval":""}`,id:`right-chat-panel-${e.id}`,role:"tabpanel","aria-labelledby":`right-chat-tab-${e.id}`,children:[s.jsx("div",{className:"chat-thread right-chat-thread",ref:b,onScroll:i=>{const c=i.currentTarget;l.current=c.scrollHeight-c.scrollTop-c.clientHeight<=72,ie({scrollTop:c.scrollTop,stickyToBottom:l.current})},children:T.map(i=>i.type==="thinking"?s.jsx(Te,{},i.id):s.jsx(Ie,{activeWorkspaceAppId:e.activeWorkspaceAppId,accountBaseUrl:q,billingOrganizationSlug:z,billingTeamId:K,connection:y,animateInitialContent:i.message.role==="assistant"&&h.has(i.message.id),message:i.message,onOpenBrowserLink:I,onOpenAttachmentInSidebar:_,onOpenFileInSidebar:G,onOpenProfileSettings:J,onResolveUserQuestion:M,onOpenSession:Y,userAttachmentDisplay:e.provider==="codex"?"compact":"full",workspaceRootPath:e.workspaceRootPath,showFooter:i.showFooter},i.id))}),s.jsxs("div",{className:`composer-stack dock right-chat-composer ${e.pendingApproval?"has-approval":""}`,children:[s.jsx(De,{approval:e.pendingApproval,onResolve:re}),s.jsx(Ee,{mode:"dock",prompt:e.prompt,mentionApps:B,connectedAppMentions:F,profileSkills:e.provider==="codex"?L:$,profileTarget:e.provider==="codex"?null:j,selectedMentionAppId:null,contextWindowStatus:e.contextWindowStatus,goalRuntime:e.goalRuntime,createImproveRuntime:ce,busy:e.running,running:e.running,submissionScopeKey:e.sessionId??e.id,steerAutoDispatchBlocked:e.steerAutoDispatchBlocked,steerAutoDispatchReady:e.steerAutoDispatchReady,showProjectFooter:!1,connection:y,providerSettings:H,provider:e.provider,model:e.model,projectTarget:O,actionCatalog:w,workspaceTarget:W,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:e.provider==="codex"?R:e.session?.openPondCommandAccessMode??R,onProviderChange:Z,onProviderSetupOpen:ee,onProjectTargetChange:oe,onWorkspaceTargetChange:ae,onModelChange:X,onCodexPermissionModeChange:U,onCodexReasoningEffortChange:Q,onOpenPondCommandAccessModeChange:P,onPromptChange:te,onProfileTargetChange:se,onMentionAppSelect:void 0,showToast:V,onSubmit:g,onStop:ne})]})]})}function _e({panels:e,actionCatalog:w=[],createImproveActions:x,busy:p,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:R,connection:y,connectedAppMentions:F,mentionApps:B,codexPersonalSkills:L,profileSkills:$=[],profileLibrary:j={lastUsed:null,profiles:[]},extensionCatalog:O,projectTarget:H,providerSettings:q,accountBaseUrl:z,billingOrganizationSlug:K,billingTeamId:V,showToast:W,workspaceTarget:U,onAddChat:Q,onActivatePanel:P,onClosePanel:X,onCodexPermissionModeChange:_,onCodexReasoningEffortChange:G,onOpenPondCommandAccessModeChange:J,onModelChange:Y,onOpenAttachmentInSidebar:Z,onOpenFileInSidebar:ee,onOpenProfileSettings:te,onOpenSession:se,onProviderChange:ie,onProviderSetupOpen:oe,onPromptChange:re,onProfileTargetChange:A,onScrollStateChange:ne,onProjectTargetChange:g,onResolveApproval:ae,onResizeStart:b,onSelectFiles:l,onShowBrowserPanel:C,onStop:k,onSubmit:ce,onWorkspaceTargetChange:T}){const[h,u]=r.useState(!1),[de,I]=r.useState(()=>ve(e)?.id??null),M=r.useRef(null),i=r.useRef(new Map),c=r.useRef(new Set(e.map(t=>t.id))),m=r.useRef(new Map(e.map(t=>[t.id,t.activationVersion]))),a=e.find(t=>t.id===de)??e.at(-1)??null,fe=a?.session?.currentProfile??j.lastUsed,N=we(j,fe),he=N?xe(N,O):$,me=N?[...w.filter(t=>!Re(t)),...ye(N)]:w;r.useEffect(()=>{const t=c.current,d=m.current;let n=null,f=null;for(const o of e)t.has(o.id)||(n=o),t.has(o.id)&&o.activationVersion>(d.get(o.id)??0)&&(f=o);c.current=new Set(e.map(o=>o.id)),m.current=new Map(e.map(o=>[o.id,o.activationVersion])),I(o=>f?f.id:n?n.id:o&&e.some(D=>D.id===o)?o:e.at(-1)?.id??null)},[e]),r.useEffect(()=>{if(!h)return;function t(n){M.current?.contains(n.target)||u(!1)}function d(n){n.key==="Escape"&&u(!1)}return document.addEventListener("pointerdown",t),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",t),document.removeEventListener("keydown",d)}},[h]);const v=r.useCallback((t,d=!1)=>{I(t),P(t),d&&window.requestAnimationFrame(()=>i.current.get(t)?.focus())},[P]),le=r.useCallback((t=!1)=>{l(),t&&window.requestAnimationFrame(()=>{document.getElementById("right-sidebar-files-tab")?.focus()})},[l]),pe=r.useCallback((t,d)=>{const n=e.findIndex(be=>be.id===d);if(n<0)return;const f=n+1;let o=null;if(t.key==="ArrowRight"&&(o=(f+1)%(e.length+1)),t.key==="ArrowLeft"&&(o=(f-1+e.length+1)%(e.length+1)),t.key==="Home"&&(o=0),t.key==="End"&&(o=e.length),o===null)return;if(t.preventDefault(),o===0){le(!0);return}const D=e[o-1];D&&v(D.id,!0)},[e,le,v]),ge=r.useCallback(t=>{if(!["ArrowRight","ArrowLeft","Home","End"].includes(t.key)||(t.preventDefault(),t.key==="Home"))return;const d=t.key==="ArrowLeft"||t.key==="End"?e.at(-1):e[0];d&&v(d.id,!0)},[e,v]);return s.jsxs("aside",{className:"workspace-diff-panel right-chat-panel-stack","aria-label":"Side chats",children:[s.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize side chat panel",onPointerDown:b}),s.jsx("div",{className:"workspace-diff-topbar right-chat-topbar",children:s.jsxs("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",children:[s.jsxs("button",{type:"button",className:"workspace-diff-tab",role:"tab",id:"right-sidebar-files-tab","aria-controls":"right-sidebar-files-panel","aria-selected":!1,tabIndex:-1,onClick:()=>le(!1),onKeyDown:ge,children:[s.jsx(ue,{size:14}),s.jsx("span",{children:"Files"})]}),e.map(t=>{const d=t.id===a?.id;return s.jsxs("div",{className:`workspace-diff-tab right-chat-tab ${d?"active":""}`,children:[s.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab",id:`right-chat-tab-${t.id}`,"aria-controls":`right-chat-panel-${t.id}`,"aria-selected":d,tabIndex:d?0:-1,title:t.title,ref:n=>{n?i.current.set(t.id,n):i.current.delete(t.id)},onClick:()=>v(t.id),onKeyDown:n=>pe(n,t.id),children:[t.running?s.jsx("span",{className:"right-chat-status-dot","aria-label":"Running"}):null,s.jsx("span",{children:t.title})]}),s.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${t.title}`,"aria-label":`Close ${t.title}`,onClick:n=>{n.stopPropagation(),X(t.id)},children:s.jsx(je,{size:12})})]},t.id)}),s.jsxs("div",{className:"workspace-diff-add-anchor",ref:M,children:[s.jsx("button",{type:"button",className:`workspace-diff-add-tab ${h?"active":""}`,title:"Add to right sidebar","aria-label":"Add to right sidebar","aria-haspopup":"menu","aria-expanded":h,onClick:()=>u(t=>!t),children:s.jsx(Pe,{size:15})}),h?s.jsxs("div",{className:"workspace-diff-add-menu right-chat-add-popover",role:"menu",children:[s.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{u(!1),Q()},children:[s.jsx(Ae,{size:13}),s.jsx("span",{children:"New task"})]}),s.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{u(!1),l()},children:[s.jsx(ue,{size:13}),s.jsx("span",{children:"Files"})]})]}):null]})]})}),s.jsx("div",{className:"right-chat-stack-body panes-1",children:a?s.jsx(Se,{busy:p,createImproveActions:x,codexPermissionMode:E,codexReasoningEffort:S,openPondCommandAccessMode:R,connection:y,connectedAppMentions:F,actionCatalog:me,mentionApps:B,codexPersonalSkills:L,profileSkills:he,profileTarget:null,panel:a,initialScrollState:{scrollTop:a.scrollTop,stickyToBottom:a.stickyToBottom},projectTarget:H,providerSettings:q,accountBaseUrl:z,billingOrganizationSlug:K,billingTeamId:V,showToast:W,workspaceTarget:U,onCodexPermissionModeChange:_,onCodexReasoningEffortChange:G,onOpenPondCommandAccessModeChange:t=>J(t,a.session),onModelChange:t=>Y(a.id,t),onOpenAttachmentInSidebar:Z,onOpenFileInSidebar:ee,onOpenProfileSettings:te,onOpenSession:se,onProviderChange:t=>ie(a.id,t),onProviderSetupOpen:oe,onPromptChange:t=>re(a.id,t),onProfileTargetChange:t=>A(a.sessionId,t),onScrollStateChange:t=>ne(a.id,t),onProjectTargetChange:g,onResolveApproval:ae,onShowBrowserPanel:C,onStop:()=>k(a.sessionId),onSubmit:(t,d,n,f)=>ce(a.id,t,d,n,f),onWorkspaceTargetChange:T},a.id):null})]})}export{_e as RightChatPanelStack};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,n as $,j as e,aL as oe,bT as ue,Z as he,X as me,b1 as G,A as xe,at as _,bU as fe}from"./index-Cxq5q-6B.js";import{u as je,R as X}from"./useLocalAgentSchedules-DRVUfTbv.js";import{M as pe,A as be,T as ye,P as J}from"./MarkdownText-CzZ60aWs.js";import{P as Q}from"./play-DGCzapdE.js";import{R as ve}from"./refresh-cw-BKF4NhDI.js";import{S as ge}from"./save-DQXtfx_4.js";const we=3e4;function Ne(s){const[t,n]=i.useState([]),[l,d]=i.useState([]),[j,u]=i.useState(null),[o,a]=i.useState(!1),[r,f]=i.useState(null),[R,v]=i.useState(()=>new Set);async function N(c,p){p&&a(!0);try{const y=await $.hostedSavedWork(c);n(y.definitions),d(y.runs),u(y.webBaseUrl??null),f(null)}catch(y){f(U(y))}finally{p&&a(!1)}}i.useEffect(()=>{if(!s){n([]),d([]),u(null),f(null),a(!1);return}let c=!1;const p=async k=>{if(!c){k&&a(!0);try{const w=await $.hostedSavedWork(s);if(c)return;n(w.definitions),d(w.runs),u(w.webBaseUrl??null),f(null)}catch(w){c||f(U(w))}finally{!c&&k&&a(!1)}}};p(!0);const y=window.setInterval(()=>{p(!1)},we);return()=>{c=!0,window.clearInterval(y)}},[s]);async function b(){s&&await N(s,!0)}async function D(c){s&&(await $.createHostedSavedWork(s,c),await N(s,!1))}async function A(c,p){await x(c,async y=>{await $.updateHostedSavedWork(y,c,p)})}async function S(c){await x(c,async p=>{await $.deleteHostedSavedWork(p,c)})}async function E(c){await x(c,async p=>{await $.runHostedSavedWork(p,c,crypto.randomUUID())})}async function x(c,p){if(!(!s||R.has(c))){g(c,!0);try{await p(s),await N(s,!1)}catch(y){throw f(U(y)),y}finally{g(c,!1)}}}function g(c,p){v(y=>{const k=new Set(y);return p?k.add(c):k.delete(c),k})}return{create:D,definitions:t,error:r,loading:o,pendingScheduleIds:R,refresh:b,remove:S,run:E,runs:l,update:A,webBaseUrl:j}}function U(s){return s instanceof Error?s.message:String(s)}const ee="openpond.scheduled-work.view.v1";function Se(s=se()){try{return s?.getItem(ee)==="list"?"list":"calendar"}catch{return"calendar"}}function ke(s,t=se()){try{t?.setItem(ee,s)}catch{}}function se(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function M(s,t){if(!s)return"None";const n=new Date(s);if(!Number.isFinite(n.getTime()))return"None";try{return n.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",...t?{timeZone:t,timeZoneName:"short"}:{}})}catch{return n.toLocaleString()}}function te(s){return F(s.replaceAll("_"," "))}function F(s){return s.replace(/^./,t=>t.toUpperCase())}function Re({run:s}){const t=s.error||s.stderr||s.stdout;return e.jsxs("details",{className:"scheduled-run-row",children:[e.jsxs("summary",{children:[e.jsxs("span",{children:[e.jsx("strong",{children:te(s.status)}),e.jsx("small",{children:M(s.createdAt,null)})]}),e.jsx("span",{className:"scheduled-run-trigger",children:s.trigger==="manual"?"Manual":"Scheduled"})]}),t?e.jsx("pre",{children:t}):null]})}function De({onOpen:s,run:t}){return e.jsxs("button",{className:"scheduled-run-row hosted",onClick:s,type:"button",children:[e.jsxs("span",{children:[e.jsx("strong",{children:te(t.status)}),e.jsx("small",{children:M(t.createdAt,null)})]}),e.jsxs("span",{className:"scheduled-run-trigger",children:[F(t.triggerKind)," ",e.jsx(G,{size:11})]}),t.deliveryError?e.jsx("p",{children:t.deliveryError}):null]})}function ne({children:s,detailExpanded:t,label:n,onClose:l,onDetailResizeStart:d,onToggleDetailExpanded:j}){return e.jsxs("aside",{"aria-label":n,className:`workspace-diff-panel scheduled-detail${t?" expanded":""}`,children:[t?null:e.jsx("div",{"aria-label":"Resize schedule details","aria-orientation":"vertical",className:"workspace-diff-resize-handle",onPointerDown:d,role:"separator"}),e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Schedule details",children:e.jsxs("button",{"aria-selected":"true",className:"workspace-diff-tab active",role:"tab",type:"button",children:[e.jsx(ue,{size:14}),e.jsx("span",{children:"Schedule"})]})}),e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsx("button",{"aria-label":t?"Dock schedule details":"Expand schedule details",className:"diff-icon-button",onClick:j,title:t?"Dock schedule details":"Expand schedule details",type:"button",children:t?e.jsx(pe,{size:14}):e.jsx(he,{size:14})}),e.jsx("button",{"aria-label":"Close schedule details",className:"diff-icon-button",onClick:l,title:"Close schedule details",type:"button",children:e.jsx(me,{size:14})})]})]}),e.jsx("div",{className:"scheduled-detail-body",children:s})]})}function T({children:s,title:t}){return e.jsxs("section",{className:"scheduled-detail-section",children:[e.jsx("div",{className:"scheduled-detail-section-heading",children:e.jsx("h3",{children:t})}),s]})}function C({label:s,value:t}){return e.jsxs("div",{children:[e.jsx("dt",{children:s}),e.jsx("dd",{children:t})]})}function O({children:s}){return e.jsx("p",{className:"scheduled-empty",children:s})}function le({label:s}){return e.jsxs("div",{className:"scheduled-loading",role:"status",children:[e.jsx(oe,{className:"scheduled-spin",size:16}),e.jsx("span",{children:s})]})}const Ae=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Ce({items:s,onSelect:t,selectedKey:n}){const[l,d]=i.useState(()=>q(new Date)),j=i.useMemo(()=>$e(l),[l]),u=i.useMemo(()=>Me(s),[s]),o=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}).format(l),a=s.filter(r=>!ae(r.nextRunAt));return e.jsxs("div",{className:"scheduled-calendar",children:[e.jsxs("div",{className:"scheduled-calendar-toolbar",children:[e.jsx("strong",{children:o}),e.jsxs("div",{children:[e.jsx("button",{"aria-label":"Previous month",className:"scheduled-icon-button",onClick:()=>d(V(l,-1)),type:"button",children:e.jsx(xe,{size:15})}),e.jsx("button",{className:"scheduled-calendar-today",onClick:()=>d(q(new Date)),type:"button",children:"Today"}),e.jsx("button",{"aria-label":"Next month",className:"scheduled-icon-button",onClick:()=>d(V(l,1)),type:"button",children:e.jsx(be,{size:15})})]})]}),e.jsxs("div",{className:"scheduled-calendar-grid",role:"grid","aria-label":o,children:[Ae.map(r=>e.jsx("div",{className:"scheduled-calendar-weekday",role:"columnheader",children:r},r)),j.map(r=>{const f=K(r),R=u.get(f)??[],v=r.getMonth()!==l.getMonth(),N=f===K(new Date);return e.jsxs("div",{className:`scheduled-calendar-day${v?" outside":""}${N?" today":""}`,role:"gridcell",children:[e.jsx("span",{className:"scheduled-calendar-day-number",children:r.getDate()}),e.jsx("div",{className:"scheduled-calendar-events",children:R.map(b=>e.jsxs("button",{"aria-current":n===b.key?"true":void 0,className:`scheduled-calendar-event${b.enabled?"":" paused"}`,onClick:()=>t(b.key),title:b.title,type:"button",children:[e.jsx("span",{children:Ee(b.nextRunAt)}),e.jsx("strong",{children:b.title})]},b.key))})]},f)})]}),a.length?e.jsxs("div",{className:"scheduled-calendar-unscheduled",children:[e.jsx("span",{children:"No upcoming run"}),e.jsx("div",{children:a.map(r=>e.jsx("button",{onClick:()=>t(r.key),type:"button",children:r.title},r.key))})]}):null]})}function $e(s){const t=new Date(s.getFullYear(),s.getMonth(),1),n=new Date(t);return n.setDate(t.getDate()-t.getDay()),Array.from({length:42},(l,d)=>{const j=new Date(n);return j.setDate(n.getDate()+d),j})}function Me(s){const t=new Map;for(const n of s){const l=ae(n.nextRunAt);if(!l)continue;const d=K(l);t.set(d,[...t.get(d)??[],n])}for(const n of t.values())n.sort((l,d)=>l.nextRunAt.localeCompare(d.nextRunAt));return t}function ae(s){if(!s)return null;const t=new Date(s);return Number.isNaN(t.getTime())?null:t}function K(s){return`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`}function q(s){return new Date(s.getFullYear(),s.getMonth(),1)}function V(s,t){return new Date(s.getFullYear(),s.getMonth()+t,1)}function Ee(s){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(new Date(s))}function Te({cadence:s,onSelect:t,schedule:n,selected:l}){return e.jsxs("button",{"aria-current":l?"true":void 0,className:"scheduled-list-row",onClick:t,type:"button",children:[e.jsx("span",{className:`scheduled-status-dot ${n.enabled?"active":"paused"}`}),e.jsxs("span",{className:"scheduled-list-copy",children:[e.jsx("span",{className:"scheduled-list-title",children:e.jsx("strong",{children:n.scheduleName})}),e.jsx("span",{children:n.localProjectName}),e.jsxs("small",{children:[s,n.nextRunAt?` · Next ${M(n.nextRunAt,n.timezone)}`:" · No next run"]})]})]})}function Le({cadence:s,definition:t,onSelect:n,schedule:l,selected:d}){return e.jsxs("button",{"aria-current":d?"true":void 0,className:"scheduled-list-row",onClick:n,type:"button",children:[e.jsx("span",{className:`scheduled-status-dot ${l.enabled?"active":"paused"}`}),e.jsxs("span",{className:"scheduled-list-copy",children:[e.jsxs("span",{className:"scheduled-list-title",children:[e.jsx("strong",{children:t.name}),e.jsx("small",{className:"scheduled-environment-badge hosted",children:"Hosted"})]}),e.jsx("span",{children:t.prompt}),e.jsxs("small",{children:[s,l.nextRunAt?` · Next ${M(l.nextRunAt,l.timeZone)}`:" · No next run"]})]})]})}const ze=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ts({connection:s,detailOpen:t,detailExpanded:n,onDetailOpenChange:l,onDetailResizeStart:d,onToggleDetailExpanded:j}){const u=Ne(s),o=je(s),[a,r]=i.useState("all"),[f,R]=i.useState(Se),[v,N]=i.useState(!1),[b,D]=i.useState(null),A=i.useMemo(()=>Pe(u.definitions),[u.definitions]),S=i.useMemo(()=>Fe(A,a),[a,A]),E=i.useMemo(()=>Ze(o.schedules,a),[a,o.schedules]),x=A.find(h=>I(h.schedule.id)===b)??null,g=o.schedules.find(h=>W(h.id)===b)??null,c=x?u.runs.filter(h=>h.scheduleId===x.schedule.id):[],p=i.useMemo(()=>Ue(E,S),[E,S]),y=i.useMemo(()=>p.map(Oe),[p]);_(u.error,{prefix:"Scheduled Work"}),_(o.error,{prefix:"Local schedules"}),i.useEffect(()=>{b&&!x&&!g&&D(null)},[x,g,b]),i.useEffect(()=>{!t&&b&&D(null)},[t,b]),i.useEffect(()=>()=>l(!1),[l]);function k(h){D(h),l(!0)}function w(){D(null),l(!1)}function P(h){R(h),ke(h)}async function z(){N(!0);try{await Promise.all([u.refresh(),o.refresh()])}finally{N(!1)}}return e.jsxs("section",{"aria-label":"Scheduled work",className:`scheduled-work-view${x||g?" detail-open":""}${n?" detail-expanded":""}`,children:[e.jsx("div",{className:"scheduled-work-scroll",children:e.jsxs("div",{className:"scheduled-work-content",children:[e.jsxs("header",{className:"scheduled-work-header",children:[e.jsxs("div",{"aria-label":"Scheduled view",className:"scheduled-view-tabs",role:"tablist",children:[e.jsx("button",{"aria-selected":f==="calendar",className:f==="calendar"?"active":void 0,onClick:()=>P("calendar"),role:"tab",type:"button",children:"Calendar"}),e.jsx("button",{"aria-selected":f==="list",className:f==="list"?"active":void 0,onClick:()=>P("list"),role:"tab",type:"button",children:"List"})]}),e.jsxs("div",{className:"scheduled-work-header-actions",children:[e.jsx("button",{"aria-label":"Refresh schedules",className:"scheduled-icon-button",disabled:!s||u.loading||o.loading,onClick:()=>{z()},title:"Refresh schedules",type:"button",children:e.jsx(ve,{className:v?"scheduled-spin":void 0,size:16})}),e.jsxs("label",{className:"scheduled-filter",children:[e.jsx(fe,{"aria-hidden":"true",size:16}),e.jsxs("select",{"aria-label":"Schedule filter",onChange:h=>r(h.target.value),value:a,children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"paused",children:"Paused"}),e.jsx("option",{value:"all",children:"All"})]})]})]})]}),e.jsx("section",{"aria-busy":u.loading||o.loading,className:"scheduled-list",children:s?(u.loading||o.loading)&&A.length===0&&o.schedules.length===0?e.jsx(le,{label:"Loading schedules"}):u.error&&o.error&&A.length===0&&o.schedules.length===0?e.jsx(O,{children:"Schedules are unavailable. Refresh to try again."}):p.length===0?e.jsx(O,{children:"Create a scheduled task here or ask for one in Work."}):f==="calendar"?e.jsx(Ce,{items:y,onSelect:k,selectedKey:b}):e.jsx("div",{className:"scheduled-list-rows",children:p.map(h=>h.kind==="local"?e.jsx(Te,{cadence:re(h.schedule),onSelect:()=>k(W(h.schedule.id)),schedule:h.schedule,selected:b===W(h.schedule.id)},W(h.schedule.id)):e.jsx(Le,{cadence:_e(h.row.schedule),definition:h.row.definition,onSelect:()=>k(I(h.row.schedule.id)),schedule:h.row.schedule,selected:b===I(h.row.schedule.id)},I(h.row.schedule.id)))}):e.jsx(O,{children:"Connect to OpenPond to view scheduled Work."})})]})}),x?e.jsx(Ie,{onClose:w,onDelete:async()=>{await u.remove(x.schedule.id),w()},onRun:()=>u.run(x.schedule.id),onSave:h=>u.update(x.schedule.id,h),onToggle:()=>u.update(x.schedule.id,{enabled:!x.schedule.enabled}),pending:u.pendingScheduleIds.has(x.schedule.id),row:x,runs:c,detailExpanded:n,onDetailResizeStart:d,onToggleDetailExpanded:j,webBaseUrl:u.webBaseUrl},`${x.schedule.id}:${x.definition.version}:${x.schedule.configurationVersion}`):g?e.jsx(We,{connection:s,onClose:w,onRun:()=>o.run(g),onToggle:()=>o.toggle(g),pending:o.pendingScheduleIds.has(g.id),schedule:g,detailExpanded:n,onDetailResizeStart:d,onToggleDetailExpanded:j},g.id):null]})}function We({connection:s,detailExpanded:t,onClose:n,onDetailResizeStart:l,onRun:d,onToggleDetailExpanded:j,onToggle:u,pending:o,schedule:a}){const r=qe(s,a.id);return _(r.error,{prefix:"Local schedule runs"}),e.jsxs(ne,{detailExpanded:t,label:`${a.scheduleName} details`,onClose:n,onDetailResizeStart:l,onToggleDetailExpanded:j,children:[e.jsx("div",{className:"scheduled-detail-header",children:e.jsxs("div",{children:[e.jsxs("div",{className:"scheduled-detail-title-row",children:[e.jsx("h2",{children:"Schedule details"}),e.jsx("span",{children:a.enabled?"Active":"Paused"})]}),e.jsx("p",{children:a.scheduleName})]})}),e.jsxs(T,{title:"Task",children:[e.jsxs("dl",{className:"scheduled-detail-fields",children:[e.jsx(C,{label:"Environment",value:"Local"}),e.jsx(C,{label:"Project",value:a.localProjectName}),e.jsx(C,{label:"Agent",value:a.agentName}),e.jsx(C,{label:"Action",value:a.targetAction})]}),e.jsx("pre",{className:"scheduled-prompt",children:He(a)})]}),e.jsxs(T,{title:"Schedule",children:[e.jsxs("dl",{className:"scheduled-detail-fields",children:[e.jsx(C,{label:"Cadence",value:re(a)}),e.jsx(C,{label:"Expression",value:a.scheduleExpression}),e.jsx(C,{label:"Timezone",value:a.timezone??"Local time"}),e.jsx(C,{label:"Next run",value:M(a.nextRunAt,a.timezone)}),e.jsx(C,{label:"Last run",value:M(a.lastRunAt,a.timezone)})]}),a.lastError?e.jsx("p",{className:"scheduled-detail-error",children:a.lastError}):null]}),e.jsxs("div",{className:"scheduled-detail-actions",children:[e.jsxs("button",{disabled:o,onClick:()=>{d()},type:"button",children:[e.jsx(X,{size:15}),e.jsx("span",{children:"Run now"})]}),e.jsxs("button",{disabled:o,onClick:()=>{u()},type:"button",children:[a.enabled?e.jsx(J,{size:15}):e.jsx(Q,{size:15}),e.jsx("span",{children:a.enabled?"Pause":"Resume"})]})]}),e.jsx(T,{title:"Runs",children:r.loading&&r.runs.length===0?e.jsx(le,{label:"Loading runs"}):r.runs.length===0?e.jsx("p",{className:"scheduled-no-runs",children:"No runs yet."}):e.jsx("div",{className:"scheduled-run-list",children:r.runs.map(f=>e.jsx(Re,{run:f},f.id))})})]})}function Ie({detailExpanded:s,onClose:t,onDelete:n,onDetailResizeStart:l,onRun:d,onSave:j,onToggleDetailExpanded:u,onToggle:o,pending:a,row:r,runs:f,webBaseUrl:R}){const v=Ke(r.schedule),[N,b]=i.useState(r.definition.name),[D,A]=i.useState(r.definition.prompt),[S,E]=i.useState(v.kind),[x,g]=i.useState(v.timeZone),[c,p]=i.useState(v.startDate),[y,k]=i.useState(v.localTime),[w,P]=i.useState(v.weekdays?.[0]??"monday"),[z,h]=i.useState(v.dayOfMonth??1),H=f[0]?.conversationId??null,Z=R?Y(R,H):null,de=N!==r.definition.name||D!==r.definition.prompt||S!==v.kind||x!==v.timeZone||c!==v.startDate||y!==v.localTime||w!==(v.weekdays?.[0]??"monday")||z!==(v.dayOfMonth??1);async function ce(m){m.preventDefault(),await j({name:N,prompt:D,recurrence:{version:1,kind:S,timeZone:x,startDate:c,localTime:y,end:{kind:"never"},...S==="weekly"?{weekdays:[w]}:{},...S==="monthly"?{dayOfMonth:z}:{}}})}return e.jsx(ne,{detailExpanded:s,label:`${r.definition.name} details`,onClose:t,onDetailResizeStart:l,onToggleDetailExpanded:u,children:e.jsxs("form",{onSubmit:ce,children:[e.jsxs("div",{className:"scheduled-detail-header",children:[e.jsx("div",{children:e.jsxs("div",{className:"scheduled-detail-title-row",children:[e.jsx("h2",{children:"Schedule details"}),e.jsx("span",{children:r.schedule.enabled?"Active":"Paused"})]})}),e.jsx("div",{className:"scheduled-detail-header-controls",children:e.jsx("button",{"aria-label":"Delete schedule",className:"scheduled-icon-button",disabled:a,onClick:()=>{n()},title:"Delete schedule",type:"button",children:e.jsx(ye,{size:16})})})]}),e.jsxs(T,{title:"Task",children:[e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Name"}),e.jsx("input",{maxLength:180,onChange:m=>b(m.target.value),required:!0,value:N})]}),e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Prompt"}),e.jsx("textarea",{onChange:m=>A(m.target.value),required:!0,value:D})]})]}),e.jsxs(T,{title:"Schedule",children:[e.jsxs("div",{className:"scheduled-field-grid",children:[e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Repeat"}),e.jsxs("select",{onChange:m=>E(m.target.value),value:S,children:[e.jsx("option",{value:"once",children:"Once"}),e.jsx("option",{value:"daily",children:"Daily"}),e.jsx("option",{value:"weekdays",children:"Weekdays"}),e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"})]})]}),S==="weekly"?e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Day"}),e.jsx("select",{onChange:m=>P(m.target.value),value:w,children:ze.map(m=>e.jsx("option",{value:m,children:F(m)},m))})]}):S==="monthly"?e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Day of month"}),e.jsx("input",{max:31,min:1,onChange:m=>h(Number(m.target.value)),type:"number",value:z})]}):null,e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Start date"}),e.jsx("input",{onChange:m=>p(m.target.value),required:!0,type:"date",value:c})]}),e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Time"}),e.jsx("input",{onChange:m=>k(m.target.value),required:!0,type:"time",value:y})]}),e.jsxs("label",{className:"scheduled-field scheduled-field-wide",children:[e.jsx("span",{children:"Timezone"}),e.jsx("input",{onChange:m=>g(m.target.value),required:!0,value:x})]})]}),e.jsxs("p",{className:"scheduled-next-run",children:["Next run: ",M(r.schedule.nextRunAt,v.timeZone)]})]}),e.jsxs("div",{className:"scheduled-detail-actions",children:[de?e.jsxs("button",{disabled:a,type:"submit",children:[e.jsx(ge,{size:15}),e.jsx("span",{children:"Save"})]}):null,e.jsxs("button",{disabled:a,onClick:()=>{d()},type:"button",children:[e.jsx(X,{size:15}),e.jsx("span",{children:"Run now"})]}),e.jsxs("button",{disabled:a,onClick:()=>{o()},type:"button",children:[r.schedule.enabled?e.jsx(J,{size:15}):e.jsx(Q,{size:15}),e.jsx("span",{children:r.schedule.enabled?"Pause":"Resume"})]})]}),e.jsxs("button",{className:"scheduled-open-chat",disabled:a||!Z,onClick:()=>{Z&&B(Z,H)},type:"button",children:[e.jsx("span",{children:"Open hosted chat"}),e.jsx(G,{size:14})]}),e.jsx(T,{title:"Runs",children:f.length===0?e.jsx("p",{className:"scheduled-no-runs",children:"No runs yet."}):e.jsx("div",{className:"scheduled-run-list",children:f.map(m=>e.jsx(De,{onOpen:()=>{R&&B(Y(R,m.conversationId),m.conversationId)},run:m},m.id))})})]})})}function Pe(s){return s.flatMap(t=>t.schedules.map(n=>({definition:t,schedule:n})))}function Fe(s,t){return s.filter(n=>t==="active"?n.schedule.enabled:t==="paused"?!n.schedule.enabled:!0).sort((n,l)=>L(n.schedule.nextRunAt)-L(l.schedule.nextRunAt)||n.definition.name.localeCompare(l.definition.name))}function Ze(s,t){return s.filter(n=>t==="active"?n.enabled:t==="paused"?!n.enabled:!0).sort((n,l)=>L(n.nextRunAt)-L(l.nextRunAt)||n.scheduleName.localeCompare(l.scheduleName))}function Ue(s,t){return[...s.map(n=>({kind:"local",schedule:n})),...t.map(n=>({kind:"hosted",row:n}))].sort((n,l)=>{const d=L(n.kind==="local"?n.schedule.nextRunAt:n.row.schedule.nextRunAt),j=L(l.kind==="local"?l.schedule.nextRunAt:l.row.schedule.nextRunAt);if(d!==j)return d-j;const u=n.kind==="local"?n.schedule.scheduleName:n.row.definition.name,o=l.kind==="local"?l.schedule.scheduleName:l.row.definition.name;return u.localeCompare(o)})}function Oe(s){return s.kind==="local"?{enabled:s.schedule.enabled,key:W(s.schedule.id),nextRunAt:s.schedule.nextRunAt,title:s.schedule.scheduleName}:{enabled:s.row.schedule.enabled,key:I(s.row.schedule.id),nextRunAt:s.row.schedule.nextRunAt,title:s.row.definition.name}}function _e(s){const t=s.recurrence;if(!t)return s.expression??"Manual";const n=ie(t.localTime);return t.kind==="once"?`Once on ${t.startDate} at ${n} · ${t.timeZone}`:t.kind==="weekdays"?`Weekdays at ${n} · ${t.timeZone}`:t.kind==="weekly"?`${t.weekdays?.map(F).join(", ")??"Weekly"} at ${n} · ${t.timeZone}`:t.kind==="monthly"?`Monthly on day ${t.dayOfMonth??1} at ${n} · ${t.timeZone}`:`Daily at ${n} · ${t.timeZone}`}function re(s){const t=s.timezone?` · ${s.timezone}`:"";if(s.scheduleType==="rate")return`Every ${s.scheduleExpression}${t}`;const n=s.scheduleExpression.trim().split(/\s+/);if(n.length===5&&/^\d+$/.test(n[0])&&/^\d+$/.test(n[1])){const l=ie(`${n[1].padStart(2,"0")}:${n[0].padStart(2,"0")}`);if(n[2]==="*"&&n[3]==="*"&&n[4]==="*")return`Daily at ${l}${t}`;if(n[2]==="*"&&n[3]==="*"&&n[4]==="MON-FRI")return`Weekdays at ${l}${t}`}return`Cron ${s.scheduleExpression}${t}`}function Ke(s){return s.recurrence??{version:1,kind:"daily",timeZone:s.timeZone||Ye(),startDate:Ve(),localTime:"08:00",end:{kind:"never"}}}function He(s){const t=s.input.prompt;return typeof t=="string"&&t.trim()?t.trim():Object.keys(s.input).length>0?JSON.stringify(s.input,null,2):"No task input configured."}function qe(s,t){const[n,l]=i.useState([]),[d,j]=i.useState(!1),[u,o]=i.useState(null);return i.useEffect(()=>{if(!s){l([]),j(!1),o(null);return}let a=!1;return j(!0),$.localAgentScheduleRuns(s,t,{limit:20}).then(r=>{a||(l(r.runs),o(null))}).catch(r=>{a||o(Be(r))}).finally(()=>{a||j(!1)}),()=>{a=!0}},[s,t]),{error:u,loading:d,runs:n}}function W(s){return`local:${s}`}function I(s){return`hosted:${s}`}function Y(s,t){const n=new URL(s);return n.pathname=t?`/sandboxes/work/${encodeURIComponent(t)}`:"/sandboxes/work",n.search="",n.hash="",n.toString()}async function B(s,t){const n=window.openpond?.browser;n?.openExternal&&(await n.openExternal({conversationId:t??"hosted-scheduled-work",url:s})).ok||window.open(s,"_blank","noopener,noreferrer")}function ie(s){const[t="0",n="00"]=s.split(":");return new Date(2020,0,1,Number(t),Number(n)).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function L(s){if(!s)return Number.MAX_SAFE_INTEGER;const t=new Date(s).getTime();return Number.isFinite(t)?t:Number.MAX_SAFE_INTEGER}function Ve(){return new Date().toISOString().slice(0,10)}function Ye(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}function Be(s){return s instanceof Error?s.message:String(s)}export{ts as ScheduledWorkPage,Ue as combineScheduleRows,Ze as filterAndSortLocalSchedules,Fe as filterAndSortSchedules,M as formatScheduledRunAt,Y as hostedConversationUrl,re as localScheduleCadence,_e as scheduleCadence,Pe as scheduledRows};
|
|
1
|
+
import{r as i,n as $,j as e,aL as oe,bT as ue,Z as he,X as me,b1 as G,A as xe,at as _,bU as fe}from"./index-CDJX5ZxL.js";import{u as je,R as X}from"./useLocalAgentSchedules-QY4_XS2F.js";import{M as pe,A as be,T as ye,P as J}from"./MarkdownText-_JhfBcQL.js";import{P as Q}from"./play-lC5KpmRD.js";import{R as ve}from"./refresh-cw-8a_wz4tX.js";import{S as ge}from"./save-Dj9ex3Ce.js";const we=3e4;function Ne(s){const[t,n]=i.useState([]),[l,d]=i.useState([]),[j,u]=i.useState(null),[o,a]=i.useState(!1),[r,f]=i.useState(null),[R,v]=i.useState(()=>new Set);async function N(c,p){p&&a(!0);try{const y=await $.hostedSavedWork(c);n(y.definitions),d(y.runs),u(y.webBaseUrl??null),f(null)}catch(y){f(U(y))}finally{p&&a(!1)}}i.useEffect(()=>{if(!s){n([]),d([]),u(null),f(null),a(!1);return}let c=!1;const p=async k=>{if(!c){k&&a(!0);try{const w=await $.hostedSavedWork(s);if(c)return;n(w.definitions),d(w.runs),u(w.webBaseUrl??null),f(null)}catch(w){c||f(U(w))}finally{!c&&k&&a(!1)}}};p(!0);const y=window.setInterval(()=>{p(!1)},we);return()=>{c=!0,window.clearInterval(y)}},[s]);async function b(){s&&await N(s,!0)}async function D(c){s&&(await $.createHostedSavedWork(s,c),await N(s,!1))}async function A(c,p){await x(c,async y=>{await $.updateHostedSavedWork(y,c,p)})}async function S(c){await x(c,async p=>{await $.deleteHostedSavedWork(p,c)})}async function E(c){await x(c,async p=>{await $.runHostedSavedWork(p,c,crypto.randomUUID())})}async function x(c,p){if(!(!s||R.has(c))){g(c,!0);try{await p(s),await N(s,!1)}catch(y){throw f(U(y)),y}finally{g(c,!1)}}}function g(c,p){v(y=>{const k=new Set(y);return p?k.add(c):k.delete(c),k})}return{create:D,definitions:t,error:r,loading:o,pendingScheduleIds:R,refresh:b,remove:S,run:E,runs:l,update:A,webBaseUrl:j}}function U(s){return s instanceof Error?s.message:String(s)}const ee="openpond.scheduled-work.view.v1";function Se(s=se()){try{return s?.getItem(ee)==="list"?"list":"calendar"}catch{return"calendar"}}function ke(s,t=se()){try{t?.setItem(ee,s)}catch{}}function se(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function M(s,t){if(!s)return"None";const n=new Date(s);if(!Number.isFinite(n.getTime()))return"None";try{return n.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",...t?{timeZone:t,timeZoneName:"short"}:{}})}catch{return n.toLocaleString()}}function te(s){return F(s.replaceAll("_"," "))}function F(s){return s.replace(/^./,t=>t.toUpperCase())}function Re({run:s}){const t=s.error||s.stderr||s.stdout;return e.jsxs("details",{className:"scheduled-run-row",children:[e.jsxs("summary",{children:[e.jsxs("span",{children:[e.jsx("strong",{children:te(s.status)}),e.jsx("small",{children:M(s.createdAt,null)})]}),e.jsx("span",{className:"scheduled-run-trigger",children:s.trigger==="manual"?"Manual":"Scheduled"})]}),t?e.jsx("pre",{children:t}):null]})}function De({onOpen:s,run:t}){return e.jsxs("button",{className:"scheduled-run-row hosted",onClick:s,type:"button",children:[e.jsxs("span",{children:[e.jsx("strong",{children:te(t.status)}),e.jsx("small",{children:M(t.createdAt,null)})]}),e.jsxs("span",{className:"scheduled-run-trigger",children:[F(t.triggerKind)," ",e.jsx(G,{size:11})]}),t.deliveryError?e.jsx("p",{children:t.deliveryError}):null]})}function ne({children:s,detailExpanded:t,label:n,onClose:l,onDetailResizeStart:d,onToggleDetailExpanded:j}){return e.jsxs("aside",{"aria-label":n,className:`workspace-diff-panel scheduled-detail${t?" expanded":""}`,children:[t?null:e.jsx("div",{"aria-label":"Resize schedule details","aria-orientation":"vertical",className:"workspace-diff-resize-handle",onPointerDown:d,role:"separator"}),e.jsxs("div",{className:"workspace-diff-topbar",children:[e.jsx("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Schedule details",children:e.jsxs("button",{"aria-selected":"true",className:"workspace-diff-tab active",role:"tab",type:"button",children:[e.jsx(ue,{size:14}),e.jsx("span",{children:"Schedule"})]})}),e.jsxs("div",{className:"workspace-diff-toolbar-actions",children:[e.jsx("button",{"aria-label":t?"Dock schedule details":"Expand schedule details",className:"diff-icon-button",onClick:j,title:t?"Dock schedule details":"Expand schedule details",type:"button",children:t?e.jsx(pe,{size:14}):e.jsx(he,{size:14})}),e.jsx("button",{"aria-label":"Close schedule details",className:"diff-icon-button",onClick:l,title:"Close schedule details",type:"button",children:e.jsx(me,{size:14})})]})]}),e.jsx("div",{className:"scheduled-detail-body",children:s})]})}function T({children:s,title:t}){return e.jsxs("section",{className:"scheduled-detail-section",children:[e.jsx("div",{className:"scheduled-detail-section-heading",children:e.jsx("h3",{children:t})}),s]})}function C({label:s,value:t}){return e.jsxs("div",{children:[e.jsx("dt",{children:s}),e.jsx("dd",{children:t})]})}function O({children:s}){return e.jsx("p",{className:"scheduled-empty",children:s})}function le({label:s}){return e.jsxs("div",{className:"scheduled-loading",role:"status",children:[e.jsx(oe,{className:"scheduled-spin",size:16}),e.jsx("span",{children:s})]})}const Ae=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Ce({items:s,onSelect:t,selectedKey:n}){const[l,d]=i.useState(()=>q(new Date)),j=i.useMemo(()=>$e(l),[l]),u=i.useMemo(()=>Me(s),[s]),o=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}).format(l),a=s.filter(r=>!ae(r.nextRunAt));return e.jsxs("div",{className:"scheduled-calendar",children:[e.jsxs("div",{className:"scheduled-calendar-toolbar",children:[e.jsx("strong",{children:o}),e.jsxs("div",{children:[e.jsx("button",{"aria-label":"Previous month",className:"scheduled-icon-button",onClick:()=>d(V(l,-1)),type:"button",children:e.jsx(xe,{size:15})}),e.jsx("button",{className:"scheduled-calendar-today",onClick:()=>d(q(new Date)),type:"button",children:"Today"}),e.jsx("button",{"aria-label":"Next month",className:"scheduled-icon-button",onClick:()=>d(V(l,1)),type:"button",children:e.jsx(be,{size:15})})]})]}),e.jsxs("div",{className:"scheduled-calendar-grid",role:"grid","aria-label":o,children:[Ae.map(r=>e.jsx("div",{className:"scheduled-calendar-weekday",role:"columnheader",children:r},r)),j.map(r=>{const f=K(r),R=u.get(f)??[],v=r.getMonth()!==l.getMonth(),N=f===K(new Date);return e.jsxs("div",{className:`scheduled-calendar-day${v?" outside":""}${N?" today":""}`,role:"gridcell",children:[e.jsx("span",{className:"scheduled-calendar-day-number",children:r.getDate()}),e.jsx("div",{className:"scheduled-calendar-events",children:R.map(b=>e.jsxs("button",{"aria-current":n===b.key?"true":void 0,className:`scheduled-calendar-event${b.enabled?"":" paused"}`,onClick:()=>t(b.key),title:b.title,type:"button",children:[e.jsx("span",{children:Ee(b.nextRunAt)}),e.jsx("strong",{children:b.title})]},b.key))})]},f)})]}),a.length?e.jsxs("div",{className:"scheduled-calendar-unscheduled",children:[e.jsx("span",{children:"No upcoming run"}),e.jsx("div",{children:a.map(r=>e.jsx("button",{onClick:()=>t(r.key),type:"button",children:r.title},r.key))})]}):null]})}function $e(s){const t=new Date(s.getFullYear(),s.getMonth(),1),n=new Date(t);return n.setDate(t.getDate()-t.getDay()),Array.from({length:42},(l,d)=>{const j=new Date(n);return j.setDate(n.getDate()+d),j})}function Me(s){const t=new Map;for(const n of s){const l=ae(n.nextRunAt);if(!l)continue;const d=K(l);t.set(d,[...t.get(d)??[],n])}for(const n of t.values())n.sort((l,d)=>l.nextRunAt.localeCompare(d.nextRunAt));return t}function ae(s){if(!s)return null;const t=new Date(s);return Number.isNaN(t.getTime())?null:t}function K(s){return`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`}function q(s){return new Date(s.getFullYear(),s.getMonth(),1)}function V(s,t){return new Date(s.getFullYear(),s.getMonth()+t,1)}function Ee(s){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(new Date(s))}function Te({cadence:s,onSelect:t,schedule:n,selected:l}){return e.jsxs("button",{"aria-current":l?"true":void 0,className:"scheduled-list-row",onClick:t,type:"button",children:[e.jsx("span",{className:`scheduled-status-dot ${n.enabled?"active":"paused"}`}),e.jsxs("span",{className:"scheduled-list-copy",children:[e.jsx("span",{className:"scheduled-list-title",children:e.jsx("strong",{children:n.scheduleName})}),e.jsx("span",{children:n.localProjectName}),e.jsxs("small",{children:[s,n.nextRunAt?` · Next ${M(n.nextRunAt,n.timezone)}`:" · No next run"]})]})]})}function Le({cadence:s,definition:t,onSelect:n,schedule:l,selected:d}){return e.jsxs("button",{"aria-current":d?"true":void 0,className:"scheduled-list-row",onClick:n,type:"button",children:[e.jsx("span",{className:`scheduled-status-dot ${l.enabled?"active":"paused"}`}),e.jsxs("span",{className:"scheduled-list-copy",children:[e.jsxs("span",{className:"scheduled-list-title",children:[e.jsx("strong",{children:t.name}),e.jsx("small",{className:"scheduled-environment-badge hosted",children:"Hosted"})]}),e.jsx("span",{children:t.prompt}),e.jsxs("small",{children:[s,l.nextRunAt?` · Next ${M(l.nextRunAt,l.timeZone)}`:" · No next run"]})]})]})}const ze=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ts({connection:s,detailOpen:t,detailExpanded:n,onDetailOpenChange:l,onDetailResizeStart:d,onToggleDetailExpanded:j}){const u=Ne(s),o=je(s),[a,r]=i.useState("all"),[f,R]=i.useState(Se),[v,N]=i.useState(!1),[b,D]=i.useState(null),A=i.useMemo(()=>Pe(u.definitions),[u.definitions]),S=i.useMemo(()=>Fe(A,a),[a,A]),E=i.useMemo(()=>Ze(o.schedules,a),[a,o.schedules]),x=A.find(h=>I(h.schedule.id)===b)??null,g=o.schedules.find(h=>W(h.id)===b)??null,c=x?u.runs.filter(h=>h.scheduleId===x.schedule.id):[],p=i.useMemo(()=>Ue(E,S),[E,S]),y=i.useMemo(()=>p.map(Oe),[p]);_(u.error,{prefix:"Scheduled Work"}),_(o.error,{prefix:"Local schedules"}),i.useEffect(()=>{b&&!x&&!g&&D(null)},[x,g,b]),i.useEffect(()=>{!t&&b&&D(null)},[t,b]),i.useEffect(()=>()=>l(!1),[l]);function k(h){D(h),l(!0)}function w(){D(null),l(!1)}function P(h){R(h),ke(h)}async function z(){N(!0);try{await Promise.all([u.refresh(),o.refresh()])}finally{N(!1)}}return e.jsxs("section",{"aria-label":"Scheduled work",className:`scheduled-work-view${x||g?" detail-open":""}${n?" detail-expanded":""}`,children:[e.jsx("div",{className:"scheduled-work-scroll",children:e.jsxs("div",{className:"scheduled-work-content",children:[e.jsxs("header",{className:"scheduled-work-header",children:[e.jsxs("div",{"aria-label":"Scheduled view",className:"scheduled-view-tabs",role:"tablist",children:[e.jsx("button",{"aria-selected":f==="calendar",className:f==="calendar"?"active":void 0,onClick:()=>P("calendar"),role:"tab",type:"button",children:"Calendar"}),e.jsx("button",{"aria-selected":f==="list",className:f==="list"?"active":void 0,onClick:()=>P("list"),role:"tab",type:"button",children:"List"})]}),e.jsxs("div",{className:"scheduled-work-header-actions",children:[e.jsx("button",{"aria-label":"Refresh schedules",className:"scheduled-icon-button",disabled:!s||u.loading||o.loading,onClick:()=>{z()},title:"Refresh schedules",type:"button",children:e.jsx(ve,{className:v?"scheduled-spin":void 0,size:16})}),e.jsxs("label",{className:"scheduled-filter",children:[e.jsx(fe,{"aria-hidden":"true",size:16}),e.jsxs("select",{"aria-label":"Schedule filter",onChange:h=>r(h.target.value),value:a,children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"paused",children:"Paused"}),e.jsx("option",{value:"all",children:"All"})]})]})]})]}),e.jsx("section",{"aria-busy":u.loading||o.loading,className:"scheduled-list",children:s?(u.loading||o.loading)&&A.length===0&&o.schedules.length===0?e.jsx(le,{label:"Loading schedules"}):u.error&&o.error&&A.length===0&&o.schedules.length===0?e.jsx(O,{children:"Schedules are unavailable. Refresh to try again."}):p.length===0?e.jsx(O,{children:"Create a scheduled task here or ask for one in Work."}):f==="calendar"?e.jsx(Ce,{items:y,onSelect:k,selectedKey:b}):e.jsx("div",{className:"scheduled-list-rows",children:p.map(h=>h.kind==="local"?e.jsx(Te,{cadence:re(h.schedule),onSelect:()=>k(W(h.schedule.id)),schedule:h.schedule,selected:b===W(h.schedule.id)},W(h.schedule.id)):e.jsx(Le,{cadence:_e(h.row.schedule),definition:h.row.definition,onSelect:()=>k(I(h.row.schedule.id)),schedule:h.row.schedule,selected:b===I(h.row.schedule.id)},I(h.row.schedule.id)))}):e.jsx(O,{children:"Connect to OpenPond to view scheduled Work."})})]})}),x?e.jsx(Ie,{onClose:w,onDelete:async()=>{await u.remove(x.schedule.id),w()},onRun:()=>u.run(x.schedule.id),onSave:h=>u.update(x.schedule.id,h),onToggle:()=>u.update(x.schedule.id,{enabled:!x.schedule.enabled}),pending:u.pendingScheduleIds.has(x.schedule.id),row:x,runs:c,detailExpanded:n,onDetailResizeStart:d,onToggleDetailExpanded:j,webBaseUrl:u.webBaseUrl},`${x.schedule.id}:${x.definition.version}:${x.schedule.configurationVersion}`):g?e.jsx(We,{connection:s,onClose:w,onRun:()=>o.run(g),onToggle:()=>o.toggle(g),pending:o.pendingScheduleIds.has(g.id),schedule:g,detailExpanded:n,onDetailResizeStart:d,onToggleDetailExpanded:j},g.id):null]})}function We({connection:s,detailExpanded:t,onClose:n,onDetailResizeStart:l,onRun:d,onToggleDetailExpanded:j,onToggle:u,pending:o,schedule:a}){const r=qe(s,a.id);return _(r.error,{prefix:"Local schedule runs"}),e.jsxs(ne,{detailExpanded:t,label:`${a.scheduleName} details`,onClose:n,onDetailResizeStart:l,onToggleDetailExpanded:j,children:[e.jsx("div",{className:"scheduled-detail-header",children:e.jsxs("div",{children:[e.jsxs("div",{className:"scheduled-detail-title-row",children:[e.jsx("h2",{children:"Schedule details"}),e.jsx("span",{children:a.enabled?"Active":"Paused"})]}),e.jsx("p",{children:a.scheduleName})]})}),e.jsxs(T,{title:"Task",children:[e.jsxs("dl",{className:"scheduled-detail-fields",children:[e.jsx(C,{label:"Environment",value:"Local"}),e.jsx(C,{label:"Project",value:a.localProjectName}),e.jsx(C,{label:"Agent",value:a.agentName}),e.jsx(C,{label:"Action",value:a.targetAction})]}),e.jsx("pre",{className:"scheduled-prompt",children:He(a)})]}),e.jsxs(T,{title:"Schedule",children:[e.jsxs("dl",{className:"scheduled-detail-fields",children:[e.jsx(C,{label:"Cadence",value:re(a)}),e.jsx(C,{label:"Expression",value:a.scheduleExpression}),e.jsx(C,{label:"Timezone",value:a.timezone??"Local time"}),e.jsx(C,{label:"Next run",value:M(a.nextRunAt,a.timezone)}),e.jsx(C,{label:"Last run",value:M(a.lastRunAt,a.timezone)})]}),a.lastError?e.jsx("p",{className:"scheduled-detail-error",children:a.lastError}):null]}),e.jsxs("div",{className:"scheduled-detail-actions",children:[e.jsxs("button",{disabled:o,onClick:()=>{d()},type:"button",children:[e.jsx(X,{size:15}),e.jsx("span",{children:"Run now"})]}),e.jsxs("button",{disabled:o,onClick:()=>{u()},type:"button",children:[a.enabled?e.jsx(J,{size:15}):e.jsx(Q,{size:15}),e.jsx("span",{children:a.enabled?"Pause":"Resume"})]})]}),e.jsx(T,{title:"Runs",children:r.loading&&r.runs.length===0?e.jsx(le,{label:"Loading runs"}):r.runs.length===0?e.jsx("p",{className:"scheduled-no-runs",children:"No runs yet."}):e.jsx("div",{className:"scheduled-run-list",children:r.runs.map(f=>e.jsx(Re,{run:f},f.id))})})]})}function Ie({detailExpanded:s,onClose:t,onDelete:n,onDetailResizeStart:l,onRun:d,onSave:j,onToggleDetailExpanded:u,onToggle:o,pending:a,row:r,runs:f,webBaseUrl:R}){const v=Ke(r.schedule),[N,b]=i.useState(r.definition.name),[D,A]=i.useState(r.definition.prompt),[S,E]=i.useState(v.kind),[x,g]=i.useState(v.timeZone),[c,p]=i.useState(v.startDate),[y,k]=i.useState(v.localTime),[w,P]=i.useState(v.weekdays?.[0]??"monday"),[z,h]=i.useState(v.dayOfMonth??1),H=f[0]?.conversationId??null,Z=R?Y(R,H):null,de=N!==r.definition.name||D!==r.definition.prompt||S!==v.kind||x!==v.timeZone||c!==v.startDate||y!==v.localTime||w!==(v.weekdays?.[0]??"monday")||z!==(v.dayOfMonth??1);async function ce(m){m.preventDefault(),await j({name:N,prompt:D,recurrence:{version:1,kind:S,timeZone:x,startDate:c,localTime:y,end:{kind:"never"},...S==="weekly"?{weekdays:[w]}:{},...S==="monthly"?{dayOfMonth:z}:{}}})}return e.jsx(ne,{detailExpanded:s,label:`${r.definition.name} details`,onClose:t,onDetailResizeStart:l,onToggleDetailExpanded:u,children:e.jsxs("form",{onSubmit:ce,children:[e.jsxs("div",{className:"scheduled-detail-header",children:[e.jsx("div",{children:e.jsxs("div",{className:"scheduled-detail-title-row",children:[e.jsx("h2",{children:"Schedule details"}),e.jsx("span",{children:r.schedule.enabled?"Active":"Paused"})]})}),e.jsx("div",{className:"scheduled-detail-header-controls",children:e.jsx("button",{"aria-label":"Delete schedule",className:"scheduled-icon-button",disabled:a,onClick:()=>{n()},title:"Delete schedule",type:"button",children:e.jsx(ye,{size:16})})})]}),e.jsxs(T,{title:"Task",children:[e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Name"}),e.jsx("input",{maxLength:180,onChange:m=>b(m.target.value),required:!0,value:N})]}),e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Prompt"}),e.jsx("textarea",{onChange:m=>A(m.target.value),required:!0,value:D})]})]}),e.jsxs(T,{title:"Schedule",children:[e.jsxs("div",{className:"scheduled-field-grid",children:[e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Repeat"}),e.jsxs("select",{onChange:m=>E(m.target.value),value:S,children:[e.jsx("option",{value:"once",children:"Once"}),e.jsx("option",{value:"daily",children:"Daily"}),e.jsx("option",{value:"weekdays",children:"Weekdays"}),e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"})]})]}),S==="weekly"?e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Day"}),e.jsx("select",{onChange:m=>P(m.target.value),value:w,children:ze.map(m=>e.jsx("option",{value:m,children:F(m)},m))})]}):S==="monthly"?e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Day of month"}),e.jsx("input",{max:31,min:1,onChange:m=>h(Number(m.target.value)),type:"number",value:z})]}):null,e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Start date"}),e.jsx("input",{onChange:m=>p(m.target.value),required:!0,type:"date",value:c})]}),e.jsxs("label",{className:"scheduled-field",children:[e.jsx("span",{children:"Time"}),e.jsx("input",{onChange:m=>k(m.target.value),required:!0,type:"time",value:y})]}),e.jsxs("label",{className:"scheduled-field scheduled-field-wide",children:[e.jsx("span",{children:"Timezone"}),e.jsx("input",{onChange:m=>g(m.target.value),required:!0,value:x})]})]}),e.jsxs("p",{className:"scheduled-next-run",children:["Next run: ",M(r.schedule.nextRunAt,v.timeZone)]})]}),e.jsxs("div",{className:"scheduled-detail-actions",children:[de?e.jsxs("button",{disabled:a,type:"submit",children:[e.jsx(ge,{size:15}),e.jsx("span",{children:"Save"})]}):null,e.jsxs("button",{disabled:a,onClick:()=>{d()},type:"button",children:[e.jsx(X,{size:15}),e.jsx("span",{children:"Run now"})]}),e.jsxs("button",{disabled:a,onClick:()=>{o()},type:"button",children:[r.schedule.enabled?e.jsx(J,{size:15}):e.jsx(Q,{size:15}),e.jsx("span",{children:r.schedule.enabled?"Pause":"Resume"})]})]}),e.jsxs("button",{className:"scheduled-open-chat",disabled:a||!Z,onClick:()=>{Z&&B(Z,H)},type:"button",children:[e.jsx("span",{children:"Open hosted chat"}),e.jsx(G,{size:14})]}),e.jsx(T,{title:"Runs",children:f.length===0?e.jsx("p",{className:"scheduled-no-runs",children:"No runs yet."}):e.jsx("div",{className:"scheduled-run-list",children:f.map(m=>e.jsx(De,{onOpen:()=>{R&&B(Y(R,m.conversationId),m.conversationId)},run:m},m.id))})})]})})}function Pe(s){return s.flatMap(t=>t.schedules.map(n=>({definition:t,schedule:n})))}function Fe(s,t){return s.filter(n=>t==="active"?n.schedule.enabled:t==="paused"?!n.schedule.enabled:!0).sort((n,l)=>L(n.schedule.nextRunAt)-L(l.schedule.nextRunAt)||n.definition.name.localeCompare(l.definition.name))}function Ze(s,t){return s.filter(n=>t==="active"?n.enabled:t==="paused"?!n.enabled:!0).sort((n,l)=>L(n.nextRunAt)-L(l.nextRunAt)||n.scheduleName.localeCompare(l.scheduleName))}function Ue(s,t){return[...s.map(n=>({kind:"local",schedule:n})),...t.map(n=>({kind:"hosted",row:n}))].sort((n,l)=>{const d=L(n.kind==="local"?n.schedule.nextRunAt:n.row.schedule.nextRunAt),j=L(l.kind==="local"?l.schedule.nextRunAt:l.row.schedule.nextRunAt);if(d!==j)return d-j;const u=n.kind==="local"?n.schedule.scheduleName:n.row.definition.name,o=l.kind==="local"?l.schedule.scheduleName:l.row.definition.name;return u.localeCompare(o)})}function Oe(s){return s.kind==="local"?{enabled:s.schedule.enabled,key:W(s.schedule.id),nextRunAt:s.schedule.nextRunAt,title:s.schedule.scheduleName}:{enabled:s.row.schedule.enabled,key:I(s.row.schedule.id),nextRunAt:s.row.schedule.nextRunAt,title:s.row.definition.name}}function _e(s){const t=s.recurrence;if(!t)return s.expression??"Manual";const n=ie(t.localTime);return t.kind==="once"?`Once on ${t.startDate} at ${n} · ${t.timeZone}`:t.kind==="weekdays"?`Weekdays at ${n} · ${t.timeZone}`:t.kind==="weekly"?`${t.weekdays?.map(F).join(", ")??"Weekly"} at ${n} · ${t.timeZone}`:t.kind==="monthly"?`Monthly on day ${t.dayOfMonth??1} at ${n} · ${t.timeZone}`:`Daily at ${n} · ${t.timeZone}`}function re(s){const t=s.timezone?` · ${s.timezone}`:"";if(s.scheduleType==="rate")return`Every ${s.scheduleExpression}${t}`;const n=s.scheduleExpression.trim().split(/\s+/);if(n.length===5&&/^\d+$/.test(n[0])&&/^\d+$/.test(n[1])){const l=ie(`${n[1].padStart(2,"0")}:${n[0].padStart(2,"0")}`);if(n[2]==="*"&&n[3]==="*"&&n[4]==="*")return`Daily at ${l}${t}`;if(n[2]==="*"&&n[3]==="*"&&n[4]==="MON-FRI")return`Weekdays at ${l}${t}`}return`Cron ${s.scheduleExpression}${t}`}function Ke(s){return s.recurrence??{version:1,kind:"daily",timeZone:s.timeZone||Ye(),startDate:Ve(),localTime:"08:00",end:{kind:"never"}}}function He(s){const t=s.input.prompt;return typeof t=="string"&&t.trim()?t.trim():Object.keys(s.input).length>0?JSON.stringify(s.input,null,2):"No task input configured."}function qe(s,t){const[n,l]=i.useState([]),[d,j]=i.useState(!1),[u,o]=i.useState(null);return i.useEffect(()=>{if(!s){l([]),j(!1),o(null);return}let a=!1;return j(!0),$.localAgentScheduleRuns(s,t,{limit:20}).then(r=>{a||(l(r.runs),o(null))}).catch(r=>{a||o(Be(r))}).finally(()=>{a||j(!1)}),()=>{a=!0}},[s,t]),{error:u,loading:d,runs:n}}function W(s){return`local:${s}`}function I(s){return`hosted:${s}`}function Y(s,t){const n=new URL(s);return n.pathname=t?`/sandboxes/work/${encodeURIComponent(t)}`:"/sandboxes/work",n.search="",n.hash="",n.toString()}async function B(s,t){const n=window.openpond?.browser;n?.openExternal&&(await n.openExternal({conversationId:t??"hosted-scheduled-work",url:s})).ok||window.open(s,"_blank","noopener,noreferrer")}function ie(s){const[t="0",n="00"]=s.split(":");return new Date(2020,0,1,Number(t),Number(n)).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function L(s){if(!s)return Number.MAX_SAFE_INTEGER;const t=new Date(s).getTime();return Number.isFinite(t)?t:Number.MAX_SAFE_INTEGER}function Ve(){return new Date().toISOString().slice(0,10)}function Ye(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}function Be(s){return s instanceof Error?s.message:String(s)}export{ts as ScheduledWorkPage,Ue as combineScheduleRows,Ze as filterAndSortLocalSchedules,Fe as filterAndSortSchedules,M as formatScheduledRunAt,Y as hostedConversationUrl,re as localScheduleCadence,_e as scheduleCadence,Pe as scheduledRows};
|