openpond 0.0.63 → 0.0.65
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-TUAFALOE.js → app-layer-NCSTDSNQ.js} +2 -2
- package/dist/chunks/{app-server-runtime-O26LVUYH.js → app-server-runtime-6PDQHOBE.js} +6 -6
- package/dist/chunks/{apps-KSZRA7Y2.js → apps-HEG7FEEV.js} +2 -2
- package/dist/chunks/{chunk-JTFDOA2P.js → chunk-6FZNXLVN.js} +17 -5
- package/dist/chunks/{chunk-7UVEB2AZ.js → chunk-B63GTC7F.js} +2 -2
- package/dist/chunks/{chunk-IXA5PMXC.js → chunk-BRLUAT6S.js} +1 -1
- package/dist/chunks/{chunk-6FKBOGA4.js → chunk-EWP6VGHP.js} +1 -1
- package/dist/chunks/{chunk-V2CTXKS2.js → chunk-HJJYGJ36.js} +205 -141
- package/dist/chunks/{chunk-KGU437HZ.js → chunk-JMHOO2IG.js} +2 -2
- package/dist/chunks/{chunk-66KQLYSH.js → chunk-LNYGV6AM.js} +1 -1
- package/dist/chunks/{chunk-7IFPXSSJ.js → chunk-TW4YWBQR.js} +1 -1
- package/dist/chunks/{chunk-LEL5AQJU.js → chunk-U345JN44.js} +1 -1
- package/dist/chunks/{chunk-YDH34BGG.js → chunk-WT3THPTX.js} +32 -32
- package/dist/chunks/{cli-LPFU4ULD.js → cli-CQOUYUQ4.js} +5 -5
- package/dist/chunks/{core-commands-OEOBYFIW.js → core-commands-Y4ZMQXO4.js} +3 -3
- package/dist/chunks/{desktop-test-BRLZF3O7.js → desktop-test-YRFKONLO.js} +2 -2
- package/dist/chunks/{extension-5BUCIDKG.js → extension-4MFKIC6Q.js} +2 -2
- package/dist/chunks/{help-MT6VPW4X.js → help-STXVR4NO.js} +1 -1
- package/dist/chunks/{opchat-O4DVKNFW.js → opchat-CCVKI5GH.js} +2 -2
- package/dist/chunks/{organizations-ACNOJ57Q.js → organizations-AS76SGLP.js} +4 -4
- package/dist/chunks/{profile-7LLWXAJE.js → profile-QNWDNZY3.js} +2 -2
- package/dist/chunks/{project-agent-RVYQYTU2.js → project-agent-GPZL7KAL.js} +2 -2
- package/dist/chunks/{sandbox-command-QST23BX5.js → sandbox-command-LC63MMAA.js} +2 -2
- package/dist/chunks/{sandbox-template-N7UG3P6V.js → sandbox-template-FPQLZ4IP.js} +3 -3
- package/dist/chunks/{src-CPM5Q7T5.js → src-6NIBZPH2.js} +3 -3
- package/dist/chunks/{src-M37V6NVU.js → src-ESTRZ2YU.js} +12 -63
- package/dist/chunks/{teams-bot-ITTI47XS.js → teams-bot-YTX7IC2J.js} +2 -2
- package/dist/chunks/{workspaces-CYBR37US.js → workspaces-ODK2CTFF.js} +2 -2
- package/dist/cli.js +13 -13
- package/dist/web/assets/{AppDialog-wIb8mGQ0.js → AppDialog-DacC7BcY.js} +1 -1
- package/dist/web/assets/{AppsView-D097dPIV.js → AppsView-mkeAkrvr.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-DrD-o_yB.js → BrowserSidebar-1aEC6gsF.js} +1 -1
- package/dist/web/assets/{CommandMenu-L5LelA2h.js → CommandMenu-BN6J3ecV.js} +1 -1
- package/dist/web/assets/{CommunityView-DUJ8NryS.js → CommunityView-B2v9Q4cw.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-BP-7DmQG.js → ComposerCreateImproveStrip-BH8Ath1h.js} +1 -1
- package/dist/web/assets/{GetStartedView-B7gB6Hii.js → GetStartedView-B-R-KSva.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-CNDz2a6I.js → LabModelVersionDetailPage-Bhfa7T00.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-BImOQcjk.js → LabSkillSidebar-CbYdG0RN.js} +1 -1
- package/dist/web/assets/{LabsRoute-BauSK1is.js → LabsRoute-DFV5vV6Z.js} +3 -3
- package/dist/web/assets/{MainChatThread-BZvAqQO6.js → MainChatThread-COiXI7ri.js} +2 -2
- package/dist/web/assets/MainPane-CQCLhV5C.js +6 -0
- package/dist/web/assets/MarkdownText-R3MC5S30.js +9 -0
- package/dist/web/assets/{Messages-DijmQL-z.js → Messages-DpZ8mIz8.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-aCkrdGa0.js → NativeSkillSidebar-BfcMqLHA.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-D98WIQzr.js → NewProjectDialog-DqTX1Eeo.js} +1 -1
- package/dist/web/assets/{OutputsPage-BA0c6cfy.js → OutputsPage-DfZYswx2.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-DKDEmrEH.js → RightChatPanelStack-DH8QjiDY.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-DeHi99mv.js → ScheduledWorkPage-DkaVUnwj.js} +1 -1
- package/dist/web/assets/SettingsView-BRPrJuP5.css +1 -0
- package/dist/web/assets/SettingsView-StVFsSJ6.js +6 -0
- package/dist/web/assets/{TeamChatView-D2mCoLZ3.js → TeamChatView-CqZOnQh2.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-BHMsVp4L.js → TerminalOverlay-CnFv6FZT.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-CPnMWgkt.js → TrainingCreationPanel-CWzyzmyT.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-0scEtzSW.js → TrainingDraftPanel-BVHx0HZ0.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-COoCLLg6.js → UsageSettingsSection-Bdvm66WK.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-BFTwZ_dB.js → WorkspaceDiffPanel-DUCjD1GA.js} +5 -5
- package/dist/web/assets/{WorkspaceEnvironmentMenu-DFlkdd9T.js → WorkspaceEnvironmentMenu-DHGrt_ie.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-Dt3LO27Z.js → WorkspaceGitDialogs-hI57yjPL.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-3g05teoR.js → WorkspaceMonacoEditor-DPv-1uO6.js} +3 -3
- package/dist/web/assets/{arrow-up-right-DYGSWA2J.js → arrow-up-right-BDcNd1rt.js} +1 -1
- package/dist/web/assets/{chevron-up-4qfvI9iW.js → chevron-up-XTMMnfnf.js} +1 -1
- package/dist/web/assets/{cloud-upload-COReKxOy.js → cloud-upload-D6bS8rS2.js} +1 -1
- package/dist/web/assets/{cssMode-BbH67BYF.js → cssMode-CvN9o8bP.js} +1 -1
- package/dist/web/assets/{folder-open-9OjGqNgP.js → folder-open-8C5l7A93.js} +1 -1
- package/dist/web/assets/{folder-plus-DF5E6zr3.js → folder-plus-B9Wqb9yd.js} +1 -1
- package/dist/web/assets/{git-branch-eCwyZXMl.js → git-branch-C45ve7zh.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-cPm51DqY.js → git-commit-horizontal-CGoLIyKK.js} +1 -1
- package/dist/web/assets/{htmlMode-DD6Oge4x.js → htmlMode-DxLP6j5r.js} +1 -1
- package/dist/web/assets/index-BYgrO3wt.js +1 -0
- package/dist/web/assets/index-CHqMtVfF.css +1 -0
- package/dist/web/assets/{index-BO2W2U23.js → index-LrGasYyx.js} +29 -29
- package/dist/web/assets/{info-p1mFpqBI.js → info-DTObFlHw.js} +1 -1
- package/dist/web/assets/{jsonMode-C2Xd56A_.js → jsonMode-C3_fOSJu.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-BjYEk4gJ.js → lspLanguageFeatures-0c-UKStE.js} +1 -1
- package/dist/web/assets/{monaco.contribution-quEPEMQZ.js → monaco.contribution-CF1DgPPC.js} +2 -2
- package/dist/web/assets/{monaco.contribution-C7WMqwmc.js → monaco.contribution-CFLEc9Ly.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Bo-5m7yy.js → monaco.contribution-Cb7KlQ6G.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DzWlEgU1.js → monaco.contribution-Dsug_FPj.js} +2 -2
- package/dist/web/assets/{play-Ctx-iMqd.js → play-Cbsyrwkw.js} +1 -1
- package/dist/web/assets/{python-Cm64qCpk.js → python-DVcVB2lF.js} +1 -1
- package/dist/web/assets/{refresh-cw-Bn28jIl0.js → refresh-cw-ChUK_QfF.js} +1 -1
- package/dist/web/assets/{save-BM5IQX65.js → save-Doep-KC7.js} +1 -1
- package/dist/web/assets/{square-DAGpFfSr.js → square-B5q2aneb.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-DLW8Fnck.js → toggleHighContrast-CTZp7RE7.js} +1 -1
- package/dist/web/assets/{tsMode-BleUN_8S.js → tsMode-GfNadOOB.js} +1 -1
- package/dist/web/assets/{upload-vaAKFfxi.js → upload-DcewuCTa.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-Ccenbqf6.js → useLocalAgentSchedules-BwltnId8.js} +1 -1
- package/dist/web/assets/{wifi-off-DJA9KReb.js → wifi-off-cXPyKIzd.js} +1 -1
- package/dist/web/assets/{workers-CFG-afha.js → workers-CP6kCS63.js} +1 -1
- package/dist/web/assets/{yaml-Cs8iZKVC.js → yaml-w0GP6yKf.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/MainPane-CuhwxMxg.js +0 -6
- package/dist/web/assets/MarkdownText-gwAue4u5.js +0 -9
- package/dist/web/assets/SettingsView--fL3Ecuy.js +0 -6
- package/dist/web/assets/SettingsView-BS5m5vdt.css +0 -1
- package/dist/web/assets/index-BRLugX1S.js +0 -1
- package/dist/web/assets/index-Y7IoiSlQ.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as _,r as d,b1 as b,p as le,b2 as B,j as n,C as E,c8 as A,c9 as _e,a4 as Ee,i as N,ca as Pe,S as ce,$ as Le,b3 as Fe,aK as Ue,as as Be,c1 as Oe,ar as Ge,a1 as G,bk as We,cb as De,cc as qe,aY as Ve,cd as Ke,ce as K,ba as He}from"./index-BO2W2U23.js";import{C as Qe}from"./chevron-up-4qfvI9iW.js";import{I as W,g as Ze,h as Ye}from"./MainPane-CuhwxMxg.js";import{d as Xe,b as oe,W as Je,n as et,I as de,e as ue,u as tt,r as he,B as me}from"./MarkdownText-gwAue4u5.js";import{A as O}from"./arrow-up-right-DYGSWA2J.js";import{G as nt}from"./git-branch-eCwyZXMl.js";import{F as st}from"./folder-open-9OjGqNgP.js";import{P as it}from"./play-Ctx-iMqd.js";import{R as at}from"./refresh-cw-Bn28jIl0.js";const rt=[["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"}]],lt=_("circle-dashed",rt);const ct=[["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"}]],ot=_("copy",ct);const dt=[["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"}]],D=_("lightbulb",dt);const ut=[["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"}]],ht=_("circle-x",ut);function mt(e){const t=Ct(e);if(t)return t;const s=bt();let i="";const a=[],r=[],l=[];for(const h of e){if(!i&&h.label&&(i=h.label),_t(r,h.label),Et(l,h),h.kind==="command"&&h.content){vt(s,wt(h.content));continue}yt(s,h)||zt(a,h.label)}const c=[...$t(s),...r,...l],o=s.runCount>0?It(s.runCount):"",u=Ut(a),f=(e.length===1&&e[0]?.kind==="command"&&e[0].content&&r.length===0&&l.length===0?fe(e[0].content,"completed"):null)||Tt(c,o)||u||i||"Ran command";return{kind:Mt(s,o),text:f}}function fe(e,t="completed"){const s=je(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=pe(s);if(!a)return null;const[r,l]=a;if(r==="cat"){const o=C(l);return o.length===0?i?"Reading standard input":"Read standard input":`${i?"Reading":"Read"} ${S(o)}`}if(r==="sed")return jt(Ot([r,...l]),i);if(r==="rg")return Gt([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"?C(l):[];return o.length===0?i?"Listing files":"Listed files":`${i?"Listing":"Listed"} files in ${S(o)}`}if(["head","tail","nl","wc","awk","jq"].includes(r)){const o=xe(r,l);return o.length===0?i?`Running ${r}`:`Ran ${r}`:`${i?"Reading":"Read"} ${S(o)}`}if(r==="apply_patch")return i?"Editing files":"Edited files";if(r==="write_stdin")return i?"Continuing command":"Continued command";if(r==="wait")return i?"Waiting for command":"Waited for command";if(r==="js")return i?"Running JavaScript":"Ran JavaScript";if(r==="exec_command")return i?"Running shell command":"Ran shell command";if(r==="read_file")return i?"Reading file":"Read file";if(r==="view_image")return i?"Viewing image":"Viewed image";if(r==="update_plan")return i?"Updating plan":"Updated plan";if(r==="tool_search")return i?"Searching tools":"Searched tools";if(r==="rm")return i?"Removing files":"Removed files";if(r==="mv")return i?"Moving files":"Moved files";if(r==="cp")return i?"Copying files":"Copied files";if(r==="mkdir")return i?"Creating directories":"Created directories";if(r==="touch")return i?"Creating files":"Created files";if(r==="git")return ft(l,i);if(xt(r))return pt(r,l,i);if(ge(r))return gt(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 ft(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 pt(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 gt(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 xt(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 jt(e,t){return!e||!t?e:e.startsWith("Read ")?`Reading ${e.slice(5)}`:e.startsWith("Run ")?`Running ${e.slice(4)}`:e}function bt(){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 Ct(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?H(s,"received"):null,i>0?H(i,"sent"):null].filter(r=>!!r);return{kind:"subagent",text:T(q(a))}}function H(e,t){return e===1?`child message ${t}`:`${e} child messages ${t}`}function vt(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 yt(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 Rt(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 wt(e){const t=je(e);if(t.length===0||t.some(be))return{countedAsRun:!0};const s=pe(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(St(i,a)||ge(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=xe(i,a);return r.length>0?{countedAsRun:!1,readFiles:r}:{countedAsRun:!0}}function pe(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 St(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 ge(e){return["eslint","jest","playwright","prettier","tsc","vitest"].includes(e)}function xe(e,t){if(e==="cat"||e==="nl"||e==="head"||e==="tail"||e==="wc")return U(C(t));if(e==="sed"){const s=t.findIndex(i=>i!=="-n"&&!i.startsWith("--"));return U(s>=0?C(t.slice(s+1)):[])}return e==="awk"||e==="jq"?U(C(t.slice(1))):[]}function U(e){return e.filter(t=>!(!t||t==="."||t==="-"||/^\d+$/.test(t)))}function $t(e){const t=[],s=kt(e);s&&t.push(s),e.editCount>0&&t.push("made edits");const i=e.readFiles.size||e.readFileCount;return i>0&&t.push(Z("read",i,"file")),e.searchedCode>0&&t.push("searched code"),e.listedFiles>0&&t.push("listed files"),e.testsOrChecks>0&&t.push(e.testsOrChecks===1?"ran checks":`ran ${e.testsOrChecks} checks`),e.webSearches>0&&t.push("searched web"),e.imageCount>0&&t.push(Z("read",e.imageCount,"image")),e.reasoningCount>0&&t.length===0&&t.push("thought through the request"),e.approvals>0&&t.push("requested approval"),t.push(...Nt(e)),t}function Nt(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 kt(e){const t=At(e);return t.failed>0?x(t.failed,"failed"):t.blocked>0?x(t.blocked,"blocked"):t.stale>0?x(t.stale,"stale"):t["needs revision"]>0?x(t["needs revision"],"needs revision"):t.submitted>0?x(t.submitted,"submitted"):t.running>0&&t.completed===0&&t.accepted===0?x(t.running,"running"):t.accepted>0?x(t.accepted,"accepted"):t.completed>0?x(t.completed,"completed"):t.archived>0?x(t.archived,"archived"):null}function Rt(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 At(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 x(e,t){return e===1?`subagent ${t}`:`${e} subagents ${t}`}function Mt(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 It(e){return e===1?"ran a command":`ran ${e} commands`}function Z(e,t,s){return t===1?`${e} a ${s}`:`${e} ${t} ${s}s`}function Tt(e,t){return e.length===0?t?T(t):"":T(q(t?[...e,t]:e))}function zt(e,t){const s=t.trim();s&&(e.includes(s)||e.push(s))}function _t(e,t){const s=Pt(t);!s||e.includes(s)||e.push(s)}function Et(e,t){const s=t.receipt;if(!s)return;const i=`${s.status} receipt ${Ft(s.id)} ${Lt(s.totalUsd)}`;e.includes(i)||e.push(i)}function Pt(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 Lt(e){const t=e.trim();return t.startsWith("$")?t:`$${t}`}function Ft(e){const t=e.trim();return t.length<=14?t:`${t.slice(0,6)}...${t.slice(-4)}`}function Ut(e){return e.length===0?"":T(q(e.map(Bt)))}function Bt(e){return e&&`${e[0].toLowerCase()}${e.slice(1)}`}function q(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 T(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function Ot(e){const t=e.findIndex((r,l)=>l>0&&r!=="-n"&&!r.startsWith("--")),s=t>=0?e[t]??"":"",i=t>=0?C(e.slice(t+1)):[],a=/^(\d+)(?:,(\d+))?p$/.exec(s);if(a){const r=a[1],l=a[2],c=l?`lines ${r}-${l}`:`line ${r}`;return i.length>0?`Read ${c} of ${S(i)}`:`Read ${c}`}return i.length>0?`Read ${S(i)} with sed`:"Run sed"}function Gt(e,t=!1){const s=e.slice(1);if(s.includes("--files")){const l=C(s.filter(c=>c!=="--files"));return l.length>0?`${t?"Listing":"Listed"} files matching ${S(l)}`:t?"Listing files":"Listed files"}const i=C(s),a=i[0],r=i.slice(1);return a?r.length>0?`${t?"Searching":"Searched"} for ${Y(a)} in ${S(r)}`:`${t?"Searching":"Searched"} for ${Y(a)}`:t?"Searching files":"Searched files"}function je(e){return(e.match(/"([^"\\]|\\.)*"|'[^']*'|[^\s]+/g)??[]).map(s=>Wt(s)).filter(Boolean)}function Wt(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function be(e){return["|","&&","||",";",">",">>","<","(",")"].includes(e)}function C(e){const t=[];for(let s=0;s<e.length;s+=1){const i=e[s];if(!i.startsWith("-")){t.push(i);continue}Dt(i)&&s+1<e.length&&(s+=1)}return t}function Dt(e){return["-e","-f","-g","--glob","--type","-t","--context","-C","-A","-B","-m","-n","-c"].includes(e)}function S(e){return e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e[0]} and ${e.length-1} more`}function Y(e){return`"${e}"`}function qt(e,t,s){return new Set(e.filter(i=>{if(t.has(i.id))return!1;if(s===void 0)return!0;if(typeof i.timestamp!="string")return!1;const a=Date.parse(i.timestamp);return Number.isFinite(a)&&a>=s}).map(i=>i.id))}function X(e){let t=null;for(const s of e){if(typeof s.timestamp!="string")continue;const i=Date.parse(s.timestamp);Number.isFinite(i)&&(t=t===null?i:Math.max(t,i))}return t}function Ms(e,t){const s=d.useRef({scopeKey:t,ids:new Set(e.map(l=>l.id)),initialized:!1,liveCutoff:null}),i=s.current.scopeKey===t,r=i&&s.current.initialized?qt(e,s.current.ids,s.current.liveCutoff??void 0):new Set;return d.useLayoutEffect(()=>{const l=s.current,c=l.scopeKey!==t,o=Date.now();s.current={scopeKey:t,ids:new Set(e.map(u=>u.id)),initialized:!c,liveCutoff:c?Math.max(o,X(e)??0):l.liveCutoff??Math.max(o,X(e)??0)}},[e,i,t]),r}function Vt(e,t){const s=Kt(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 Kt(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:(b.activateConnection(e),b.get(J(e,a))),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;const r=J(e,a);return b.activateConnection(e),b.load(r,()=>le.signChatAttachmentImageUrl(e,a)).finally(()=>t(l=>l+1))},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function J(e,t){return B(e,"chat-attachment-image",t.sessionId,t.turnId,t.attachmentId,t.storageName,t.contentType)}const Ht=64,Qt=120,Zt=210,Yt=360,Xt=40,Jt=120,en=600,tn=100,ee=33,I=new Set;let M=!1;function nn(e,t,s=0){if(e<=0)return{characterCount:0,remainder:0};const i=e>en?Yt:e>Jt?Zt:e>Xt?Qt:Ht,a=s+Math.min(Math.max(t,0),tn)*i/1e3,r=Math.min(e,Math.floor(a));return{characterCount:r,remainder:a-r}}function Ce(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 te(){return typeof window<"u"&&typeof window.matchMedia=="function"&&typeof document<"u"&&document.visibilityState==="visible"&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}function sn(e,t,s){return t&&s?Ce("",e,1):e}function an(e,t=!1){const[s,i]=d.useState(()=>sn(e,t,te())),a=d.useRef(s),r=d.useRef(e),l=d.useRef(null),c=d.useRef(null),o=d.useRef(0),u=d.useRef(!0);return d.useEffect(()=>(u.current=!0,()=>{u.current=!1,l.current!==null&&(window.clearTimeout(l.current),l.current=null)}),[]),d.useEffect(()=>{if(r.current=e,!te()||!e.startsWith(a.current)){l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=e,u.current&&i(e);return}if(a.current.length===e.length||l.current!==null)return;const m=()=>{if(!u.current){l.current=null;return}const f=a.current,h=r.current,v=performance.now();if(!h.startsWith(f)){a.current=h,i(h),l.current=null,c.current=null,o.current=0;return}const j=h.length-f.length;if(j===0){l.current=null,c.current=null,o.current=0;return}const $=c.current===null?16:v-c.current,p=nn(j,$,o.current);if(c.current=v,o.current=p.remainder,p.characterCount>0){const y=Ce(f,h,p.characterCount);a.current=y,i(y)}l.current=window.setTimeout(m,ee)};return l.current=window.setTimeout(m,ee),()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[e]),d.useEffect(()=>{const f=rn(()=>{document.visibilityState!=="visible"&&(l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=r.current,u.current&&i(r.current))});return()=>{f(),l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[]),s}function rn(e){return I.add(e),M||(document.addEventListener("visibilitychange",ne),M=!0),()=>{I.delete(e),I.size===0&&M&&(document.removeEventListener("visibilitychange",ne),M=!1)}}function ne(){for(const e of I)e()}function ve({animateInitialContent:e=!1,content:t,...s}){const i=an(t,e),a=Xe(i,i.length===t.length),r=ln(a,i.length===t.length);return n.jsx(oe,{...s,content:a,finalizedContent:r.finalized,mutableContent:r.mutable})}function ln(e,t){if(t||!e)return{finalized:e,mutable:""};const s=e.split(`
|
|
1
|
+
import{c as _,r as d,b1 as b,p as le,b2 as B,j as n,C as E,c8 as A,c9 as _e,a4 as Ee,i as N,ca as Pe,S as ce,$ as Le,b3 as Fe,aK as Ue,as as Be,c1 as Oe,ar as Ge,a1 as G,bk as We,cb as De,cc as qe,aY as Ve,cd as Ke,ce as K,ba as He}from"./index-LrGasYyx.js";import{C as Qe}from"./chevron-up-XTMMnfnf.js";import{I as W,g as Ze,h as Ye}from"./MainPane-CQCLhV5C.js";import{e as Xe,b as oe,W as Je,n as et,I as de,f as ue,u as tt,r as he,B as me}from"./MarkdownText-R3MC5S30.js";import{A as O}from"./arrow-up-right-BDcNd1rt.js";import{G as nt}from"./git-branch-C45ve7zh.js";import{F as st}from"./folder-open-8C5l7A93.js";import{P as it}from"./play-Cbsyrwkw.js";import{R as at}from"./refresh-cw-ChUK_QfF.js";const rt=[["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"}]],lt=_("circle-dashed",rt);const ct=[["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"}]],ot=_("copy",ct);const dt=[["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"}]],D=_("lightbulb",dt);const ut=[["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"}]],ht=_("circle-x",ut);function mt(e){const t=Ct(e);if(t)return t;const s=bt();let i="";const a=[],r=[],l=[];for(const h of e){if(!i&&h.label&&(i=h.label),_t(r,h.label),Et(l,h),h.kind==="command"&&h.content){vt(s,wt(h.content));continue}yt(s,h)||zt(a,h.label)}const c=[...$t(s),...r,...l],o=s.runCount>0?It(s.runCount):"",u=Ut(a),f=(e.length===1&&e[0]?.kind==="command"&&e[0].content&&r.length===0&&l.length===0?fe(e[0].content,"completed"):null)||Tt(c,o)||u||i||"Ran command";return{kind:Mt(s,o),text:f}}function fe(e,t="completed"){const s=je(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=pe(s);if(!a)return null;const[r,l]=a;if(r==="cat"){const o=C(l);return o.length===0?i?"Reading standard input":"Read standard input":`${i?"Reading":"Read"} ${S(o)}`}if(r==="sed")return jt(Ot([r,...l]),i);if(r==="rg")return Gt([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"?C(l):[];return o.length===0?i?"Listing files":"Listed files":`${i?"Listing":"Listed"} files in ${S(o)}`}if(["head","tail","nl","wc","awk","jq"].includes(r)){const o=xe(r,l);return o.length===0?i?`Running ${r}`:`Ran ${r}`:`${i?"Reading":"Read"} ${S(o)}`}if(r==="apply_patch")return i?"Editing files":"Edited files";if(r==="write_stdin")return i?"Continuing command":"Continued command";if(r==="wait")return i?"Waiting for command":"Waited for command";if(r==="js")return i?"Running JavaScript":"Ran JavaScript";if(r==="exec_command")return i?"Running shell command":"Ran shell command";if(r==="read_file")return i?"Reading file":"Read file";if(r==="view_image")return i?"Viewing image":"Viewed image";if(r==="update_plan")return i?"Updating plan":"Updated plan";if(r==="tool_search")return i?"Searching tools":"Searched tools";if(r==="rm")return i?"Removing files":"Removed files";if(r==="mv")return i?"Moving files":"Moved files";if(r==="cp")return i?"Copying files":"Copied files";if(r==="mkdir")return i?"Creating directories":"Created directories";if(r==="touch")return i?"Creating files":"Created files";if(r==="git")return ft(l,i);if(xt(r))return pt(r,l,i);if(ge(r))return gt(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 ft(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 pt(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 gt(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 xt(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 jt(e,t){return!e||!t?e:e.startsWith("Read ")?`Reading ${e.slice(5)}`:e.startsWith("Run ")?`Running ${e.slice(4)}`:e}function bt(){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 Ct(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?H(s,"received"):null,i>0?H(i,"sent"):null].filter(r=>!!r);return{kind:"subagent",text:T(q(a))}}function H(e,t){return e===1?`child message ${t}`:`${e} child messages ${t}`}function vt(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 yt(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 Rt(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 wt(e){const t=je(e);if(t.length===0||t.some(be))return{countedAsRun:!0};const s=pe(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(St(i,a)||ge(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=xe(i,a);return r.length>0?{countedAsRun:!1,readFiles:r}:{countedAsRun:!0}}function pe(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 St(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 ge(e){return["eslint","jest","playwright","prettier","tsc","vitest"].includes(e)}function xe(e,t){if(e==="cat"||e==="nl"||e==="head"||e==="tail"||e==="wc")return U(C(t));if(e==="sed"){const s=t.findIndex(i=>i!=="-n"&&!i.startsWith("--"));return U(s>=0?C(t.slice(s+1)):[])}return e==="awk"||e==="jq"?U(C(t.slice(1))):[]}function U(e){return e.filter(t=>!(!t||t==="."||t==="-"||/^\d+$/.test(t)))}function $t(e){const t=[],s=kt(e);s&&t.push(s),e.editCount>0&&t.push("made edits");const i=e.readFiles.size||e.readFileCount;return i>0&&t.push(Z("read",i,"file")),e.searchedCode>0&&t.push("searched code"),e.listedFiles>0&&t.push("listed files"),e.testsOrChecks>0&&t.push(e.testsOrChecks===1?"ran checks":`ran ${e.testsOrChecks} checks`),e.webSearches>0&&t.push("searched web"),e.imageCount>0&&t.push(Z("read",e.imageCount,"image")),e.reasoningCount>0&&t.length===0&&t.push("thought through the request"),e.approvals>0&&t.push("requested approval"),t.push(...Nt(e)),t}function Nt(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 kt(e){const t=At(e);return t.failed>0?x(t.failed,"failed"):t.blocked>0?x(t.blocked,"blocked"):t.stale>0?x(t.stale,"stale"):t["needs revision"]>0?x(t["needs revision"],"needs revision"):t.submitted>0?x(t.submitted,"submitted"):t.running>0&&t.completed===0&&t.accepted===0?x(t.running,"running"):t.accepted>0?x(t.accepted,"accepted"):t.completed>0?x(t.completed,"completed"):t.archived>0?x(t.archived,"archived"):null}function Rt(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 At(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 x(e,t){return e===1?`subagent ${t}`:`${e} subagents ${t}`}function Mt(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 It(e){return e===1?"ran a command":`ran ${e} commands`}function Z(e,t,s){return t===1?`${e} a ${s}`:`${e} ${t} ${s}s`}function Tt(e,t){return e.length===0?t?T(t):"":T(q(t?[...e,t]:e))}function zt(e,t){const s=t.trim();s&&(e.includes(s)||e.push(s))}function _t(e,t){const s=Pt(t);!s||e.includes(s)||e.push(s)}function Et(e,t){const s=t.receipt;if(!s)return;const i=`${s.status} receipt ${Ft(s.id)} ${Lt(s.totalUsd)}`;e.includes(i)||e.push(i)}function Pt(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 Lt(e){const t=e.trim();return t.startsWith("$")?t:`$${t}`}function Ft(e){const t=e.trim();return t.length<=14?t:`${t.slice(0,6)}...${t.slice(-4)}`}function Ut(e){return e.length===0?"":T(q(e.map(Bt)))}function Bt(e){return e&&`${e[0].toLowerCase()}${e.slice(1)}`}function q(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 T(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function Ot(e){const t=e.findIndex((r,l)=>l>0&&r!=="-n"&&!r.startsWith("--")),s=t>=0?e[t]??"":"",i=t>=0?C(e.slice(t+1)):[],a=/^(\d+)(?:,(\d+))?p$/.exec(s);if(a){const r=a[1],l=a[2],c=l?`lines ${r}-${l}`:`line ${r}`;return i.length>0?`Read ${c} of ${S(i)}`:`Read ${c}`}return i.length>0?`Read ${S(i)} with sed`:"Run sed"}function Gt(e,t=!1){const s=e.slice(1);if(s.includes("--files")){const l=C(s.filter(c=>c!=="--files"));return l.length>0?`${t?"Listing":"Listed"} files matching ${S(l)}`:t?"Listing files":"Listed files"}const i=C(s),a=i[0],r=i.slice(1);return a?r.length>0?`${t?"Searching":"Searched"} for ${Y(a)} in ${S(r)}`:`${t?"Searching":"Searched"} for ${Y(a)}`:t?"Searching files":"Searched files"}function je(e){return(e.match(/"([^"\\]|\\.)*"|'[^']*'|[^\s]+/g)??[]).map(s=>Wt(s)).filter(Boolean)}function Wt(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function be(e){return["|","&&","||",";",">",">>","<","(",")"].includes(e)}function C(e){const t=[];for(let s=0;s<e.length;s+=1){const i=e[s];if(!i.startsWith("-")){t.push(i);continue}Dt(i)&&s+1<e.length&&(s+=1)}return t}function Dt(e){return["-e","-f","-g","--glob","--type","-t","--context","-C","-A","-B","-m","-n","-c"].includes(e)}function S(e){return e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e[0]} and ${e.length-1} more`}function Y(e){return`"${e}"`}function qt(e,t,s){return new Set(e.filter(i=>{if(t.has(i.id))return!1;if(s===void 0)return!0;if(typeof i.timestamp!="string")return!1;const a=Date.parse(i.timestamp);return Number.isFinite(a)&&a>=s}).map(i=>i.id))}function X(e){let t=null;for(const s of e){if(typeof s.timestamp!="string")continue;const i=Date.parse(s.timestamp);Number.isFinite(i)&&(t=t===null?i:Math.max(t,i))}return t}function Ms(e,t){const s=d.useRef({scopeKey:t,ids:new Set(e.map(l=>l.id)),initialized:!1,liveCutoff:null}),i=s.current.scopeKey===t,r=i&&s.current.initialized?qt(e,s.current.ids,s.current.liveCutoff??void 0):new Set;return d.useLayoutEffect(()=>{const l=s.current,c=l.scopeKey!==t,o=Date.now();s.current={scopeKey:t,ids:new Set(e.map(u=>u.id)),initialized:!c,liveCutoff:c?Math.max(o,X(e)??0):l.liveCutoff??Math.max(o,X(e)??0)}},[e,i,t]),r}function Vt(e,t){const s=Kt(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 Kt(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:(b.activateConnection(e),b.get(J(e,a))),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;const r=J(e,a);return b.activateConnection(e),b.load(r,()=>le.signChatAttachmentImageUrl(e,a)).finally(()=>t(l=>l+1))},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function J(e,t){return B(e,"chat-attachment-image",t.sessionId,t.turnId,t.attachmentId,t.storageName,t.contentType)}const Ht=64,Qt=120,Zt=210,Yt=360,Xt=40,Jt=120,en=600,tn=100,ee=33,I=new Set;let M=!1;function nn(e,t,s=0){if(e<=0)return{characterCount:0,remainder:0};const i=e>en?Yt:e>Jt?Zt:e>Xt?Qt:Ht,a=s+Math.min(Math.max(t,0),tn)*i/1e3,r=Math.min(e,Math.floor(a));return{characterCount:r,remainder:a-r}}function Ce(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 te(){return typeof window<"u"&&typeof window.matchMedia=="function"&&typeof document<"u"&&document.visibilityState==="visible"&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}function sn(e,t,s){return t&&s?Ce("",e,1):e}function an(e,t=!1){const[s,i]=d.useState(()=>sn(e,t,te())),a=d.useRef(s),r=d.useRef(e),l=d.useRef(null),c=d.useRef(null),o=d.useRef(0),u=d.useRef(!0);return d.useEffect(()=>(u.current=!0,()=>{u.current=!1,l.current!==null&&(window.clearTimeout(l.current),l.current=null)}),[]),d.useEffect(()=>{if(r.current=e,!te()||!e.startsWith(a.current)){l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=e,u.current&&i(e);return}if(a.current.length===e.length||l.current!==null)return;const m=()=>{if(!u.current){l.current=null;return}const f=a.current,h=r.current,v=performance.now();if(!h.startsWith(f)){a.current=h,i(h),l.current=null,c.current=null,o.current=0;return}const j=h.length-f.length;if(j===0){l.current=null,c.current=null,o.current=0;return}const $=c.current===null?16:v-c.current,p=nn(j,$,o.current);if(c.current=v,o.current=p.remainder,p.characterCount>0){const y=Ce(f,h,p.characterCount);a.current=y,i(y)}l.current=window.setTimeout(m,ee)};return l.current=window.setTimeout(m,ee),()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[e]),d.useEffect(()=>{const f=rn(()=>{document.visibilityState!=="visible"&&(l.current!==null&&(window.clearTimeout(l.current),l.current=null),c.current=null,o.current=0,a.current=r.current,u.current&&i(r.current))});return()=>{f(),l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[]),s}function rn(e){return I.add(e),M||(document.addEventListener("visibilitychange",ne),M=!0),()=>{I.delete(e),I.size===0&&M&&(document.removeEventListener("visibilitychange",ne),M=!1)}}function ne(){for(const e of I)e()}function ve({animateInitialContent:e=!1,content:t,...s}){const i=an(t,e),a=Xe(i,i.length===t.length),r=ln(a,i.length===t.length);return n.jsx(oe,{...s,content:a,finalizedContent:r.finalized,mutableContent:r.mutable})}function ln(e,t){if(t||!e)return{finalized:e,mutable:""};const s=e.split(`
|
|
2
2
|
`);let i=!1,a=0,r=0;for(let l=0;l<s.length-1;l+=1){const c=s[l]??"";/^\s*```/.test(c)&&(i=!i),a+=c.length+1,!i&&c.trim()===""&&(r=a)}return{finalized:e.slice(0,r),mutable:e.slice(r)}}function P({children:e,className:t="",controls:s,danger:i=!1,expanded:a=!1,icon:r,onToggle:l,running:c=!1}){const o=["activity-summary",l?"":"static",i?"danger":"",c?"working":"",t].filter(Boolean).join(" "),u=n.jsxs(n.Fragment,{children:[r,n.jsx("span",{className:"activity-summary-text",children:n.jsx("span",{children:e})}),l?n.jsx(E,{"aria-hidden":!0,className:`activity-summary-toggle ${a?"expanded":""}`,size:14}):null]});return l?n.jsx("button",{type:"button","aria-controls":s,"aria-expanded":a,className:o,onClick:l,children:u}):n.jsx("div",{className:o,role:c?"status":void 0,children:u})}function cn({actionRun:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i=null}){const a=hn(e.status),r=mn(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(un,{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 se(e){return e.implementationType==="openpond-profile-action"}function on(e){const t=e.agentName??e.agentId;return e.actionName.endsWith(".chat")?A({actionId:e.actionName,label:e.title,name:t}):t?A({actionId:e.actionName,name:t}):e.title&&!_e(e.title)?A({actionId:e.actionName,label:e.title}):A({actionId:e.actionName})}function dn(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 un({refItem:e,onOpenBrowserLink:t,onOpenFileInSidebar:s,workspaceRootPath:i}){const a=s?et(e.target,{workspaceRootPath:i}):null,r=fn(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(O,{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(O,{size:13})})]})}function hn(e){return e==="completed"?Ee:e==="failed"?ht:lt}function mn(e){const t=[];return e.implementationType&&t.push({label:"Type",value:e.implementationType,icon:n.jsx(Je,{size:12})}),e.runId&&t.push({label:"Run",value:e.runId,icon:n.jsx(N,{size:12})}),e.sandboxId&&t.push({label:"Sandbox",value:e.sandboxId,icon:n.jsx(N,{size:12})}),e.sourceRef&&t.push({label:"Source",value:e.sourceRef,icon:n.jsx(nt,{size:12})}),e.manifestHash&&t.push({label:"Manifest",value:e.manifestHash,icon:n.jsx(N,{size:12})}),t}function fn(e){return/^https?:\/\//i.test(e)}function pn(e,t){const s=gn(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 gn(e){const[,t]=d.useState(0),s=d.useCallback(a=>!e||!a?null:(b.activateConnection(e),b.get(B(e,"local-video",a))),[e]),i=d.useCallback(async a=>{if(!e||!a)return null;b.activateConnection(e);const r=B(e,"local-video",a);return b.load(r,()=>le.signLocalVideoUrl(e,{path:a})).finally(()=>t(l=>l+1))},[e]);return d.useMemo(()=>({getUrl:s,loadUrl:i}),[s,i])}function xn(e,t){return{toolCount:e.reduce((i,a)=>i+(ie(a)?0:1),0),toolsExpanded:t,visibleActivities:t?e.filter(i=>!ie(i)):[]}}function ie(e){return e.kind==="reasoning"}function jn(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 bn=4;function Cn({onOpenSession:e,onShowAll:t,sessions:s}){const i=s.slice(0,bn),a=Math.max(0,s.length-i.length),r=s.map(we).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(ye,{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 ye({className:e="",onOpenSession:t,openSession:s}){const i=$e(s.roleId),a=wn(s.status),r=`Open ${we(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(vn,{roleId:i})})}function vn({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 yn(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 we(e){const t=`${Se(e.roleId)} subagent`,s=e.status?.replace(/_/g," ").trim();return s?`${t} (${s})`:t}function Se(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 wn(e){const t=e?.trim().toLowerCase()||"unknown";return/^[a-z][a-z0-9_-]*$/.test(t)?t:"unknown"}function Sn({activity:e,defaultExpanded:t=!1}){const[s,i]=d.useState(t),a=d.useId(),r=kn(e);return n.jsxs("section",{className:`harness-refiner-receipt ${e.state} ${e.result??""}`,children:[n.jsxs("button",{"aria-controls":r?a:void 0,"aria-expanded":r?s:void 0,className:"harness-refiner-receipt-summary",disabled:!r,onClick:()=>r&&i(l=>!l),type:"button",children:[n.jsx(at,{"aria-hidden":!0,className:e.state==="running"?"spinning":void 0,size:12}),n.jsx("span",{children:Pe(e)}),r?n.jsx(E,{"aria-hidden":!0,className:`harness-refiner-receipt-toggle ${s?"expanded":""}`,size:13}):null]}),r&&s?n.jsxs("div",{className:"harness-refiner-receipt-details",id:a,children:[n.jsx($n,{activity:e}),e.reason?n.jsxs("section",{children:[n.jsx("strong",{children:"Reason"}),n.jsx("p",{children:e.reason})]}):null,e.expectedOutcome?n.jsxs("section",{children:[n.jsx("strong",{children:"Expected outcome"}),n.jsx("p",{children:e.expectedOutcome})]}):null,e.evidenceBasis?n.jsxs("section",{children:[n.jsx("strong",{children:"Evidence basis"}),n.jsx("p",{children:e.evidenceBasis.kind.replaceAll("_"," ")}),n.jsxs("small",{children:[e.evidenceBasis.supportingEvidenceIds.length," supporting item",e.evidenceBasis.supportingEvidenceIds.length===1?"":"s",e.evidenceBasis.counterevidence.length?` · ${e.evidenceBasis.counterevidence.length} counterexample${e.evidenceBasis.counterevidence.length===1?"":"s"}`:" · no material counterevidence"]})]}):null,e.validations.length?n.jsxs("section",{children:[n.jsx("strong",{children:"Validation"}),n.jsx("div",{className:"harness-refiner-validation-list",children:e.validations.map(l=>n.jsxs("div",{children:[n.jsx("span",{className:l.status,children:l.status}),n.jsx("p",{children:l.summary})]},l.id))})]}):null,e.edits.length?n.jsxs("details",{className:"harness-refiner-exact-edits",children:[n.jsxs("summary",{children:["Review ",e.edits.length," exact edit",e.edits.length===1?"":"s"]}),e.edits.map(l=>n.jsxs("section",{children:[n.jsxs("strong",{children:[l.operation," · ",l.target]}),n.jsx("p",{children:l.summary}),l.content===null?n.jsx("small",{children:"File deleted."}):n.jsx("pre",{children:l.content})]},l.id))]}):null,n.jsx(Nn,{refs:e.refs})]}):null]})}function $n({activity:e}){const t=[e.route?[e.decision==="route"?"Owner":"Layer",e.route]:null,e.operation?["Operation",e.operation]:null,e.target?["Target",e.target]:null,e.critiqueStatus!=="not_applicable"?["Critique",e.critiqueStatus]:null,e.validationStatus!=="not_applicable"?["Validation",e.validationStatus]:null].filter(s=>!!s);return t.length?n.jsx("dl",{className:"harness-refiner-receipt-facts",children:t.map(([s,i])=>n.jsxs("div",{children:[n.jsx("dt",{children:s}),n.jsx("dd",{children:i?.replaceAll("_"," ")})]},s))}):null}function Nn({refs:e}){const t=Object.entries(e).filter(s=>!!s[1]);return t.length?n.jsxs("details",{className:"harness-refiner-references",children:[n.jsx("summary",{children:"Receipt references"}),n.jsx("dl",{children:t.map(([s,i])=>n.jsxs("div",{children:[n.jsx("dt",{children:Rn(s)}),n.jsx("dd",{children:n.jsx("code",{children:i})})]},s))})]}):null}function kn(e){return e.state!=="running"&&!!(e.reason||e.expectedOutcome||e.route||e.operation||e.target||e.evidenceBasis||e.validations.length||e.edits.length||Object.values(e.refs).some(Boolean))}function Rn(e){const t=e.replace(/([a-z])([A-Z])/g,"$1 $2");return`${t[0]?.toUpperCase()??""}${t.slice(1)}`}const Ne=5,An=280;function Mn({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(()=>mt(r),[r]),h=d.useMemo(()=>xn(r,l),[r,l]),v=r.find(g=>g.imagePreview)?.imagePreview??null,j=s.deliverables??[],$=V(o,t,e),p=s.traceState==="running",y=s.traceState==="failed"||s.traceState==="interrupted",L=jn(s.traceStartedAt,s.traceCompletedAt),k=Un(f.text,s.traceState,L,r),w=yn(r);return r.length>0&&r.every(g=>g.subagentMessage)?n.jsxs(n.Fragment,{children:[n.jsx(Pn,{activities:r}),n.jsx(ae,{activity:s.refinerActivity})]}):n.jsxs(n.Fragment,{children:[r.length>0||j.length>0?n.jsxs("article",{className:`activity-group work-trace ${p?"running":"settled"}`,children:[r.length>0?n.jsxs("div",{className:"activity-summary-row",children:[n.jsx(P,{controls:h.toolCount>0?m:void 0,danger:y,expanded:h.toolsExpanded,icon:v?n.jsx(Vn,{activeWorkspaceAppId:e,connection:t,image:v}):n.jsx(Kn,{kind:f.kind}),onToggle:h.toolCount>0?()=>c(g=>!g):void 0,running:p,children:k}),w.length>0&&a?n.jsx(Cn,{onOpenSession:a,onShowAll:()=>c(!0),sessions:w}):null]}):null,j.length>0?n.jsx(zn,{artifacts:j,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(In,{activeWorkspaceAppId:e,activity:g,connection:t,onOpenImage:u,onOpenSession:a},g.id))}):null,n.jsx(de,{open:!!$,src:$,title:o?.path??"",onClose:()=>u(null)})]}):null,n.jsx(ae,{activity:s.refinerActivity})]})}function ae({activity:e}){return e?n.jsx("article",{className:"refiner-activity-row",children:n.jsx(Sn,{activity:e})}):null}function In({activeWorkspaceAppId:e,activity:t,connection:s,onOpenImage:i,onOpenSession:a}){const[r,l]=d.useState(!1),c=d.useId();return t.subagentMessage?n.jsx(Re,{activity:t}):n.jsxs("div",{className:`activity-tool-row ${t.controlKind==="turn_aborted"?"danger":""}`,children:[n.jsx(P,{className:"activity-tool-summary",controls:c,danger:t.controlKind==="turn_aborted",expanded:r,icon:t.kind==="command"?n.jsx(ce,{"aria-hidden":!0,className:"activity-summary-kind-icon",size:12}):void 0,onToggle:()=>l(o=>!o),children:On(t)}),r?n.jsx(Tn,{activeWorkspaceAppId:e,activity:t,connection:s,detailsId:c,onOpenImage:i,onOpenSession:a}):null]})}function Tn({activeWorkspaceAppId:e,activity:t,connection:s,detailsId:i,onOpenImage:a,onOpenSession:r}){const l=V(t.imagePreview??null,s,e);return n.jsxs("div",{className:"activity-tool-details",id:i,children:[t.kind==="command"&&t.content?n.jsx(Gn,{command:t.content,exitCode:t.terminal?.exitCode,output:t.detail,state:t.state}):t.content?Zn(t.content)?n.jsx("pre",{className:"activity-detail-output",children:t.content}):n.jsx("code",{className:"activity-tool-content",children:t.content}):null,t.detail&&t.kind!=="command"?n.jsx("pre",{className:"activity-detail-output",children:t.detail.replace(/\r\n/g,`
|
|
3
3
|
`).trimEnd()}):null,t.meta?n.jsx("small",{className:"activity-detail-meta",children:t.meta}):null,t.imagePreview&&l?n.jsx("button",{type:"button",className:"activity-image-preview",title:`Open ${t.imagePreview.path}`,onClick:()=>a(t.imagePreview??null),children:n.jsx("img",{alt:Fe(t.imagePreview.path),decoding:"async",loading:"lazy",src:l})}):null,t.openSession&&r?n.jsx(ye,{className:"activity-subagent-detail-avatar",openSession:t.openSession,onOpenSession:r}):null]})}function zn({artifacts:e,connection:t,onOpenFileInSidebar:s}){return n.jsx("div",{className:"activity-artifact-list",children:e.map(i=>i.contentType.startsWith("video/")?n.jsx(En,{artifact:i,connection:t,onOpenFileInSidebar:s},i.path):i.contentType.startsWith("image/")?n.jsx(_n,{artifact:i,connection:t},i.path):n.jsxs("button",{type:"button",className:"activity-artifact",title:`Show ${i.path} in its folder`,onClick:()=>{he(i.path)},children:[n.jsx(N,{"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:ke(i.sizeBytes)})]},i.path))})}function _n({artifact:e,connection:t}){const[s,i]=d.useState(!1),a=ue(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(W,{"aria-hidden":!0,size:20})}),n.jsx("strong",{children:e.title}),n.jsx(de,{open:s&&!!a,src:a,title:e.title,onClose:()=>i(!1)})]})}function En({artifact:e,connection:t,onOpenFileInSidebar:s}){const i=d.useRef(null),[a,r]=d.useState(!1),l=pn(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(it,{"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:()=>{he(e.path)},title:`Show ${e.path} in its folder`,children:[n.jsx(st,{"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:ke(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(Le,{"aria-hidden":!0,size:13}),"Open in sidebar"]}):null]})]})}function ke(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 Re({activity:e}){const[t,s]=d.useState(!1),i=e.subagentMessage;if(!i)return null;const a=`${Se(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=Ln(i),o=Fn(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(me,{"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":Ne},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 Pn({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(Re,{activity:s},s.id))})}function Ln(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 Fn(e){return e.length>An||e.split(/\r?\n/).length>Ne}function Un(e,t,s,i){return t==="running"?Bn(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 Bn(e){let t=null;for(let s=e.length-1;s>=0;s-=1){const i=e[s];if(i.kind!=="reasoning"&&(t??=i,i.state==="running"||i.state==="pending"))return z(i)}return t?z(t):null}function z(e){return e.kind==="command"?e.state==="failed"?"Command failed":fe(e.content,e.state)??(e.state==="running"||e.state==="pending"?"Running command":"Ran command"):e.label.trim()||null}function On(e){if(e.kind!=="command")return e.label;if(e.state==="running"||e.state==="pending")return z(e)??"Running command";const t=Wn(e.terminal?.durationMs);return e.state==="failed"?`Command failed${t?` in ${t}`:""}`:`${z(e)??"Ran command"}${t?` in ${t}`:""}`}function Gn({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:"$ "}),Dn(e),s?n.jsx("span",{className:"activity-command-output",children:`
|
|
4
4
|
${s.replace(/\r\n/g,`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,i as o,a0 as c,X as n}from"./index-
|
|
1
|
+
import{j as e,i as o,a0 as c,X as n}from"./index-LrGasYyx.js";import{M as d}from"./MarkdownText-R3MC5S30.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,e as b}from"./index-
|
|
1
|
+
import{j as e,X as N,e as b}from"./index-LrGasYyx.js";import{F as f}from"./folder-open-8C5l7A93.js";import{F as P}from"./folder-plus-B9Wqb9yd.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,p as W,j as e,aS as A,aL as D,X as B,i as R}from"./index-
|
|
1
|
+
import{r as i,p as W,j as e,aS as A,aL as D,X as B,i as R}from"./index-LrGasYyx.js";import{s as M,r as z,C as K,F as X}from"./MarkdownText-R3MC5S30.js";import{F as q,I as H,P as Y,a as V,b as G}from"./MainPane-CQCLhV5C.js";import{F as J}from"./folder-open-8C5l7A93.js";import"./cloud-upload-D6bS8rS2.js";import"./arrow-up-right-BDcNd1rt.js";import"./square-B5q2aneb.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 Nt({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}),O=x(n),E=O.type==="text"||O.type==="html";l?.objectUrl&&URL.revokeObjectURL(l.objectUrl),T({file:N,objectUrl:E?null:URL.createObjectURL(N),output:n,text:E?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{Nt as OutputsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,c3 as xe,c4 as we,c5 as Re,c6 as je,a9 as ye,ad as Pe,ap as Ce,j as i,c7 as Ie,ae as Ae,af as Te,ai as Se,ag as Me,X as Ne,P as Ee,a2 as Fe}from"./index-BO2W2U23.js";import{F as pe}from"./folder-open-9OjGqNgP.js";import{u as $e,T as De,M as Be}from"./Messages-DijmQL-z.js";import{c as Le,u as Oe,s as Ue,d as qe,e as ze,A as He,f as Ke}from"./MainPane-CuhwxMxg.js";import"./chevron-up-4qfvI9iW.js";import"./MarkdownText-gwAue4u5.js";import"./arrow-up-right-DYGSWA2J.js";import"./git-branch-eCwyZXMl.js";import"./play-Ctx-iMqd.js";import"./refresh-cw-Bn28jIl0.js";import"./cloud-upload-COReKxOy.js";import"./square-DAGpFfSr.js";function Ve({panel:t,runtimeEventStore:L,actionCatalog:R,createImproveActions:j,contextCompaction:y,initialScrollState:m,codexPermissionMode:O,codexReasoningEffort:U,openPondCommandAccessMode:P,connection:C,connectedAppMentions:q,mentionApps:z,codexPersonalSkills:H,profileSkills:K,profileTarget:I,projectTarget:V,providerSettings:W,accountBaseUrl:Q,billingOrganizationSlug:G,billingTeamId:X,showToast:_,workspaceTarget:J,onCodexPermissionModeChange:Y,onCodexReasoningEffortChange:Z,onOpenPondCommandAccessModeChange:A,onModelChange:ee,onOpenAttachmentInSidebar:te,onOpenFileInSidebar:se,onOpenProfileSettings:oe,onOpenSession:ie,onProviderChange:ne,onProviderSetupOpen:re,onPromptChange:ae,onProfileTargetChange:ce,onScrollStateChange:de,onProjectTargetChange:le,onResolveApproval:ue,onShowBrowserPanel:T,onStop:fe,onSubmit:v,onWorkspaceTargetChange:he}){const k=r.useRef(null),[p]=r.useState(()=>new Le),b=r.useRef(m?.stickyToBottom??!0),S=r.useRef(!1),M=Oe(L,t.runtimeSource==="live"?t.sessionId:null),o=r.useMemo(()=>{if(t.runtimeSource==="history"||!t.sessionId)return t;const s=M.events,d=xe(s,[]);return{...t,messages:Pe(p.project(s),t.pendingUserMessage),createImproveRun:ye({events:s}),contextWindowStatus:Re({provider:t.provider,snapshot:je(d,t.sessionId),preferences:y}),goalRuntime:we(d,t.sessionId)}},[p,y,M,t]),l=o.running&&!o.pendingApproval&&Ue(o.messages),h=r.useMemo(()=>o.createImproveRun?{...j,run:o.createImproveRun}:null,[o.createImproveRun,j]),N=r.useMemo(()=>qe(o.messages,{showThinkingIndicator:l}),[o.messages,l]),E=$e(o.messages,o.sessionId??`draft:${o.id}`),g=o.messages.at(-1),x=[o.id,o.sessionId??"draft",N.length,g?.id??"",g?.content?.length??0,g?.timestamp??"",l?"thinking":""].join(":");r.useLayoutEffect(()=>{const s=k.current;!s||S.current||(S.current=!0,s.scrollTop=m?.stickyToBottom?s.scrollHeight:m?.scrollTop??0)},[m]),ze({contentKey:x,onContentChange:s=>{b.current&&(s.scrollTop=s.scrollHeight)},threadRef:k});const F=r.useCallback((s,d)=>{const u=o.sessionId??`side-chat:${o.id}`;Ce({conversationId:u,href:s,explicitFile:d?.explicitFile,newTab:d?.newTab}).then(D=>{D&&T()})},[o.id,o.sessionId,T]),$=r.useCallback(async(s,d)=>{const u=d.action==="answer"?d.text:"Dismiss this question";if(!await v([],null,null,{displayPrompt:u,promptOverride:u,turnMetadata:{userQuestionResolution:d}}))throw new Error("The question response could not be sent.")},[v]);return i.jsxs("section",{className:`right-chat-pane ${o.pendingApproval?"has-approval":""}`,id:`right-chat-panel-${o.id}`,role:"tabpanel","aria-labelledby":`right-chat-tab-${o.id}`,children:[i.jsx("div",{className:"chat-thread right-chat-thread",ref:k,onScroll:s=>{const d=s.currentTarget;b.current=d.scrollHeight-d.scrollTop-d.clientHeight<=72,de({scrollTop:d.scrollTop,stickyToBottom:b.current})},children:N.map(s=>s.type==="thinking"?i.jsx(De,{},s.id):i.jsx(Be,{activeWorkspaceAppId:o.activeWorkspaceAppId,accountBaseUrl:Q,billingOrganizationSlug:G,billingTeamId:X,connection:C,animateInitialContent:s.message.role==="assistant"&&E.has(s.message.id),message:s.message,onOpenBrowserLink:F,onOpenAttachmentInSidebar:te,onOpenFileInSidebar:se,onOpenProfileSettings:oe,onResolveUserQuestion:$,onOpenSession:ie,userAttachmentDisplay:t.provider==="codex"?"compact":"full",workspaceRootPath:o.workspaceRootPath,showFooter:s.showFooter},s.id))}),i.jsxs("div",{className:`composer-stack dock right-chat-composer ${o.pendingApproval?"has-approval":""}`,children:[i.jsx(He,{approval:o.pendingApproval,onResolve:ue}),i.jsx(Ke,{mode:"dock",prompt:t.prompt,mentionApps:z,connectedAppMentions:q,profileSkills:t.provider==="codex"?H:K,profileTarget:t.provider==="codex"?null:I,selectedMentionAppId:null,contextWindowStatus:o.contextWindowStatus,goalRuntime:o.goalRuntime,createImproveRuntime:h,busy:o.running,running:o.running,submissionScopeKey:o.sessionId??o.id,showProjectFooter:!1,connection:C,providerSettings:W,provider:t.provider,model:t.model,projectTarget:V,actionCatalog:R,workspaceTarget:J,codexPermissionMode:O,codexReasoningEffort:U,openPondCommandAccessMode:t.provider==="codex"?P:o.session?.openPondCommandAccessMode??P,onProviderChange:ne,onProviderSetupOpen:re,onProjectTargetChange:le,onWorkspaceTargetChange:he,onModelChange:ee,onCodexPermissionModeChange:Y,onCodexReasoningEffortChange:Z,onOpenPondCommandAccessModeChange:A,onPromptChange:ae,onProfileTargetChange:ce,onMentionAppSelect:void 0,showToast:_,onSubmit:v,onStop:fe})]})]})}function it({panels:t,runtimeEventStore:L,actionCatalog:R=[],createImproveActions:j,contextCompaction:y,busy:m,codexPermissionMode:O,codexReasoningEffort:U,openPondCommandAccessMode:P,connection:C,connectedAppMentions:q,mentionApps:z,codexPersonalSkills:H,profileSkills:K=[],profileLibrary:I={lastUsed:null,profiles:[]},extensionCatalog:V,projectTarget:W,providerSettings:Q,accountBaseUrl:G,billingOrganizationSlug:X,billingTeamId:_,showToast:J,workspaceTarget:Y,onAddChat:Z,onActivatePanel:A,onClosePanel:ee,onCodexPermissionModeChange:te,onCodexReasoningEffortChange:se,onOpenPondCommandAccessModeChange:oe,onModelChange:ie,onOpenAttachmentInSidebar:ne,onOpenFileInSidebar:re,onOpenProfileSettings:ae,onOpenSession:ce,onProviderChange:de,onProviderSetupOpen:le,onPromptChange:ue,onProfileTargetChange:T,onScrollStateChange:fe,onProjectTargetChange:v,onResolveApproval:he,onResizeStart:k,onSelectFiles:p,onShowBrowserPanel:b,onStop:S,onSubmit:M,onWorkspaceTargetChange:o}){const[l,h]=r.useState(!1),[N,E]=r.useState(()=>Ie(t)?.id??null),g=r.useRef(null),x=r.useRef(new Map),F=r.useRef(new Set(t.map(e=>e.id))),$=r.useRef(new Map(t.map(e=>[e.id,e.activationVersion]))),s=t.find(e=>e.id===N)??t.at(-1)??null,d=s?.session?.currentProfile??I.lastUsed,u=Ae(I,d),D=u?Te(u,V):K,ge=u?[...R.filter(e=>!Se(e)),...Me(u)]:R;r.useEffect(()=>{const e=F.current,c=$.current;let a=null,f=null;for(const n of t)e.has(n.id)||(a=n),e.has(n.id)&&n.activationVersion>(c.get(n.id)??0)&&(f=n);F.current=new Set(t.map(n=>n.id)),$.current=new Map(t.map(n=>[n.id,n.activationVersion])),E(n=>f?f.id:a?a.id:n&&t.some(B=>B.id===n)?n:t.at(-1)?.id??null)},[t]),r.useEffect(()=>{if(!l)return;function e(a){g.current?.contains(a.target)||h(!1)}function c(a){a.key==="Escape"&&h(!1)}return document.addEventListener("pointerdown",e),document.addEventListener("keydown",c),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",c)}},[l]);const w=r.useCallback((e,c=!1)=>{E(e),A(e),c&&window.requestAnimationFrame(()=>x.current.get(e)?.focus())},[A]),me=r.useCallback((e=!1)=>{p(),e&&window.requestAnimationFrame(()=>{document.getElementById("right-sidebar-files-tab")?.focus()})},[p]),ve=r.useCallback((e,c)=>{const a=t.findIndex(be=>be.id===c);if(a<0)return;const f=a+1;let n=null;if(e.key==="ArrowRight"&&(n=(f+1)%(t.length+1)),e.key==="ArrowLeft"&&(n=(f-1+t.length+1)%(t.length+1)),e.key==="Home"&&(n=0),e.key==="End"&&(n=t.length),n===null)return;if(e.preventDefault(),n===0){me(!0);return}const B=t[n-1];B&&w(B.id,!0)},[t,me,w]),ke=r.useCallback(e=>{if(!["ArrowRight","ArrowLeft","Home","End"].includes(e.key)||(e.preventDefault(),e.key==="Home"))return;const c=e.key==="ArrowLeft"||e.key==="End"?t.at(-1):t[0];c&&w(c.id,!0)},[t,w]);return i.jsxs("aside",{className:"workspace-diff-panel right-chat-panel-stack","aria-label":"Side chats",children:[i.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize side chat panel",onPointerDown:k}),i.jsx("div",{className:"workspace-diff-topbar right-chat-topbar",children:i.jsxs("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",children:[i.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:()=>me(!1),onKeyDown:ke,children:[i.jsx(pe,{size:14}),i.jsx("span",{children:"Files"})]}),t.map(e=>{const c=e.id===s?.id;return i.jsxs("div",{className:`workspace-diff-tab right-chat-tab ${c?"active":""}`,children:[i.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab",id:`right-chat-tab-${e.id}`,"aria-controls":`right-chat-panel-${e.id}`,"aria-selected":c,tabIndex:c?0:-1,title:e.title,ref:a=>{a?x.current.set(e.id,a):x.current.delete(e.id)},onClick:()=>w(e.id),onKeyDown:a=>ve(a,e.id),children:[e.running?i.jsx("span",{className:"right-chat-status-dot","aria-label":"Running"}):null,i.jsx("span",{children:e.title})]}),i.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${e.title}`,"aria-label":`Close ${e.title}`,onClick:a=>{a.stopPropagation(),ee(e.id)},children:i.jsx(Ne,{size:12})})]},e.id)}),i.jsxs("div",{className:"workspace-diff-add-anchor",ref:g,children:[i.jsx("button",{type:"button",className:`workspace-diff-add-tab ${l?"active":""}`,title:"Add to right sidebar","aria-label":"Add to right sidebar","aria-haspopup":"menu","aria-expanded":l,onClick:()=>h(e=>!e),children:i.jsx(Ee,{size:15})}),l?i.jsxs("div",{className:"workspace-diff-add-menu right-chat-add-popover",role:"menu",children:[i.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(!1),Z()},children:[i.jsx(Fe,{size:13}),i.jsx("span",{children:"New task"})]}),i.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(!1),p()},children:[i.jsx(pe,{size:13}),i.jsx("span",{children:"Files"})]})]}):null]})]})}),i.jsx("div",{className:"right-chat-stack-body panes-1",children:s?i.jsx(Ve,{busy:m,createImproveActions:j,contextCompaction:y,codexPermissionMode:O,codexReasoningEffort:U,openPondCommandAccessMode:P,connection:C,connectedAppMentions:q,actionCatalog:ge,mentionApps:z,codexPersonalSkills:H,profileSkills:D,profileTarget:null,panel:s,runtimeEventStore:L,initialScrollState:{scrollTop:s.scrollTop,stickyToBottom:s.stickyToBottom},projectTarget:W,providerSettings:Q,accountBaseUrl:G,billingOrganizationSlug:X,billingTeamId:_,showToast:J,workspaceTarget:Y,onCodexPermissionModeChange:te,onCodexReasoningEffortChange:se,onOpenPondCommandAccessModeChange:e=>oe(e,s.session),onModelChange:e=>ie(s.id,e),onOpenAttachmentInSidebar:ne,onOpenFileInSidebar:re,onOpenProfileSettings:ae,onOpenSession:ce,onProviderChange:e=>de(s.id,e),onProviderSetupOpen:le,onPromptChange:e=>ue(s.id,e),onProfileTargetChange:e=>T(s.sessionId,e),onScrollStateChange:e=>fe(s.id,e),onProjectTargetChange:v,onResolveApproval:he,onShowBrowserPanel:b,onStop:()=>S(s.sessionId),onSubmit:(e,c,a,f)=>M(s.id,e,c,a,f),onWorkspaceTargetChange:o},s.id):null})]})}export{it as RightChatPanelStack};
|
|
1
|
+
import{r,c3 as xe,c4 as we,c5 as Re,c6 as je,a9 as ye,ad as Pe,ap as Ce,j as i,c7 as Ie,ae as Ae,af as Te,ai as Se,ag as Me,X as Ne,P as Ee,a2 as Fe}from"./index-LrGasYyx.js";import{F as pe}from"./folder-open-8C5l7A93.js";import{u as $e,T as De,M as Be}from"./Messages-DpZ8mIz8.js";import{c as Le,u as Oe,s as Ue,d as qe,e as ze,A as He,f as Ke}from"./MainPane-CQCLhV5C.js";import"./chevron-up-XTMMnfnf.js";import"./MarkdownText-R3MC5S30.js";import"./arrow-up-right-BDcNd1rt.js";import"./git-branch-C45ve7zh.js";import"./play-Cbsyrwkw.js";import"./refresh-cw-ChUK_QfF.js";import"./cloud-upload-D6bS8rS2.js";import"./square-B5q2aneb.js";function Ve({panel:t,runtimeEventStore:L,actionCatalog:R,createImproveActions:j,contextCompaction:y,initialScrollState:m,codexPermissionMode:O,codexReasoningEffort:U,openPondCommandAccessMode:P,connection:C,connectedAppMentions:q,mentionApps:z,codexPersonalSkills:H,profileSkills:K,profileTarget:I,projectTarget:V,providerSettings:W,accountBaseUrl:Q,billingOrganizationSlug:G,billingTeamId:X,showToast:_,workspaceTarget:J,onCodexPermissionModeChange:Y,onCodexReasoningEffortChange:Z,onOpenPondCommandAccessModeChange:A,onModelChange:ee,onOpenAttachmentInSidebar:te,onOpenFileInSidebar:se,onOpenProfileSettings:oe,onOpenSession:ie,onProviderChange:ne,onProviderSetupOpen:re,onPromptChange:ae,onProfileTargetChange:ce,onScrollStateChange:de,onProjectTargetChange:le,onResolveApproval:ue,onShowBrowserPanel:T,onStop:fe,onSubmit:v,onWorkspaceTargetChange:he}){const k=r.useRef(null),[p]=r.useState(()=>new Le),b=r.useRef(m?.stickyToBottom??!0),S=r.useRef(!1),M=Oe(L,t.runtimeSource==="live"?t.sessionId:null),o=r.useMemo(()=>{if(t.runtimeSource==="history"||!t.sessionId)return t;const s=M.events,d=xe(s,[]);return{...t,messages:Pe(p.project(s),t.pendingUserMessage),createImproveRun:ye({events:s}),contextWindowStatus:Re({provider:t.provider,snapshot:je(d,t.sessionId),preferences:y}),goalRuntime:we(d,t.sessionId)}},[p,y,M,t]),l=o.running&&!o.pendingApproval&&Ue(o.messages),h=r.useMemo(()=>o.createImproveRun?{...j,run:o.createImproveRun}:null,[o.createImproveRun,j]),N=r.useMemo(()=>qe(o.messages,{showThinkingIndicator:l}),[o.messages,l]),E=$e(o.messages,o.sessionId??`draft:${o.id}`),g=o.messages.at(-1),x=[o.id,o.sessionId??"draft",N.length,g?.id??"",g?.content?.length??0,g?.timestamp??"",l?"thinking":""].join(":");r.useLayoutEffect(()=>{const s=k.current;!s||S.current||(S.current=!0,s.scrollTop=m?.stickyToBottom?s.scrollHeight:m?.scrollTop??0)},[m]),ze({contentKey:x,onContentChange:s=>{b.current&&(s.scrollTop=s.scrollHeight)},threadRef:k});const F=r.useCallback((s,d)=>{const u=o.sessionId??`side-chat:${o.id}`;Ce({conversationId:u,href:s,explicitFile:d?.explicitFile,newTab:d?.newTab}).then(D=>{D&&T()})},[o.id,o.sessionId,T]),$=r.useCallback(async(s,d)=>{const u=d.action==="answer"?d.text:"Dismiss this question";if(!await v([],null,null,{displayPrompt:u,promptOverride:u,turnMetadata:{userQuestionResolution:d}}))throw new Error("The question response could not be sent.")},[v]);return i.jsxs("section",{className:`right-chat-pane ${o.pendingApproval?"has-approval":""}`,id:`right-chat-panel-${o.id}`,role:"tabpanel","aria-labelledby":`right-chat-tab-${o.id}`,children:[i.jsx("div",{className:"chat-thread right-chat-thread",ref:k,onScroll:s=>{const d=s.currentTarget;b.current=d.scrollHeight-d.scrollTop-d.clientHeight<=72,de({scrollTop:d.scrollTop,stickyToBottom:b.current})},children:N.map(s=>s.type==="thinking"?i.jsx(De,{},s.id):i.jsx(Be,{activeWorkspaceAppId:o.activeWorkspaceAppId,accountBaseUrl:Q,billingOrganizationSlug:G,billingTeamId:X,connection:C,animateInitialContent:s.message.role==="assistant"&&E.has(s.message.id),message:s.message,onOpenBrowserLink:F,onOpenAttachmentInSidebar:te,onOpenFileInSidebar:se,onOpenProfileSettings:oe,onResolveUserQuestion:$,onOpenSession:ie,userAttachmentDisplay:t.provider==="codex"?"compact":"full",workspaceRootPath:o.workspaceRootPath,showFooter:s.showFooter},s.id))}),i.jsxs("div",{className:`composer-stack dock right-chat-composer ${o.pendingApproval?"has-approval":""}`,children:[i.jsx(He,{approval:o.pendingApproval,onResolve:ue}),i.jsx(Ke,{mode:"dock",prompt:t.prompt,mentionApps:z,connectedAppMentions:q,profileSkills:t.provider==="codex"?H:K,profileTarget:t.provider==="codex"?null:I,selectedMentionAppId:null,contextWindowStatus:o.contextWindowStatus,goalRuntime:o.goalRuntime,createImproveRuntime:h,busy:o.running,running:o.running,submissionScopeKey:o.sessionId??o.id,showProjectFooter:!1,connection:C,providerSettings:W,provider:t.provider,model:t.model,projectTarget:V,actionCatalog:R,workspaceTarget:J,codexPermissionMode:O,codexReasoningEffort:U,openPondCommandAccessMode:t.provider==="codex"?P:o.session?.openPondCommandAccessMode??P,onProviderChange:ne,onProviderSetupOpen:re,onProjectTargetChange:le,onWorkspaceTargetChange:he,onModelChange:ee,onCodexPermissionModeChange:Y,onCodexReasoningEffortChange:Z,onOpenPondCommandAccessModeChange:A,onPromptChange:ae,onProfileTargetChange:ce,onMentionAppSelect:void 0,showToast:_,onSubmit:v,onStop:fe})]})]})}function it({panels:t,runtimeEventStore:L,actionCatalog:R=[],createImproveActions:j,contextCompaction:y,busy:m,codexPermissionMode:O,codexReasoningEffort:U,openPondCommandAccessMode:P,connection:C,connectedAppMentions:q,mentionApps:z,codexPersonalSkills:H,profileSkills:K=[],profileLibrary:I={lastUsed:null,profiles:[]},extensionCatalog:V,projectTarget:W,providerSettings:Q,accountBaseUrl:G,billingOrganizationSlug:X,billingTeamId:_,showToast:J,workspaceTarget:Y,onAddChat:Z,onActivatePanel:A,onClosePanel:ee,onCodexPermissionModeChange:te,onCodexReasoningEffortChange:se,onOpenPondCommandAccessModeChange:oe,onModelChange:ie,onOpenAttachmentInSidebar:ne,onOpenFileInSidebar:re,onOpenProfileSettings:ae,onOpenSession:ce,onProviderChange:de,onProviderSetupOpen:le,onPromptChange:ue,onProfileTargetChange:T,onScrollStateChange:fe,onProjectTargetChange:v,onResolveApproval:he,onResizeStart:k,onSelectFiles:p,onShowBrowserPanel:b,onStop:S,onSubmit:M,onWorkspaceTargetChange:o}){const[l,h]=r.useState(!1),[N,E]=r.useState(()=>Ie(t)?.id??null),g=r.useRef(null),x=r.useRef(new Map),F=r.useRef(new Set(t.map(e=>e.id))),$=r.useRef(new Map(t.map(e=>[e.id,e.activationVersion]))),s=t.find(e=>e.id===N)??t.at(-1)??null,d=s?.session?.currentProfile??I.lastUsed,u=Ae(I,d),D=u?Te(u,V):K,ge=u?[...R.filter(e=>!Se(e)),...Me(u)]:R;r.useEffect(()=>{const e=F.current,c=$.current;let a=null,f=null;for(const n of t)e.has(n.id)||(a=n),e.has(n.id)&&n.activationVersion>(c.get(n.id)??0)&&(f=n);F.current=new Set(t.map(n=>n.id)),$.current=new Map(t.map(n=>[n.id,n.activationVersion])),E(n=>f?f.id:a?a.id:n&&t.some(B=>B.id===n)?n:t.at(-1)?.id??null)},[t]),r.useEffect(()=>{if(!l)return;function e(a){g.current?.contains(a.target)||h(!1)}function c(a){a.key==="Escape"&&h(!1)}return document.addEventListener("pointerdown",e),document.addEventListener("keydown",c),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",c)}},[l]);const w=r.useCallback((e,c=!1)=>{E(e),A(e),c&&window.requestAnimationFrame(()=>x.current.get(e)?.focus())},[A]),me=r.useCallback((e=!1)=>{p(),e&&window.requestAnimationFrame(()=>{document.getElementById("right-sidebar-files-tab")?.focus()})},[p]),ve=r.useCallback((e,c)=>{const a=t.findIndex(be=>be.id===c);if(a<0)return;const f=a+1;let n=null;if(e.key==="ArrowRight"&&(n=(f+1)%(t.length+1)),e.key==="ArrowLeft"&&(n=(f-1+t.length+1)%(t.length+1)),e.key==="Home"&&(n=0),e.key==="End"&&(n=t.length),n===null)return;if(e.preventDefault(),n===0){me(!0);return}const B=t[n-1];B&&w(B.id,!0)},[t,me,w]),ke=r.useCallback(e=>{if(!["ArrowRight","ArrowLeft","Home","End"].includes(e.key)||(e.preventDefault(),e.key==="Home"))return;const c=e.key==="ArrowLeft"||e.key==="End"?t.at(-1):t[0];c&&w(c.id,!0)},[t,w]);return i.jsxs("aside",{className:"workspace-diff-panel right-chat-panel-stack","aria-label":"Side chats",children:[i.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize side chat panel",onPointerDown:k}),i.jsx("div",{className:"workspace-diff-topbar right-chat-topbar",children:i.jsxs("div",{className:"workspace-diff-tabs",role:"tablist","aria-label":"Right sidebar views",children:[i.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:()=>me(!1),onKeyDown:ke,children:[i.jsx(pe,{size:14}),i.jsx("span",{children:"Files"})]}),t.map(e=>{const c=e.id===s?.id;return i.jsxs("div",{className:`workspace-diff-tab right-chat-tab ${c?"active":""}`,children:[i.jsxs("button",{type:"button",className:"workspace-diff-tab-main",role:"tab",id:`right-chat-tab-${e.id}`,"aria-controls":`right-chat-panel-${e.id}`,"aria-selected":c,tabIndex:c?0:-1,title:e.title,ref:a=>{a?x.current.set(e.id,a):x.current.delete(e.id)},onClick:()=>w(e.id),onKeyDown:a=>ve(a,e.id),children:[e.running?i.jsx("span",{className:"right-chat-status-dot","aria-label":"Running"}):null,i.jsx("span",{children:e.title})]}),i.jsx("button",{type:"button",className:"workspace-diff-tab-close",title:`Close ${e.title}`,"aria-label":`Close ${e.title}`,onClick:a=>{a.stopPropagation(),ee(e.id)},children:i.jsx(Ne,{size:12})})]},e.id)}),i.jsxs("div",{className:"workspace-diff-add-anchor",ref:g,children:[i.jsx("button",{type:"button",className:`workspace-diff-add-tab ${l?"active":""}`,title:"Add to right sidebar","aria-label":"Add to right sidebar","aria-haspopup":"menu","aria-expanded":l,onClick:()=>h(e=>!e),children:i.jsx(Ee,{size:15})}),l?i.jsxs("div",{className:"workspace-diff-add-menu right-chat-add-popover",role:"menu",children:[i.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(!1),Z()},children:[i.jsx(Fe,{size:13}),i.jsx("span",{children:"New task"})]}),i.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(!1),p()},children:[i.jsx(pe,{size:13}),i.jsx("span",{children:"Files"})]})]}):null]})]})}),i.jsx("div",{className:"right-chat-stack-body panes-1",children:s?i.jsx(Ve,{busy:m,createImproveActions:j,contextCompaction:y,codexPermissionMode:O,codexReasoningEffort:U,openPondCommandAccessMode:P,connection:C,connectedAppMentions:q,actionCatalog:ge,mentionApps:z,codexPersonalSkills:H,profileSkills:D,profileTarget:null,panel:s,runtimeEventStore:L,initialScrollState:{scrollTop:s.scrollTop,stickyToBottom:s.stickyToBottom},projectTarget:W,providerSettings:Q,accountBaseUrl:G,billingOrganizationSlug:X,billingTeamId:_,showToast:J,workspaceTarget:Y,onCodexPermissionModeChange:te,onCodexReasoningEffortChange:se,onOpenPondCommandAccessModeChange:e=>oe(e,s.session),onModelChange:e=>ie(s.id,e),onOpenAttachmentInSidebar:ne,onOpenFileInSidebar:re,onOpenProfileSettings:ae,onOpenSession:ce,onProviderChange:e=>de(s.id,e),onProviderSetupOpen:le,onPromptChange:e=>ue(s.id,e),onProfileTargetChange:e=>T(s.sessionId,e),onScrollStateChange:e=>fe(s.id,e),onProjectTargetChange:v,onResolveApproval:he,onShowBrowserPanel:b,onStop:()=>S(s.sessionId),onSubmit:(e,c,a,f)=>M(s.id,e,c,a,f),onWorkspaceTargetChange:o},s.id):null})]})}export{it as RightChatPanelStack};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,p as $,j as e,aS as oe,c0 as ue,a0 as he,X as me,ba as G,A as xe,ay as _,c1 as fe}from"./index-BO2W2U23.js";import{u as je,R as X}from"./useLocalAgentSchedules-Ccenbqf6.js";import{M as pe,A as ye,T as be,P as J}from"./MarkdownText-gwAue4u5.js";import{P as Q}from"./play-Ctx-iMqd.js";import{R as ve}from"./refresh-cw-Bn28jIl0.js";import{S as ge}from"./save-BM5IQX65.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 b=await $.hostedSavedWork(c);n(b.definitions),d(b.runs),u(b.webBaseUrl??null),f(null)}catch(b){f(U(b))}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 b=window.setInterval(()=>{p(!1)},we);return()=>{c=!0,window.clearInterval(b)}},[s]);async function y(){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 b=>{await $.updateHostedSavedWork(b,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(b){throw f(U(b)),b}finally{g(c,!1)}}}function g(c,p){v(b=>{const k=new Set(b);return p?k.add(c):k.delete(c),k})}return{create:D,definitions:t,error:r,loading:o,pendingScheduleIds:R,refresh:y,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(ye,{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(y=>e.jsxs("button",{"aria-current":n===y.key?"true":void 0,className:`scheduled-calendar-event${y.enabled?"":" paused"}`,onClick:()=>t(y.key),title:y.title,type:"button",children:[e.jsx("span",{children:Ee(y.nextRunAt)}),e.jsx("strong",{children:y.title})]},y.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),[y,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)===y)??null,g=o.schedules.find(h=>W(h.id)===y)??null,c=x?u.runs.filter(h=>h.scheduleId===x.schedule.id):[],p=i.useMemo(()=>Ue(E,S),[E,S]),b=i.useMemo(()=>p.map(Oe),[p]);_(u.error,{prefix:"Scheduled Work"}),_(o.error,{prefix:"Local schedules"}),i.useEffect(()=>{y&&!x&&!g&&D(null)},[x,g,y]),i.useEffect(()=>{!t&&y&&D(null)},[t,y]),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:b,onSelect:k,selectedKey:y}):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:y===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:y===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,y]=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),[b,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||b!==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:b,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(be,{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=>y(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:b})]}),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,p as $,j as e,aS as oe,c0 as ue,a0 as he,X as me,ba as G,A as xe,ay as _,c1 as fe}from"./index-LrGasYyx.js";import{u as je,R as X}from"./useLocalAgentSchedules-BwltnId8.js";import{M as pe,c as ye,T as be,P as J}from"./MarkdownText-R3MC5S30.js";import{P as Q}from"./play-Cbsyrwkw.js";import{R as ve}from"./refresh-cw-ChUK_QfF.js";import{S as ge}from"./save-Doep-KC7.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 b=await $.hostedSavedWork(c);n(b.definitions),d(b.runs),u(b.webBaseUrl??null),f(null)}catch(b){f(U(b))}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 b=window.setInterval(()=>{p(!1)},we);return()=>{c=!0,window.clearInterval(b)}},[s]);async function y(){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 b=>{await $.updateHostedSavedWork(b,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(b){throw f(U(b)),b}finally{g(c,!1)}}}function g(c,p){v(b=>{const k=new Set(b);return p?k.add(c):k.delete(c),k})}return{create:D,definitions:t,error:r,loading:o,pendingScheduleIds:R,refresh:y,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(ye,{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(y=>e.jsxs("button",{"aria-current":n===y.key?"true":void 0,className:`scheduled-calendar-event${y.enabled?"":" paused"}`,onClick:()=>t(y.key),title:y.title,type:"button",children:[e.jsx("span",{children:Ee(y.nextRunAt)}),e.jsx("strong",{children:y.title})]},y.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),[y,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)===y)??null,g=o.schedules.find(h=>W(h.id)===y)??null,c=x?u.runs.filter(h=>h.scheduleId===x.schedule.id):[],p=i.useMemo(()=>Ue(E,S),[E,S]),b=i.useMemo(()=>p.map(Oe),[p]);_(u.error,{prefix:"Scheduled Work"}),_(o.error,{prefix:"Local schedules"}),i.useEffect(()=>{y&&!x&&!g&&D(null)},[x,g,y]),i.useEffect(()=>{!t&&y&&D(null)},[t,y]),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:b,onSelect:k,selectedKey:y}):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:y===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:y===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,y]=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),[b,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||b!==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:b,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(be,{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=>y(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:b})]}),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};
|